AI integration (MCP)
An AI assistant that supports the Model Context Protocol (MCP) - for example Claude Code - can investigate with TKTail: which logs, event logs and Metrics Views are open, the record you are looking at (already parsed into fields, with its time and its whole multi-line text), the records just before and after it, the records near a time, every record of a request - found with TKTail’s own search, across your open logs and event logs - sequences such as “a request received, then within 10 seconds an error for the same request ID”, your alerts and the evidence their incidents kept, and what CPU, memory and disk did around a time (Trial / Pro: the Metrics TKTail collects for you). The assistant asks TKTail for evidence instead of you copying log text into a chat, and it never reads the files itself.
| Free | Trial / Pro | |
|---|---|---|
Connect over stdio (the assistant starts TKTail.exe mcp --stdio) | yes | yes |
| Connect over HTTP (the assistant connects to the running TKTail - also from another computer) | - | yes |
| What is open in TKTail (the Safe Workspace) | yes | yes |
| Folders you approve (Extended Investigation) | - | yes |
| Metrics (Windows performance counters) | - | yes |
AI access is off until you allow it, and an assistant changes nothing unless you also allow that kind of change: saving format profiles, saving searches and Metric Sets, managing alerts - each its own permission (What AI clients may change).
What the assistant can and cannot see
| Can ask for | Cannot |
|---|---|
| TKTail’s version, license edition and what it can do now | open, read or list files, folders or disks - or any file you have not opened in TKTail |
the sources open in the main window: file paths, formats, encodings, sizes, the time range of the records read so far; event log channels or .evtx files; Metrics Views and their counters | search a folder, or a path it names (only what is open in TKTail, and folders you approved) |
| the current record of the view in front: its lines, time, fields, Summary and text (16 KB by default, at most 64 KB); the selected event; the selected metric series and its latest value | run commands, a terminal, programs or scripts; change settings, Investigation Roots or files; close or start anything |
| one record (a whole multi-line entry) by line, position or a reference TKTail gave it; up to 50 records before and after a record, an event or a time | cancel or close your searches (only its own) |
searches of the open sources - text, regular expression, field conditions (requestId = ABC123), time ranges, a number taken from the text (elapsed: 1985.000ms at least 1000) - and their results, page by page, only the fields it needs or just the count; a summary of what a search found - the top 10 client IPs, requests per minute, the average elapsed time - computed by TKTail; sequences of evidence in time windows, correlated by a key; your Saved Searches (to list and run) | see a linked window’s current record (only the main window answers) |
| the list of TKTail windows (main and linked) with the sources each shows | start collecting performance counters, or read counters TKTail does not collect |
| (Trial / Pro) the Metric Sets, the metrics TKTail collects or still keeps, their current values, samples over a period (at most 24 hours, every gap said) and summaries | use a metric in a search or a sequence (a later version) |
| the formats TKTail knows, raw sample records of an open log, how TKTail chose a log’s format, and a check and preview of a format profile it proposes - with TKTail’s own parser | change a built-in format, a .tktail file or another log’s format |
| your alerts, their incidents and the evidence each incident kept; a check of an alert it proposes | delete, acknowledge or export incidents |
| with your permission: save a format profile; save, change or delete Saved Searches and your Metric Sets; create, change, enable, disable or delete alerts | anything else - there is no permission for settings, files or programs |
Whatever TKTail returns, the assistant may send to its AI service (for most assistants, a cloud model). Logs can contain names, addresses, tokens or customer data: allow access only while you want the assistant to see what you are looking at, and close tabs it should not list.
Extended Investigation: folders you approve
Sometimes the evidence is in a log you have not opened yet. With a Trial or Pro license, Tools > AI Investigation Roots… lists the folders an assistant may investigate beyond your open tabs:
- Add… chooses a folder; its check box enables or disables it; Label… names it (Production); Remove takes the approval away (the folder itself is untouched); Open Folder shows it in Windows Explorer.
- Below an enabled folder the assistant can list log files (names, sizes, the format TKTail would use -
at most 1,000 at a time), search them with TKTail’s search, and open one as a tab to read its records.
It cannot read anything outside those folders: another folder, a path with
.., a link (junction or symbolic link) that leads elsewhere, or a folder you disabled is refused. - Only you add folders - the assistant can list them, never add one. Each change is written to Output > Application. A file the assistant opened appears as a tab, like your own.
Free uses the Safe Workspace only: open the files in TKTail and the assistant investigates them.
What an assistant can do with it
- “Explain the error I am on, and what happened just before.” - the current record (the whole stack trace, also when you clicked one of its lines), then the records before and after it.
- “Find every record of this request.” - a search of all open sources for the request ID (a field condition where the format has the field, the text otherwise), Event Log events included; then the records around any of the results.
- “Which 10 client IPs caused the most 500 errors, and how many requests per minute were there?” - a
search for the errors, then TKTail summarizes what it found: the top 10 keys with their counts, a
histogram per minute, the average and maximum of a number such as
time-taken- without sending every record to the assistant. The answer says when it covers less than everything (more results than TKTail keeps, a log that changed since the search) and points to the first record of each group. - “Which requests took 1000 ms or longer?” - a search with a number condition: the number after
elapsed:(or any value a pattern captures) compared as a number -1985.000counts,1,5or12msnever. - “What was logged around 14:02?” - the record nearest that time, as Edit > Go To Time finds it. If TKTail has not read the file’s times yet, the assistant can ask it to (as View > Read the File’s Times).
- “Did a request in payments.log fail downstream within 10 seconds, and did Windows log a warning after it?” - a sequence search: each match is one request with its steps in order, their times and the request ID that ties them.
- “Why is this log shown as plain text? Write a format for it.” - the assistant reads a sample of the log’s records, writes a profile, and has TKTail validate it and preview it on the log’s own records until every record parses; then gives it to you, or - if you allowed it - saves it.
- “Watch this log for payment errors.” - with your permissions: a profile, a Saved Search and an alert (Set up monitoring with an assistant).
- “What happened in the last Payment errors incident?” - the trigger record, the records before and after it, the events and the metric samples the alert kept, each with its state.
- “What did CPU, memory and disk do in the minute around this error?” - with a Metrics View open (for example Host Basics): minimum, average and maximum around the error’s time, the peak, and whether samples were missing. A reading TKTail could not take is reported as missing - never as zero.
The assistant’s searches appear in Search Results, marked AI (#19 AI · requestId = ABC123 ...) and in Jobs - you see what was searched for you. TKTail keeps the assistant’s five most recent
searches; it never closes or cancels yours for it. When a search could not look at everything (a
regular expression too complex for some lines, more results than TKTail keeps, a cancelled search) the
assistant is told that evidence may be missing.
Turn it on
Settings > AI Access (MCP) has everything in one place - what is allowed now, what your license includes, the permissions, your Investigation Roots, and what to give your AI client:
- Allow AI access (MCP) on that page, or Tools > Allow AI Access (MCP) (a check mark shows it is on). Only the main window answers AI clients. TKTail remembers the choice.
- Connect your assistant - over stdio (every edition) or HTTP (Trial / Pro), below.
- Optional: the permissions under What AI clients may change (below).
The tools, their arguments and bounds: MCP tool reference. Connecting another client, a script or an agent framework: Connect any MCP client. How an agent investigates, what it may do, and the documentation each release publishes for agents: AI agents.
Connect over stdio
The assistant starts TKTail.exe mcp --stdio itself when it needs it, on the same computer; you do not run
it. Copy Command copies the command with the full path, Copy Client Configuration a ready
mcpServers entry. Nothing listens on the network.
Claude Code (tested with Claude Code 2.1.177). Save this as a JSON file with the full path of
your TKTail.exe (backslashes doubled):
{
"mcpServers": {
"tktail": {
"type": "stdio",
"command": "C:\\<TKTail folder>\\TKTail.exe",
"args": ["mcp", "--stdio"]
}
}
}
Start Claude Code with it: claude --mcp-config <file>. The same content works as .mcp.json in a project
folder. Then ask, for example: “What am I looking at in TKTail? Explain the error in the current record.”
Other MCP clients start a local server from a command and its arguments: TKTail.exe (the full path) with
mcp and --stdio. Clients that read an mcpServers JSON entry (for example Claude Desktop’s configuration
file) take the entry Copy Client Configuration gives. The server uses the license TKTail would use (beside
TKTail.exe, then the data folder); another license file: "args": ["mcp", "--stdio", "--license-file", "C:\\<folder>\\TKTail.license"].
Connect over HTTP
Trial, Pro and Developer licenses. The running TKTail accepts assistants that connect to it - an assistant that does not start programs, one in another tool, or one on another computer (TKTail runs on the server you are diagnosing; the assistant on your desk).
-
Settings > AI Access: Accept AI clients over HTTP, then Apply. The status line says what really runs: Listening on this computer only (127.0.0.1 and ::1), port 47711. Every request needs the token.
-
Copy HTTP Client Configuration and put it into your client’s configuration:
{ "mcpServers": { "tktail": { "type": "http", "url": "http://127.0.0.1:47711/mcp", "headers": { "Authorization": "Bearer tkt_..." } } } }Claude Code: save it as a file and start
claude --mcp-config <file>. Other clients take the Address and anAuthorization: Bearer <token>header. -
Ask as usual. The assistant gets exactly what it would over stdio - the same tools, the same permissions.
The token. Every HTTP request needs it - also on this computer. TKTail makes it the first time HTTP is used
and keeps it encrypted for your Windows user in the data folder (mcp-http.token). It is a password: whoever has
it can use what your permissions allow. Settings never shows it - Copy Token puts it on the clipboard (the
status line shows only tkt_ab…yz). Keep configuration files that hold it in your own profile, not in a shared
folder or a source repository. Regenerate Token… makes a new one: every client with the old token is refused
from its next request; give your clients the new configuration.
Another computer. Listen on: Every network interface (TKTail asks you to confirm) makes TKTail listen on
all network interfaces at the Port (47711; another one in Settings if it is taken). The connection is plain
HTTP - not encrypted: use it only on a trusted network, through a VPN, or through a tunnel (for example an SSH
port forward to the loopback address - then keep This computer only). Windows Firewall may ask whether to allow
TKTail. The Address then names this computer (http://<computer>:47711/mcp).
Turn HTTP off with the same check box: TKTail stops listening at once and connected clients are disconnected. Only the main window listens; a linked window never does.
What AI clients may change
Each kind of change is its own permission under Settings > AI Access > What AI clients may change - independent of each other, and only together with AI access. All are off by default except evidence packages: keeping the proof before a log rotates should not wait for a settings change.
| Permission | The assistant may | Never |
|---|---|---|
| Allow AI to save custom formats | save a format profile it wrote and checked with TKTail (and use it for an open log until you close it) | change a built-in format or a .tktail file |
| Allow AI to save searches and Metric Sets | create, change and delete Saved Searches and your Metric Sets | change a built-in Metric Set |
| Allow AI to manage alerts | create, change, enable, disable and delete alerts | delete, acknowledge or export incidents |
| Allow AI to save evidence and pin searches (off) | save redacted evidence packages in the Evidence Store, within its limits, and pin searches (Saving evidence) | delete a package (it can only ask - you decide), read secrets the redaction removed, write a package anywhere but the Evidence Store or a folder below an Investigation Root you approved |
- Your changes are never overwritten. A change names the version the assistant read; if you edited the alert, search or set since, TKTail refuses it and the assistant reads it again.
- Only what it may read. A saved search or an alert may name the sources open in TKTail, event log channels, performance counters (alerts), and files or folders below an Investigation Root you approved - nothing else. The evidence an alert keeps follows the same rule.
- Roots you take back. An alert an assistant made that reads below an Investigation Root is disabled when you remove or disable that root: TKTail says so in Problems, the status bar and Output > Alerts. Edit it in Tools > Manage Alerts to keep it - it is then your own alert.
- You see every change. It is in Manage Alerts, Saved Searches and the Metric Sets at once, in the status bar and in Output (An AI client created the alert “Payment errors” (#3, version 1).).
- Turn a permission off the same way; the assistant’s next change is refused.
Without a permission, the assistant can still propose: it checks an alert or a profile with TKTail and gives it to you to create in Manage Alerts or import in the Custom Format Studio.
Which TKTail answered
Every answer says where it comes from - also an error, and also a copy of an answer pasted somewhere else - so an assistant working with several TKTails (or with notes from yesterday) never mixes up whose evidence it is:
- Node ID - this TKTail’s data folder on this computer: a random ID TKTail makes once. It stays the same when TKTail restarts; another data folder, a portable copy or another computer has its own. It is never derived from your hardware. Settings > AI Access shows it; Copy Node ID copies it.
- Instance - this run of TKTail (a new one each time TKTail starts) and its window (Window 1, Window 2).
- Display name (optional) - your name for this TKTail, for example Order Server: Settings > AI Access > Display name. It is a label - two TKTails may have the same one.
- Only if you choose - the computer name, your Windows user name and its domain: each stays off until you tick it under How AI clients see this TKTail, and applies to the next answer.
The main window answers for every TKTail window; the list of windows names each window’s own instance. An incident says which TKTail run captured it - after a restart, that is not the run answering now; an incident recorded by an earlier TKTail version says its origin is not known.
Set up monitoring with an assistant
On a computer with nothing configured yet - a semicolon-separated export TKTail opens as CSV (semicolon), the time in the third column - an assistant can set up the whole chain. With AI access and the three permissions allowed, ask: “Make a format for the export I have open - the time is in column 3, the level in column 5 - then watch it for ERROR records and alert me with the records around each one.”
- A profile from the log. The assistant asks TKTail for a draft fitted to the open log (its delimiter, quote and header and one field per column - the Studio’s Create Format for This Log), gives column 3 the timestamp role, the level column the severity role, the message its role; checks it with TKTail’s validator and previews it on the log’s records; then saves it and uses it for the log. The profile is in the Custom Format Studio; to use it every time the file is opened, the profile can name the file (recipe).
- A Saved Search -
severity_level = ERRORover that log - in Saved Searches like your own. - An alert with the same condition, a severity, a notification and the evidence to keep (the 5 records before and after) - checked first, then saved; Manage Alerts shows it, marked as made by an AI client.
- When an ERROR record arrives, the alert fires and the incident keeps its evidence; the assistant can read it.
All of it is your configuration from then on: after a restart the profile, the Saved Search, the alert and its incidents are there as if you had made them.
Alerts on logs that rotate by date
An assistant names a log by its sourceId. When TKTail follows that log as a dated series (info-2026-11-05.log,
then info-2026-11-06.log - Rotating dated log files), the alert it saves follows the
series: TKTail fills the pattern in ("series": "info-{YYYY-MM-DD}.log"), and the alert watches the newest file -
also with no tab open, and after a restart. For a series TKTail does not detect by itself the assistant gives the
pattern (u_ex{YYMMDD}.log, app.{YYYYMMDD}.{N}.log); "series": "" keeps exactly one file.
To prove an alert is alive, tktail_get_alert answers with its runtime: watching (or waitingForFile and
why), the file it reads now and its identity, how far it has read, when it last evaluated new lines, the series’
state and how many times it moved on, the last incident. The tool schemas list every value TKTail accepts, with
complete examples that are tested against TKTail itself.
What a question looks like
You open payments.log and click line 4 - inside a stack trace. The assistant calls
tktail_get_current_context and receives (shortened):
{
"contextKind": "file",
"sourceName": "payments.log",
"formatId": "builtin:applog",
"position": { "byteOffset": 185, "line": 4, "column": 1 },
"record": {
"firstLine": 2, "lineCount": 4, "caretLineInRecord": 3, "state": "complete",
"time": { "kind": "local", "value": "2026-10-08T10:00:01.250" },
"summary": { "title": "ERROR · Payment", "status": "ERROR" },
"fields": [ { "name": "level", "value": "ERROR", "role": "severity" },
{ "name": "exception", "value": "System.InvalidOperationException", "role": "exception" } ],
"text": "2026-10-08 10:00:01.250 ERROR [Payment] Payment failed for order 42\nSystem.InvalidOperationException: card declined\n at Payments.Gateway.Charge(Order o)\n at Payments.Service.Run()",
"textTruncated": false
}
}
The record is the whole entry (lines 2-5), not just the clicked line, and its time is the record’s own timestamp - local time, because the log names no time zone.
Turn it off
Tools > Allow AI Access (MCP) again (or the check box in Settings). From then on every tool answers that access is off (and how to allow it) - also for an assistant connected at that moment: its next question is refused. Turning off Accept AI clients over HTTP also closes HTTP connections. Removing an Investigation Root works the same way: the assistant’s next question about that folder is refused. Removing the entry from your AI client’s configuration stops it from connecting at all.
How TKTail keeps it safe
- Your consent: nothing is answered until you allow AI access; every kind of change and every Investigation Root is a separate permission you give.
- Only what you opened (the Safe Workspace), plus folders you approved (Extended Investigation): never a
path the assistant invents, never
..or a link out of an approved folder - also not through a saved search or an alert. - No system access: no commands, programs, terminal, services, registry or settings; no file written except through TKTail’s own stores (profiles, Saved Searches, Metric Sets, alerts) when you allowed it.
- Bounded: every answer has limits (text per record, records per call, results per page - listed in the tool reference); long results come page by page; what was cut is marked.
- One owner: the main window answers; a linked window never does.
- Your names stay yours: answers name this TKTail by random IDs; the computer name and your Windows account are sent only if you tick them in Settings, and never written to TKTail’s log.
- HTTP: off by default, Trial / Pro only, a token on every request, this computer only unless you choose the network; requests from web pages are refused.
- Recorded: every answer is listed in Output > Application (which tool, how it ended - never the content).
What TKTail records
Output > Application (and the TKTail log file) gets one line per answer - which tool, how it
ended, how many bytes and how long it took, for example
AI client (MCP): tktail_get_current_context - answered (1815 bytes, 0.2 ms) - never what was
sent. Over HTTP also when TKTail starts or stops listening (MCP over HTTP listening on
http://127.0.0.1:47711/mcp (this computer only)) and every refused request with its address and reason
(AI client over HTTP (127.0.0.1): request - HTTP 401 unauthorized) - never the token. The stdio server writes
a few diagnostic lines to its error output, which AI clients keep in their own logs (Claude Code lists them
as “Server stderr”).
Troubleshooting
| The assistant (or its client) says | What to do |
|---|---|
| No TKTail window is running | Start TKTail and open the logs; the server then answers from that window. Without a window it can only say so (it never starts TKTail). |
| AI access to the TKTail window is off | Tools > Allow AI Access (MCP) in the main window. |
| The TKTail window did not answer in time | TKTail was busy for more than 10 seconds (for example a modal operation); ask again. |
| Two searches are running in TKTail | TKTail runs two searches at a time; the assistant waits instead of stopping yours - ask again when one has finished. |
| The reference was made before the file changed | The log was rotated, truncated or replaced since the assistant got that record. Ask it to search again or to use the current record. |
| TKTail has not read this file’s record times yet | Let the assistant ask TKTail to read them, or use View > Read the File’s Times yourself. |
| Folders are outside the Safe Workspace | Open the files in TKTail first, or approve the folder as an Investigation Root (Trial / Pro). |
| Saving format profiles / searches / managing alerts is off for AI clients | Allow that kind of change in Settings > AI Access, or create it yourself from what the assistant proposes. |
| The alert / Saved Search / profile changed since it was read (conflict) | You (or another client) edited it. The assistant reads it again - your changes are never overwritten. |
| An alert made by an AI client was disabled | One of the Investigation Roots it reads was removed or disabled. Approve the root again, or edit the alert in Manage Alerts to keep it as yours. |
| Extended Investigation / Metrics / HTTP is included with Trial and Pro licenses | Use stdio and what is open in TKTail, or a Trial / Pro license. |
| The path is outside the Investigation Roots | The file or folder is not below a folder you approved (or that folder is disabled). |
| TKTail does not collect or keep this metric | Open the Metric Set or a Metrics View in TKTail (View > Metrics…); the assistant never starts collection itself. |
| A TKTail window runs, but it is an older version | Use the same TKTail version for the window and the MCP server. |
contextKind none | Nothing is focused, or the view in front has no current record. Click into a log, an event or a series. |
| HTTP: connection refused | Accept AI clients over HTTP is off, not applied, or TKTail is not running; the AI Access page shows the state. A client on another computer needs Every network interface (and the firewall to allow TKTail). |
| HTTP 401 / unauthorized | The token is missing or old (it was regenerated). Copy HTTP Client Configuration again. |
| Settings: Not listening: port 47711 is already in use | Another program uses the port: choose another Port and Apply, and update the client’s address. |
| HTTP 403 | The client sent a host name or a web page origin TKTail does not accept: use the Address Settings shows (127.0.0.1 on this computer). |
| HTTP answers take tens of milliseconds (at times seconds) on this computer only | Security software that inspects HTTP - also on this computer’s own addresses - holds requests before TKTail gets them (measured: about 12 ms each). TKTail waits long enough for a request; answers are not lost. |
| HTTP 404 with a session | TKTail restarted, the token was regenerated or the session was idle 30 minutes: the client starts a new session (most do by reconnecting). |
TKTail talks to the TKTail running for your Windows user - one per user, as for opening files from Explorer. The protocol details, limits and errors are in the developer reference (docs/MCP.md).