Skip to main content
Glama
agent-trace-mcp

agent-trace-mcp

by Pawangunjkar

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

agent-trace-mcp

Runtime

Python 3.10+, FastMCP, stdio

Store

Local JSONL, default ~/.agent-trace-mcp/traces.jsonl

Write

trace_record appends one span

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 --> COST
flowchart 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

trace_record

Append agent, tool, latency, ok, error, tokens

trace_list_runs

Recent runs with span, error, and token counts

trace_get_run

Every span for one run_id

trace_failed_tools

Spans with ok=false

trace_token_cost

Sum tokens for one run or the whole file

trace_slowest_tools

Highest latency_ms

trace_status

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 tools
trace_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

    A3.7/5.0

    Scored across 7 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    With 7 tools, the server is well-scoped for tracing functionality—covering recording, querying, and analysis without excess or deficiency.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Records all MCP tool interactions in a centralized ledger, enabling developers to trace, replay, inspect, and audit AI agent workflows.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables recording and analyzing AI agent execution traces, including event logging, metric computation, loop detection, and JSON export for debugging agent behavior.
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables live tracing and observability of MCP tool calls, persisting execution traces to MongoDB and streaming them in real time to a dashboard.
      -