MCP Server

Let external AI clients (Claude Code, Claude Desktop) drive Traffic Jam over the Model Context Protocol.

While the desktop app runs, it hosts a Model Context Protocol server that exposes the same tool layer as the in-app assistant (/docs/en/ai-assistant/assistant/). Any MCP client can connect and list, inspect, replay, and analyze your captured traffic.

How it’s hosted

The app spawns the MCP server as a utility process on a loopback address, speaking streamable HTTP. On startup it writes the connection details to a discovery file:

<userData>/mcp-endpoint.json   (mode 0600)

On macOS that is ~/Library/Application Support/Traffic Jam/mcp-endpoint.json (override the directory with TRAFFIC_JAM_USER_DATA_DIR). The file contains:

{
  "backendUrl": "http://127.0.0.1:PORT",
  "apiToken": "…",
  "mcpUrl": "http://127.0.0.1:PORT/mcp"
}

Every request must present the capability token, either as X-Traffic-Jam-Token or Authorization: Bearer <token>. The file is removed when the app quits.

Connect Claude Code

The fastest path is the Copy MCP config button in Settings → AI model, which copies a ready-to-paste snippet. Or add it manually:

claude mcp add-json traffic-jam '{
  "type": "http",
  "url": "http://127.0.0.1:PORT/mcp",
  "headers": { "X-Traffic-Jam-Token": "TOKEN" }
}'

Replace PORT and TOKEN with the values from mcp-endpoint.json. The same object works in a project .mcp.json under mcpServers. Then run /mcp in Claude Code to confirm the connection and see the tools.

Stdio mode (without the app UI)

The same bundle runs standalone over stdio for clients that prefer it, or when you want to point at a backend started separately (npm run dev:api):

TRAFFIC_JAM_BACKEND_URL=http://127.0.0.1:8790 \
TRAFFIC_JAM_API_TOKEN=\
npm run mcp:stdio

Environment variables:

VariablePurpose
TRAFFIC_JAM_BACKEND_URLBackend base URL (required).
TRAFFIC_JAM_API_TOKENCapability token for the backend and, in HTTP mode, for MCP requests.
TRAFFIC_JAM_MCP_PORTHTTP listen port (app-managed mode sets this).

Tools

The server registers the same 25 tools as the assistant — read (list_sessions, get_session, get_request, search_requests, export_har, …), replay (replay, replay_batch, replay_minimize), analysis (decode_body, conformance_diff, signature_crack, mutation_probe, token_lifecycle, run_recipe, evaluate_computed_template), and authoring (save_decode_script, save_decode_pipeline, save_recipe). Mutating tools are annotated readOnlyHint: false so clients can flag them.

Troubleshooting

SymptomFix
mcp-endpoint.json missingThe desktop app isn’t running, or the MCP bundle wasn’t built — run npm run build:mcp.
401 invalid API capability tokenThe token in your client config doesn’t match mcp-endpoint.json; re-copy it (it changes each launch).
stdio exits immediatelyThe backend isn’t reachable at TRAFFIC_JAM_BACKEND_URL; start the app or npm run dev:api.

Traffic Jam documentation. Built with Hugo.