{"slug": "how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache", "title": "How an 8MB MCP Tool Response Crashes Claude Code — And How to Debug Prompt Cache Misses Across Agents", "summary": "A developer released three open-source, zero-telemetry tools for debugging Model Context Protocol (MCP) failures in coding agents such as Claude Code, OpenAI Codex CLI, Cursor and VS Code Copilot. The tools target three silent failure modes: oversized tools/list responses that exhaust context, tools/call outputs large enough to tear down the stdio pipe (Claude Code's 8 MiB limit, Codex's 16 MiB), and prompt-cache misses caused by mid-session config edits. The packages are @framy2/ctxwise (context firewall, multi-editor MCP auditor and CI budget guard), @framy2/mcp-diet (a stdio MCP proxy that offloads large results and redacts secrets) and @framy2/agent-wire-tap (a wire contract tester with a --passthrough prompt-prefix cache-miss debugger).", "body_md": "If you use **Claude Code**, **OpenAI Codex CLI**, **Cursor**, or **VS Code Copilot** with Model Context Protocol (MCP) servers, your context window and prompt cache are exposed to three silent failure modes:\n\n`tools/list`):` github`, `postgres`, `playwright`) injects `tools/call`):`<error>Connection closed</error>` (`anthropics/claude-code#105703`` openai/codex#60383``cache_control`, or mid-session `\"disableAllHooks\": true` edits (`anthropics/claude-code#106225`\nWe built three zero-telemetry open-source tools to inspect and prevent all three:\n\n`@framy2/ctxwise`` v1.2.0`) — Context Firewall, Multi-Editor MCP Auditor & CI Budget Guard (`Apache-2.0`)`@framy2/mcp-diet`` v0.1.1`) — Stdio MCP Proxy with `MIT`)`@framy2/agent-wire-tap`` v0.2.0`) — Local Wire Contract Tester & Live `--passthrough` Prompt-Prefix Cache-Miss Debugger (\n\n```\n{\n  \"mcpServers\": {\n    \"github\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@framy2/mcp-diet@0.1.1\",\n        \"--read-only\",\n        \"--max-desc\", \"160\",\n        \"--max-result-kb\", \"512\",\n        \"--redact-secrets\",\n        \"--\",\n        \"npx\", \"-y\", \"@modelcontextprotocol/server-github\"\n      ]\n    }\n  }\n}\n```\n\n`mcp-diet` sits on stdio between the host CLI and the upstream MCP server:\n\n`>= 512 KiB` tool outputs to a local temp file and returns a compact `< 2 KB` preview so Claude Code (`8 MiB`) and Codex (` 16 MiB`) never tear down the pipe.` sk-ant-*`, `sk-proj-*`, `ghp_*`, `AKIA*`, DB passwords) before they reach the model transcript.\n\n```\n# Probe stdio MCP tools safely (works on Windows without shell: true) & profile token weight\nnpx @framy2/ctxwise mcp-xray --probe-stdio\n\n# Check CLAUDE.md, .claude/rules/*.md, AGENTS.md, .cursor/mcp.json, and .vscode/mcp.json parity\nnpx @framy2/ctxwise agents --fail-on-divergence\n\n# Scan for leaked secrets, Trojan Unicode, disableAllHooks, and unpinned `npx -y` MCP runners\nnpx @framy2/ctxwise shield --strict --sarif ctxwise.sarif\n\n# Enforce ctxwise.budget.yaml across Claude, Codex, and Cursor without double-counting synced rules\nnpx @framy2/ctxwise budget\n# CI contract test at $0.00 API cost (mock mode)\nnpx @framy2/agent-wire-tap \\\n  --assert-contains \"AGENTS.md\" \\\n  --assert-not-contains \"sk-ant-\" \\\n  --assert-max-bytes 32768 \\\n  --assert-max-tools 12 \\\n  -- codex exec \"ping\"\n\n# Live transparent pass-through proxy (streams SSE & detects prefix divergence block-by-block)\nnpx @framy2/agent-wire-tap --passthrough https://api.anthropic.com --port 8787\n```\n\n`--passthrough` keeps credentials strictly in memory (`[REDACTED]` in traces/logs) while hashing each prefix segment (`model`, `tools[]`, `system[]`, `messages[]`) and flagging the exact `firstDivergentLayer` / `firstDivergentIndex` whenever a mutation breaks a `cache_control` breakpoint.\n\nPaste your `.mcp.json`, `.vscode/mcp.json`, `CLAUDE.md`, or `AGENTS.md` right in the browser (100% local, zero uploads):", "url": "https://wpnews.pro/news/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache", "canonical_source": "https://dev.to/framy2/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache-misses-across-3kob", "published_at": "2026-11-13 18:12:05+00:00", "updated_at": "2026-11-13 18:22:05.178948+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["Claude Code", "OpenAI Codex CLI", "Cursor", "VS Code Copilot", "Model Context Protocol", "@framy2/ctxwise", "@framy2/mcp-diet", "@framy2/agent-wire-tap"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache", "markdown": "https://wpnews.pro/news/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache.md", "text": "https://wpnews.pro/news/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache.txt", "jsonld": "https://wpnews.pro/news/how-an-8mb-mcp-tool-response-crashes-claude-code-and-how-to-debug-prompt-cache.jsonld"}}