
mcp-trace-inspector
io.github.abhishekash由 GitHub 账号 abhishekash 发布v0.3.1更新于 Oct 24, 2026
Read local agent-run JSONL traces through MCP for failures, approvals, and run comparisons.
概览
只读 MCP 服务器,用于查询本地 agent 运行 JSONL 与 OTLP JSON 轨迹文件中的失败、审批、token 用量和运行对比。
- 可以做什么
- SpanHound 通过只读工具查询本地轨迹文件:list_runs 与 run_summary 查看近期运行,span_tree 展示运行的嵌套结构,slowest_spans 分析耗时,approval_log 记录批准/拒绝/编辑决定及理由,token_usage 汇总成本,search_spans、failure_report 与 tool_stats 查找错误和按工具统计,security_audit 审计调用方与来源证据,recent_activity 以游标轮询正在写入的 span,compare_runs 对比回归差异。它读取现有 agent harness 生成的 JSONL span 与 OTLP JSON 导出,本身不记录 agent 操作。诊断信息在离开服务器前会被截断并遮蔽明显的凭据。
- 适用场景
- 当你的 agent 已经写出受支持的 JSONL span 格式或 OTLP JSON 导出,并希望 MCP 客户端直接检查这些文件而无需搭建轨迹后端时使用。适合回答运行为何停滞、写入被拒后 agent 是否继续操作、token 与成本总量、哪些工具失败以及不同运行间的回归等问题。
- 运行要求
- 以 stdio 本地进程运行,通过 uvx 启动(Python 包 mcp-trace-inspector,命令 spanhound),并用 --trace-dir 参数指定轨迹目录。未声明认证、环境变量或请求头。仅支持桌面客户端,不是网页可执行程序。
安装
在 SourceWeft 中
- 打开 控制台中的 mcp-trace-inspector,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
SpanHound
[CI] [PyPI] [Downloads] [GitHub release] [GitHub stars] [MCP Registry] [Glama MCP server] [License: MIT] [Python 3.11+]
Capture local agent traces. Ask your MCP client what happened. SpanHound (formerly mcp-trace-inspector) captures supported Python agent calls, receives OpenTelemetry over local OTLP/HTTP, and exposes read-only MCP tools for failures, approval decisions, token usage, and run comparisons. It reads JSONL spans and OTLP JSON exports as described in the user guide, including traces from agent-harness.
[Animated demo: a blocked tool call becomes an inspectable trace]
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 it in one command
The demo shows a recorded run_shell failure and its approval evidence from a
bundled scripted regression trace. It needs no clone, account, trace backend, or
MCP client. To inspect your own traces, point SpanHound at a directory of JSONL
spans or saved OTLP JSON exports:
--check prints the runs it found and exits. Connect an MCP client with the
configuration below to ask questions about those runs.
Explore the repository fixtures
--check also reports a missing directory or malformed complete JSONL or OTLP
JSON record.
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.
Capture your own traces
For a Python agent, install SpanHound's optional auto instrumentation in the same environment as the agent, then run it through SpanHound:
The command starts and stops a local receiver, configures OTLP export, and
captures supported library calls without changes to agent.py. The optional
package includes instrumentation for OpenAI, Anthropic, OpenAI Agents, HTTPX,
and Requests. It reports when no spans were produced. Your Python agent and
SpanHound must share one environment; for a uv project, use
uv add 'spanhound[auto]' and uv run spanhound run -- python agent.py.
See the Python capture guide.
For other runtimes, or agents that already export OpenTelemetry traces, start the receiver in one terminal:
Point an agent that already uses an OpenTelemetry trace exporter at the receiver, then run the agent:
SpanHound stores each accepted OTLP/HTTP trace request as a local JSON file.
Run uvx spanhound --trace-dir ./traces --check to see the captured runs, then
connect your MCP client to that folder. The receiver accepts OTLP/HTTP JSON or
protobuf on loopback; it does not add instrumentation to an agent. See the
capture guide for limits and privacy.
Where it fits
For a live terminal and browser view of local Codex/Claude Code sessions and received OTLP telemetry, try Agent Observatory. SpanHound provides trace investigation through MCP using JSONL and OTLP JSON files.
Use this when you want a local trace view through MCP without setting up a trace backend. Capture supported Python library calls in one command, receive OTLP/HTTP from another runtime, or read the supported JSONL or OTLP JSON formats. Focused queries include recorded approval decisions, bounded failure diagnostics, and run comparisons.
MCP Agent Trace Inspector records steps into a local SQLite database and provides a dashboard and exports. SpanHound auto-instruments supported Python libraries or receives OTLP/HTTP traces, then queries the captured files through MCP. It does not automatically trace arbitrary agent functions or approvals.
For traces stored in Jaeger, Tempo, or Traceloop, use a backend-connected tool such as OpenTelemetry MCP Server. For a trace UI, instrumentation, and evaluations, see Phoenix. SpanHound does not read backend-specific JSON exports.
AI-native use cases
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
For a desktop client that accepts MCP Bundles,
download the .mcpb asset from the latest release
and install the downloaded file in the client; the download link does not open
a web page. In Claude Desktop, use Settings → Extensions → Advanced settings →
Install Extension… and select the .mcpb file. The bundle asks you to choose
a local trace folder.
It uses UV to install its Python dependencies on first run. SpanHound reads
the folder locally; the connected client receives the evidence returned by its
MCP tools.
If you previously ran uvx mcp-trace-inspector, change that command to
uvx spanhound to receive this release. The old PyPI distribution stays at
0.3.1; the new package retains its Python import paths and command aliases
for clients that install spanhound explicitly.
Client configuration
Claude Desktop (claude_desktop_config.json):
pi (~/.pi/agent/settings.json):
agent-harness (mounted as gated tools):
Tools
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)
Design
- 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
- MCP 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.
First-run feedback
Tell us what happened when you tried it: your MCP client or trace producer, the question you were trying to answer, and any missing evidence. Share a redacted excerpt when a file fails to load.
License
来源:README.md,提交 5991bda
工具
0版本历史
2- v0.3.1最新Oct 13, 2026
- v0.2.2Oct 12, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分