Skip to content
Edit this page

MCP server

agent-strace mcp runs a local MCP server over stdio. It lets an agent query the sessions agent-strace has already recorded. It makes no network calls and does not write to the trace store: it opens the store read-only, so it does not create .agent-traces/ or its .gitignore, and it leaves interrupted tag or delete journals for the next writing command to recover.

Registry name: io.github.Siddhant-K-code/agent-trace (PyPI package agent-strace). See MCP Registry publishing.

Tools

Tool Returns
list_sessions Sessions with tool calls, LLM requests, errors, tokens, estimated cost
get_session Full event stream for one session, optionally filtered by event type
search_events Events matching a tool name, file path, exit code, or error, across one or all sessions
get_session_summary Plain-English phase summary (same as agent-strace explain)
diff_sessions Tool, file, token, cost, and error deltas between two sessions
health Evidence health for a session (same JSON as agent-strace health --format json). Defaults to the latest session
skills Skill adoption report (same JSON as agent-strace skills --format json, except command_match returns count and distinct_signatures instead of the matched commands). One session, or an aggregate over since (default 30d)
review PR reviewability check (same versioned JSON as agent-strace review --format json, or the Markdown section with format: "markdown"). See review

list_sessions and get_session show a count, token total, duration or start time from meta.json as null when it is not a usable number, such as text, true, NaN, a negative number or an integer too large for a float. It shows as null, not 0, because a 0 would read as a real count and give a wrong cost or delta. A start time must also be a Unix time in seconds, from 0 to 9999-12-30T00:00:00Z in every time zone, so one in milliseconds shows as null. On Windows the limit can be lower, near the end of the year 3000. The estimated cost is null when the token total is. In diff_sessions, the token and cost deltas are null when either session's token total is not usable, and the duration delta is null when either session's duration is not usable. An agent name or command that is not a string shows as "", and the agent filter does not match it. These three tools do not fail on such a value. In the events that get_session and search_events return, a duration_ms that is not a usable number shows as null, and an event_id or parent_id that is not a non-empty string shows as "".

initialize reports the installed package version. Malformed requests get JSON-RPC errors (-32600 invalid request, -32602 invalid params or unknown tool). A tool that fails returns a result with isError: true. A tool refuses an argument it does not take, so a misspelled name cannot make it answer for other sessions. The tool does not run, and the result has isError: true. It names each unknown argument, the closest one the tool does take if one is close, and all the ones it takes: {"error": "list_sessions does not take agent_name. Did you mean agent? It takes: agent, limit"}. Each tool's inputSchema sets additionalProperties: false, so clients can see the rule. A session ID or prefix that selects a session with a corrupt meta.json returns {"error": "session <id> has a corrupt meta.json: <reason>"} with isError: true, not "session not found". A prefix that matches two or more sessions returns {"error": "session ID prefix <prefix> matches 2 sessions: <id>, <id>"} with isError: true. An exact ID wins over a longer ID that starts with it. See Session IDs.

Tool output can include file paths, commands, and arguments recorded in your traces (secret redaction applies at capture time). The skills tool never returns prompt text, SKILL.md bodies, or commands taken from them; it returns skill names and paths relative to a skill directory. The review tool never returns prompt text, command strings, or tool output.

review

Runs the same check as agent-strace review and returns its report. A failing threshold is a normal result ("result": "fail"), not an error. Bad input returns {"error": ...} with isError: true, where the CLI exits 2.

Argument CLI flag Meaning
session_ids positional SESSION_ID... Session IDs or prefixes. Linked as explicit. Empty links by branch, then head commit time, then latest
branch --branch Branch to link sessions by. Default: the CI source branch or the git branch of the server's working directory
commits --commits Git revision range for commit trailers and git-ai notes, such as origin/main..HEAD. A value starting with - is rejected
otel_logs --otel-logs Claude Code OpenTelemetry logs file. Relative paths resolve against the server's working directory. Only the file name is returned
agent_trace_records --agent-trace-records Agent Trace records file, resolved like otel_logs. Only the file name is returned
fail_on, min_confidence, findings --fail-on, --min-confidence, --findings Threshold overrides, validated like the flags
disclosure --disclosure off, report, or check: the disclosure check. Default: the config file, then off
pr_body --pr-body File with the PR description to match disclosure patterns in. Relative paths resolve against the server's working directory. Neither the path nor the text is returned
config --config Config file with a review block. Default: .agent-strace.yaml in the server's working directory, if present
format --format json (default) or markdown

commits, otel_logs and agent_trace_records are reported as external evidence and never change a finding. commits also reads git-ai notes. The tool is read-only: it does not post a PR comment, write files, or take the artifact flags (--evidence-packet, --cognitive-debt, --artifact-url).

Add it to your agent

Install the CLI first (uv tool install agent-strace or pip install agent-strace), or replace agent-strace with uvx agent-strace in the commands below.

The server reads .agent-traces/ in the directory the client starts it from. Clients do not always start servers in your project, so point it at a fixed store with --trace-dir or AGENT_TRACE_DIR when in doubt. See Global options.

Claude Code

claude mcp add agent-trace -- agent-strace mcp
# fixed store:
claude mcp add agent-trace -e AGENT_TRACE_DIR=/abs/path/.agent-traces -- agent-strace mcp

GitHub Copilot CLI

The Copilot CLI plugin does not register the server, because plugin MCP servers start in the plugin directory instead of your project. Add it yourself:

copilot mcp add agent-trace -- agent-strace mcp

Or add it to ~/.copilot/mcp-config.json:

{
  "mcpServers": {
    "agent-trace": { "type": "local", "command": "agent-strace", "args": ["mcp"], "tools": ["*"] }
  }
}

Codex

codex mcp add agent-trace -- agent-strace mcp

Or in ~/.codex/config.toml:

[mcp_servers.agent-trace]
command = "agent-strace"
args = ["mcp"]

Gemini CLI

gemini mcp add -s user agent-trace agent-strace mcp

agent-strace setup --cli gemini installs a Gemini CLI extension with the capture hooks and this server. Its AGENT_TRACE_DIR setting applies to both. See Gemini CLI hooks.

Example prompts

  • "List my last 5 agent-trace sessions and summarize the one with the most errors."
  • "Which of my skills never loaded in the last 30 days?"
  • "Run health on the latest session and tell me what the trace cannot show."
  • "Run review for this branch with commits origin/main..HEAD and list what a reviewer would miss."

Check it by hand

printf '%s\n' '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"health","arguments":{}}}' \
  | agent-strace mcp

MCP Registry publishing

Each core release publishes server.json to the MCP Registry automatically. The mcp-registry job in .github/workflows/publish.yml runs after the PyPI upload succeeds and:

  1. Checks out the release tag and fails if server.json version or packages[0].version differs from the tag version.
  2. Skips the remaining steps if the Registry already lists that version, so reruns are safe.
  3. Waits up to 10 minutes for https://pypi.org/pypi/agent-strace/<version>/json to return 200.
  4. Installs a pinned mcp-publisher release and verifies its SHA-256.
  5. Runs mcp-publisher login github-oidc, then mcp-publisher publish.

The Registry also checks that the PyPI README contains <!-- mcp-name: io.github.Siddhant-K-code/agent-trace -->.

To retry, rerun the failed job or run Publish to PyPI manually with the existing vX.Y.Z tag. Manual fallback, from the repo root with the release tag checked out:

mcp-publisher login github
mcp-publisher publish