# mcp-agent-trace-inspector [Health: Active]

**Category:** 📊 Monitoring  
**Repository:** https://github.com/dbsectrainer/mcp-agent-trace-inspector  
**GitHub Stars:** 0  
**npm Downloads (last month):** 569  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-agent-trace-inspector

## Description
Step-by-step observability for MCP agent workflows

## Tools
Capabilities this server exposes over MCP:

- **trace_start** — Begin a trace. Returns a `trace_id`. Pass `"auto"` or an empty string for a generated name.
- **trace_step** — Record one step for a **running** trace. Steps are rejected after `trace_end`.
- **trace_end** — Mark a trace completed, evaluate alert rules, and return fired alerts. Repeated calls are idempotent.
- **list_traces** — List traces, newest first. Optional positive-integer `limit`.
- **get_trace_summary** — Step/token/latency totals, duration, cost estimate, reasoning detection.
- **compare_traces** — Diff two traces: aggregates, tool coverage, and per-position steps.
- **extract_reasoning_chain** — Return only reasoning/thinking/planning steps.
- **export_dashboard** — Self-contained HTML dashboard with error rows, expandable JSON, and latency waterfall.
- **export_otel** — OTLP/JSON document (`resourceSpans → scopeSpans → spans`) for one trace or all traces.
- **export_compliance_log** — Audit log as JSON or CSV, optionally filtered by `from_date` / `to_date` (date-only upper bound includes the whole day).
- **configure_alerts** — Persist alert rules (`latency`, `error_rate`, `cost`). Optional Slack/generic webhooks.
- **set_retention_policy** — Set the in-process retention policy (days). Must be called before `apply_retention` in that process.
- **apply_retention** — Archive traces older than N days; delete archived traces older than 2×N days.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-agent-trace-inspector": {
    "command": "npx",
    "args": ["-y","mcp-agent-trace-inspector@latest"]
  }
}
```

## Documentation

## What mcp-agent-trace-inspector does

mcp-agent-trace-inspector gives MCP clients a structured way to record and inspect agent workflows. An agent begins a trace with `trace_start`, submits each workflow action through `trace_step`, and closes the run with `trace_end`. Recorded data is stored locally in SQLite, with an append-only JSONL audit log for compliance-oriented review.

Trace records can include tool inputs and outputs, latency, caller-provided or automatically estimated token counts, and cost estimates. The server can identify reasoning, thinking, and planning steps, calculate aggregate totals, and compare two runs at both the summary and step positions.

## How it works

The default transport is stdio. The server can also expose a stateless Streamable HTTP endpoint at `POST /mcp`; each request creates a fresh MCP server and transport, and the endpoint does not provide a server-initiated SSE stream. HTTP mode supports optional API-key authentication, HS256 JWT authentication, request rate limiting, and a loopback-oriented host protection check.

SQLite is the primary store and defaults to `~/.mcp/traces.db`. A project can use another database path, including an in-memory database for tests. Trace completion evaluates configured latency, error-rate, and cost rules. Matching alerts can be sent to Slack or a generic webhook when configured.

## Setup and configuration

Node.js 22.13.0 or newer and npm are required. An MCP client can launch the package with:

```json
{
  "mcpServers": {
    "trace-inspector": {
      "command": "npx",
      "args": ["-y", "mcp-agent-trace-inspector@latest"]
    }
  }
}
```

Use `--db` or `--db-path` to select a database file. Other supported startup options control retention at launch, pricing data, automatic token counting, and HTTP mode. A JSON pricing table can override entries in the built-in table. Set `--no-token-count` when automatic counting is not wanted.

HTTP deployments can set `MCP_API_KEY`, `MCP_JWT_SECRET`, or both. API-key requests use `X-API-Key`; JWT requests use an HS256 bearer token, with `exp` and `nbf` claims checked. The stdio transport ignores these variables. Non-loopback HTTP deployments should use TLS and an authenticating reverse proxy rather than exposing the raw endpoint.

## Tools and capabilities

- `trace_start`, `trace_step`, and `trace_end` manage a trace lifecycle. Steps submitted after completion are rejected, while repeated `trace_end` calls are idempotent.
- `list_traces` returns traces newest first and accepts a positive integer limit.
- `get_trace_summary` reports step and token totals, latency, duration, estimated cost, and reasoning detection.
- `compare_traces` compares aggregates, tool coverage, and steps by position.
- `extract_reasoning_chain` filters a trace to reasoning, thinking, and planning steps.
- `export_dashboard` creates standalone HTML with error rows, expandable JSON, and a latency waterfall.
- `export_otel` produces OTLP/JSON `resourceSpans`, `scopeSpans`, and spans for one or all traces.
- `export_compliance_log` emits JSON or CSV audit data with optional date bounds.
- `configure_alerts`, `set_retention_policy`, and `apply_retention` manage alerts and local trace lifecycle.

## Limitations and notes

Tracing is explicit: the inspector records a step only when the agent calls `trace_step`, so it does not automatically intercept activity from other MCP servers. HTTP mode is stateless and accepts only POST requests at `/mcp`. The default HTTP bind address is loopback, and the request body limit is 10 MB. Retention policy configuration must occur before applying that policy in the same process. Cost figures are estimates based on offline tokenization and pricing data, not billing-account information.

_Full upstream README: https://allmcps.com/mcp/mcp-agent-trace-inspector/readme_

