SpanHound
Read local JSONL and OTLP JSON agent traces for failures, approvals, and run comparisons.
- 01Stars
- 0
- 02Version
- 0.4.1
- 03License
- MIT
- 04Review
- Passed
- Language
- Python
- Last commit
- 3h ago
- Forks
- 0
- Open issues
- 0
- Registry update
- Oct 13, 2026
Connect
pypi$claude mcp add spanhound \ -- uvx spanhound==0.4.1
Environment variables
Nothing to configure — it works as is.
Security review
Review passedReviewed 1h ago.
- metadata
- scanned
- packages
- 1 checked
No findings.
Tools
This server runs on your machine, so its tool list is not fetched before install — the README below describes what it offers.
SpanHound
Inspect recorded agent-run failures and approvals from local trace files. SpanHound (formerly mcp-trace-inspector) is a read-only stdio MCP server for inspecting local agent-run traces, including tool failures, approval decisions, and changes between runs. It reads JSONL spans and OTLP JSON exports as described in the user guide, including traces from agent-harness.
Demo: Watch the full 48-second video · Read the reproducible story. This is a scripted regression trace, not a live-model benchmark.
The project's concrete origin was a shell-boundary regression: the harness blocked
cat ../outside.txt, but the old trace recorded only that run_shell was
called, not the returned diagnostic. SpanHound and the harness now preserve and
query that bounded error.
Try the included trace
git clone https://github.com/abhishekash/spanhound.git
cd spanhound
uvx --from . spanhound --trace-dir examples --check
--check prints JSON with the trace directory, span count, and recent run
summaries, then exits. It also reports a missing directory or malformed complete
JSONL or OTLP JSON record. To ask questions through MCP, connect a client using the
configuration below.
To try an OTLP JSON export, run the same command with --trace-dir tests/fixtures.
The sample export includes a model call, token
usage, a tool call, and an exception.
Where it fits
Use this when your agent already writes the supported JSONL span format or OTLP JSON export and you want an MCP client to inspect those files without setting up a trace backend. Its focused queries include recorded approval decisions, bounded failure diagnostics, and comparisons between selected runs.
MCP Agent Trace Inspector records steps into a local SQLite database and provides a dashboard and exports. Use it when you need trace capture. This project reads trace files written by an existing producer, including agent-harness; it does not record the agent's actions itself.
For traces stored in Jaeger, Tempo, or Traceloop, use a backend-connected tool such as OpenTelemetry MCP Server. For standard OTLP traces with a local receiver, see otel-mcp. For a trace UI, instrumentation, and evaluations, see Phoenix. This project reads saved OTLP/JSON trace exports. It does not receive live OTLP traffic or read backend-specific JSON exports.
AI-native use cases
| Question during an agent run | MCP tool | Evidence returned |
|---|---|---|
| "Why did yesterday's run stall?" | list_runs → slowest_spans | Run IDs and the longest model or tool spans. |
| "Did the agent act after I denied the write?" | approval_log → span_tree | The recorded decision and subsequent execution path. |
| "How many model tokens did this run use?" | token_usage → span_tree | Run-level usage totals and the span tree for context. |
| "Which tool is failing or timing out?" | failure_report / tool_stats | Redacted diagnostics, error rates, denials, and p95 latency. |
| "Who/what was allowed to act?" | security_audit | Caller, tenant, server provenance, risk, and missing-evidence findings. |
| "What is happening in the run right now?" | recent_activity | Cursor-based polling of newly written spans. |
| "Did this model/version regress?" | compare_runs | Cost, latency, tokens, tool calls, and failure deltas. |
The tools read stored traces and can poll files being written, but they do not push events or infer intent from the final answer. Start with the installation and user guide, then see the real trace fixture and the tool descriptions for the query contract.
Install & run
uvx spanhound --trace-dir ./traces
# or, for local development:
git clone https://github.com/abhishekash/spanhound
cd spanhound
uvx --from . spanhound --trace-dir ./traces
Client configuration
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"agent-traces": {
"command": "uvx",
"args": ["spanhound", "--trace-dir", "/path/to/traces"]
}
}
}
pi (~/.pi/agent/settings.json):
{
"mcpServers": {
"agent-traces": {
"command": "uvx",
"args": ["spanhound", "--trace-dir", "/path/to/traces"]
}
}
}
agent-harness (mounted as gated tools):
harness run "Why was my last run slow?" --mcp "uvx spanhound --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", … |
failure_report | Find actionable, bounded, redacted errors and failed tool calls. |
tool_stats | Rank tools by volume, error rate, denials, and latency. |
security_audit | Audit caller identity, tenant, server provenance, risk, and approval evidence. |
recent_activity | Poll new spans with a cursor while a run is active. |
compare_runs | Compare selected traces for regressions across models or versions. |
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": "f920798dd2558fcb84f9977736432a8b", "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 ──┐
traces/*.json ──┴─▶ mcp_trace.core (local query functions)
│
mcp_trace.server (MCP adapter)
│
stdio (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.
- bounded output: diagnostics are truncated and obvious credentials are redacted before query results leave the server.
- honest cost totals:
token_usagereturnscost_known: falseand a null cost when any model span lacks a cost or marks pricing as unavailable; unknown pricing is never presented as$0. - cursor polling:
recent_activitymakes the snapshot reader useful while a run is still writing spans. - The demo fixture (
examples/example_trace.jsonl) is a real agent-harness run, not hand-written.
Honest limitations
- stdio transport only (Streamable HTTP plus authenticated remote access is the next transport boundary)
- live polling re-reads snapshots; it is not a push subscription
- security audit can only report identity/provenance that the trace producer records
- read-only tools; trace mutation (annotations) is roadmap
- The Python query and server modules are available as
mcp_trace; older import and command aliases remain for existing clients.
License
MIT
From the server's repository — third-party content, read it before running anything it suggests.
More in Agent infra
MainWP
io.github.mainwp
Manage WordPress sites in MainWP from AI tools, with approval before destructive changes by default.
A11Y Toolkit
io.github.kinti
The accessibility layer for AI coding agents: audit, fix, document and watch - WCAG 2.2.
mcp-trace-inspector
io.github.abhishekash
Read local agent-run JSONL traces through MCP for failures, approvals, and run comparisons.
shield-kya
io.github.The-Pixel-Boys
Audit trail and traceability for AI agents. MCP gate: evaluate, ingest, request approval.
mailroom
io.github.darrylmosher
Self-hosted gateway between your iCloud mailbox and your AI assistant, with safety built in
ghl-command
io.github.drjerryrelth
GoHighLevel MCP for Claude: 250 tools, 51 modules, incl. the only programmatic GHL workflow builder
Listing from the official MCP Registry · repository facts from GitHub, 1h ago.