Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Connect any MCP client

This page is for people who connect TKTail to an AI client, an agent framework or their own script - and for the model on the other side. It lists what a client needs to know; AI integration is the user’s view, the MCP tool reference the exact tools, and the developer reference (docs/MCP.md) every detail.

Connection

stdioStreamable HTTP
Who starts whatthe client starts TKTail.exe mcp --stdiothe client connects to the running TKTail
Editionevery editionTrial, Pro, Developer
Turned on bythe user: Allow AI accessthe user: Allow AI access + Accept AI clients over HTTP
Addressstandard input / output, one JSON-RPC message per linePOST http://127.0.0.1:47711/mcp (port and network bind are the user’s settings)
Authenticationyour Windows user (the per-user pipe)Authorization: Bearer <token> on every request - also on this computer
ConfigurationSettings > AI Access > Copy Client ConfigurationSettings > AI Access > Copy HTTP Client Configuration

Protocol revisions: 2026-07-28 (stateless: _meta io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities on every request) and 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05 (an initialize handshake). Capabilities: tools only - no resources, prompts or sampling.

HTTP specifics:

  • Content-Type: application/json; Accept must include application/json (application/json, text/event-stream is fine). Replies are single JSON objects - TKTail opens no event stream (GET is 405).
  • One message per POST; notifications are answered with 202, batches are refused.
  • Handshake revisions: initialize returns Mcp-Session-Id; send it with every later request and DELETE /mcp with it to end the session. 404 means the session is gone (TKTail restarted, the token was regenerated, or 30 idle minutes) - initialize again.
  • 2026-07-28: send MCP-Protocol-Version, Mcp-Method and, for tools/call, Mcp-Name - they must equal the body (400 otherwise).
  • 401: the token is missing or replaced; 403: a Host other than a loopback name (when TKTail listens on this computer only) or a browser Origin; 503: more than 8 connections at once.

First calls

  1. tktail_status - the edition and what the license allows (license, features), whether a TKTail window answers (connection), the investigation scope (investigationScope: safeWorkspace or safeWorkspace+extended), the tool names and the limits of the answers.
  2. tktail_list_sources - the open logs, event logs and Metrics Views, each with a sourceId.
  3. tktail_get_current_context - what the user is looking at.

Source ids (src-...) and evidence references are valid while that TKTail runs: list again after a restart; pass references back unchanged.

Permissions

Every refusal is a tool result with isError: true and structuredContent.error {category, message} - the message says what the user can do. A client should tell the user, not retry:

CategoryMeaning
access_offthe user has not allowed AI access
capability_unavailablethe license does not include it (Extended Investigation, Metrics, HTTP)
not_alloweda change whose permission is off - Allow AI to save custom formats, to save searches and Metric Sets, to manage alerts
scope_not_alloweda path that is not open in TKTail and not below an Investigation Root the user approved
conflictthe alert, Saved Search, Metric Set or profile changed since it was read - read it again

The full list is in docs/MCP.md “Tool errors”. Writing tools are annotated readOnlyHint: false; ask the user before calling one, and validate first (tktail_validate_format, tktail_validate_alert - they need no permission and write nothing).

What TKTail reads and writes

ObjectShapeCheck it with
Format profilethe profile file’s JSON - JSON Schema, docs/CUSTOM_FORMATS.mdtktail_validate_format, tktail_preview_format
Searcha SearchDefinition: sources + predicate (text, regex, fields, time), optionally a sequence - docs/SEARCH.md “Schema”tktail_search (it says what ran in definition)
Metric Setname, metrics: {object, counter, instance} in English, as tktail_list_metrics shows themtktail_save_metric_set refuses an unknown counter
Alertthe alert file’s JSON - name, severity, condition (a search definition), trigger, actions, capture - docs/ALERTS.md; tktail_get_alert shows a saved one as alerttktail_validate_alert
EvidenceevidenceRef objects from records, results and contexts; incidents and their evidence pagestktail_get_record, tktail_get_occurrence_evidence

The authoritative check is always TKTail’s own: the JSON Schema helps an editor or a generator, the validation tools also check patterns, conditions and references.

Paging and partial results

  • Long lists come in pages: offset / maxResults (or limit), nextOffset, hasMore; metric history with nextFrom. Every answer stays within 256 KiB of structured content.
  • Cut values say so (truncated, the original length). A search that could not look at everything has evidenceMayBeMissing: true and its state (incomplete, cancelled, failed) with the reason - report it, never present such a result as complete.
  • An incident’s evidence item has its own state (complete, partial, failed) and reason.

Recipes

Explain the current error: tktail_get_current_context -> tktail_get_records_around (anchor current) -> tktail_search for its request id over {"kind":"open"}.

A profile for a delimited log (needs Allow AI to save custom formats to save):

  1. tktail_new_format_draft with sourceId and template: "delimited" - a draft fitted to the log: its delimiter, quote, header and one field per column (columns lists them, 1-based).
  2. Give columns their meaning in definition.fields: "role": "timestamp" and "type": "timestamp" on the time column, "role": "severity", "role": "message"; rename ids freely ("severity_level").
  3. tktail_validate_format, then tktail_preview_format with the sourceId until every record parses.
  4. tktail_save_format with applyToSourceId; to have the file use it after a restart, put its file name in definition.fileMatch.names before saving (["export-*.csv"]).

Watch it (needs Allow AI to save searches and Metric Sets and Allow AI to manage alerts):

  1. tktail_save_search - name, definition {"sources":[{"kind":"source","path":"<sourceId>"}], "predicate":{"all":[{"field":{"name":"severity_level","op":"eq","value":"ERROR"}}]}}.
  2. tktail_validate_alert with alert {"name":"Export errors","severity":"error","condition":<the same definition>,"trigger":{"kind":"everyMatch"},"actions":["notify"],"capture":{"items":[{"kind":"file", "recordsBefore":5,"recordsAfter":5}]}} - then tktail_save_alert with the same alert.
  3. Later: tktail_list_alert_occurrences, tktail_get_alert_occurrence, tktail_get_occurrence_evidence.

To change a saved one, read it (tktail_get_alert, tktail_get_saved_search, tktail_get_metric_set) and pass its version as expectedVersion (a Metric Set: its contentId as expectedContent).

Rules for agents

  • Read what is there before writing; never invent paths - use tktail_list_sources, and with Extended Investigation tktail_list_investigation_roots / tktail_discover_files.
  • Ask the user before any change; on not_allowed say which permission the user would turn on.
  • Quote evidence with its source and position; say when results were partial.
  • Name the TKTail it came from by the answer’s own source - nodeId (this TKTail’s data folder) and instanceId (this run) - never by an earlier call: a restart is a new run, another computer another node. displayName, nodeName and instanceName are labels, not keys; an incident’s origin is the run that captured it, which may not be the one answering (Which TKTail answered).
  • TKTail has no tool for commands, programs, settings, files outside its stores or Investigation Roots - do not look for one.

TKTail publishes no llms.txt: an MCP client learns TKTail from the server itself (tools/list - every tool with its description and input schema - and the instructions of initialize), and people from this Help.