agent-trace-mcp
This server records and queries agent/MCP tool trace spans stored locally in a JSONL file.
Record spans (
trace_record): append one span per MCP tool call with agent, tool, latency, ok/error, token counts, and a truncated args preview, reusing the samerun_idper user turn.List runs (
trace_list_runs): view recent runs with span counts, errors, and token totals.Inspect a run (
trace_get_run): fetch every span for a givenrun_id.Find failures (
trace_failed_tools): list recent spans whereok=false.Track token cost (
trace_token_cost): sum input/output tokens for one run or the whole file.Find bottlenecks (
trace_slowest_tools): surface spans with the highestlatency_ms.Check status (
trace_status): show the JSONL file path and total span count.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agent-trace-mcp show failed tool calls from the last agent run"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Agent Trace MCP Server
Open-source MCP server owned by Pawan Gunjkar (pawangunjkar@gmail.com · GitHub). MIT licensed.
This is the trace log for agents, not for Java services. Prometheus and Loki show the commerce suite. This server shows which agent called which MCP tool, how long it took, whether the tool failed, and how many tokens the turn used.
Sibling servers: observability-mcp, github-mcp, deps-mcp.
Project information
Item | Value |
Package |
|
Runtime | Python 3.10+, FastMCP, stdio |
Store | Local JSONL, default |
Write |
|
Reads | runs, one run, failed tools, token totals, slowest spans |
Pass the same run_id for every tool in one user turn. Keep secrets out of args_preview. The preview is truncated to 300 characters.
Related MCP server: MCP Agent Trace
Architecture
flowchart TB
subgraph L1["Layer 1 — Agent"]
AG["LangGraph CommerceAgent"]
HUB["McpHub.call"]
end
subgraph L2["Layer 2 — MCP"]
SRV["agent-trace-mcp"]
end
subgraph L3["Layer 3 — Store"]
FILE["traces.jsonl"]
end
subgraph L4["Layer 4 — Questions"]
RUNS["trace_list_runs"]
FAIL["trace_failed_tools"]
COST["trace_token_cost"]
end
AG --> HUB
HUB -->|"trace_record"| SRV
SRV --> FILE
FILE --> RUNS
FILE --> FAIL
FILE --> COSTflowchart LR
START["User turn"] --> REC["trace_record per tool"]
REC --> FILE["JSONL span"]
FILE --> ASK["Which checkout step failed?"]
ASK --> GET["trace_get_run"]Tools
Tool | What it does |
| Append agent, tool, latency, ok, error, tokens |
| Recent runs with span, error, and token counts |
| Every span for one |
| Spans with |
| Sum tokens for one run or the whole file |
| Highest |
| File path and totals |
Cursor
{
"mcpServers": {
"agent-trace": {
"command": "uv",
"args": ["run", "--directory", "C:/AI_Workspaces/Anti_Workspace/agent-trace-mcp", "server.py"],
"env": {
"TRACE_FILE": "C:/AI_Workspaces/Anti_Workspace/agent-trace-mcp/traces.jsonl"
}
}
}
}After a commerce-agent scenario, record one span per MCP call. Example: agent checkout, tool order-orchestrator.place_order, ok=false, error text from the tool JSON.
Available Tools
7 toolstrace_failed_toolsC
Return recent spans that failed.
Inputs: limit. Returns: result
trace_get_runB
Return every span for one run id.
Inputs: run_id (required). Returns: result
trace_list_runsB
List recent agent runs with span counts, errors, and token totals.
Inputs: limit. Returns: result
trace_recordA
Append one agent or MCP tool span. Reuse run_id for every span in the same user turn.
Inputs: tool (required), agent (required), ok, error, +5 more. Returns: result
trace_slowest_toolsB
Return the slowest spans by latency_ms.
Inputs: limit. Returns: result
trace_statusA
Show the JSONL path and how many spans are stored.
Inputs: no named parameters. Returns: result
trace_token_costA
Sum input and output tokens. Omit run_id to sum the whole file.
Inputs: run_id. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a distinct purpose: recording, listing runs, retrieving a run, filtering failures, computing token costs, finding slowest tools, and checking status. No overlaps or ambiguity.
All tools follow the consistent pattern of 'trace_' prefix plus a descriptive verb or noun phrase, using snake_case throughout. This makes the tool set predictable and easy to navigate.
With 7 tools, the server is well-scoped for tracing functionality—covering recording, querying, and analysis without excess or deficiency.
The surface covers core tracing needs: record, list, get, filter failures, cost, performance, and status. Minor gaps like clearing or deleting runs exist but are not critical for typical usage.
Maintenance
Related MCP Connectors
Analytics for MCP servers. Query your tool calls, first-call success, retries and schema cost.
MCP observability. Query live traffic, errors, duration, and alerts from your AI agent.
AI agent observability for production traces, natural-language insights, and improvement loops.
Cost per run, tool, model and day for AI agents, from one call or an OpenTelemetry export.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceRecords all MCP tool interactions in a centralized ledger, enabling developers to trace, replay, inspect, and audit AI agent workflows.-
- AlicenseNot gradedqualityCmaintenanceEnables recording and analyzing AI agent execution traces, including event logging, metric computation, loop detection, and JSON export for debugging agent behavior.MIT
- AlicenseNot gradedqualityDmaintenanceProvides unified AI agent observability including tracing, cost tracking, performance monitoring, anomaly detection, and audit trails via MCP.56 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables live tracing and observability of MCP tool calls, persisting execution traces to MongoDB and streaming them in real time to a dashboard.-