Skip to main content

mcp-trace

CI License: MIT

Agents that can debug themselves. An MCP server that exposes your agent runs — stored as plain OpenTelemetry JSONL span files — as queryable tools: runs, span trees, slow spans, human-approval logs, token/cost usage.

The idea: observability shouldn't be a dashboard you read after the fact. It should be tools your agent can call mid-run — "why was I slow yesterday?", "what did the human deny me last time?", "which tool keeps timing out?" — or query interactively from Claude Desktop / pi / any MCP client.

Pairs with agent-harness (which writes the traces), but the reader is format-simple: any JSONL of OTel-shaped spans works.

Install & run

This repository is not claiming a PyPI release yet. The mcp-trace name is already occupied on PyPI by an unrelated project, so the planned distribution name is abhishekash-mcp-trace; it still exposes the mcp-trace command. Until publication, run this repository directly from GitHub:

uvx --from git+https://github.com/abhishekash/mcp-trace.git mcp-trace --trace-dir ./traces
# after PyPI publication:
uvx abhishekash-mcp-trace --trace-dir ./traces
# or, for local development:
git clone https://github.com/abhishekash/mcp-trace
cd mcp-trace && uv pip install -e .
mcp-trace --trace-dir ./traces

The registry manifest is checked in at server.json, pointing to the unique PyPI distribution abhishekash-mcp-trace. The package has passed local uv build and twine check; PyPI publication is wired through GitHub trusted publishing in .github/workflows/publish-pypi.yml.

To enable the first publication, add a PyPI trusted publisher for project abhishekash-mcp-trace: owner abhishekash, repository mcp-trace, workflow publish-pypi.yml, environment pypi. Then run the workflow manually or publish a GitHub release.

Client configuration

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "agent-traces": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/abhishekash/mcp-trace.git", "mcp-trace", "--trace-dir", "/path/to/traces"]
    }
  }
}

pi (~/.pi/agent/settings.json):

{
  "mcpServers": {
    "agent-traces": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/abhishekash/mcp-trace.git", "mcp-trace", "--trace-dir", "/path/to/traces"]
    }
  }
}

agent-harness (mounted as gated tools):

harness run "Why was my last run slow?" --mcp "uvx --from git+https://github.com/abhishekash/mcp-trace.git mcp-trace --trace-dir ./traces"

Tools

Tool Use it when
list_runs Starting out — recent runs with task, model, duration, cost, decision counts
run_summary One run at a glance (accepts trace-id prefix)
span_tree "What did the agent actually do?" — nested shape of the run
slowest_spans "Why was it slow?" — top-k spans by duration
approval_log HITL audit — every approve/deny/edit, who decided, and the rationale
token_usage Cost questions — aggregated across runs or per-run
search_spans Find spans by tool name, file path, "denied", …

Tool descriptions are written as prompts (when-to-use, not just what-it-does) — descriptions are the interface for agent-called tools.

Example session (real fixture trace)

> list_runs
[{ "trace_id": "f920798dd255…", "task": "Summarize the workspace's notes…",
   "tool_calls": 4, "human_decisions": 2, "stopped_reason": "completed" }]

> approval_log
[{ "tool": "write_file", "decision": "approve", "approver": "auto", … },
 { "tool": "run_shell",  "decision": "approve", "approver": "auto", … }]

Design

traces/*.jsonl ──▶ mcp_trace.core (pure query functions, zero deps)
                          │
                   mcp_trace.server (thin MCPServer adapter, mcp 2.x)
                          │
                    stdio (NDJSON JSON-RPC)
  • core/server split: all logic is pure functions over parsed spans; the MCP layer only parses args and JSON-encodes results. Tests hit both layers.
  • trace_id prefixes: agents fumble full 32-char hex ids; every tool accepts prefixes.
  • The demo fixture (examples/example_trace.jsonl) is a real agent-harness run, not hand-written.

Honest limitations

  • stdio transport only (no Streamable HTTP yet)
  • non-recursive trace-dir scan; very large dirs should use per-file loading
  • no span streaming/watching — snapshots at call time
  • v0.1: read-only tools; trace mutation (annotations) is roadmap

License

MIT

Metadata

Release files for abhishekash-mcp-trace 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abhishekash-mcp-trace 0.1.0
File Size Uploaded
abhishekash_mcp_trace-0.1.0.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for abhishekash-mcp-trace 0.1.0
File Interpreter ABI Platform
abhishekash_mcp_trace-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.9 kB

Release files / abhishekash_mcp_trace-0.1.0.tar.gz

Download URL abhishekash_mcp_trace-0.1.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd6485f1a1d1aec1071a82d1abc9fb6f699c51b17713e1075d39c00630fdc3ee
BLAKE2b-256 checksum
How to use checksums
e30cac51610bea682123888363db7d0889cb0d20d74c4205226e3b8b155fc7d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / abhishekash_mcp_trace-0.1.0-py3-none-any.whl

Download URL abhishekash_mcp_trace-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e557436c44c6ba254f9264649efc8dd71e51e55ea675b31b1b9ba15567f0e5e
BLAKE2b-256 checksum
How to use checksums
0528b690607fe60cbfec686c64a6292cd6b1dfb78255414f62db85e27bcc23d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page