How to audit MCP tool schema token bloat and sync CLAUDE.md with AGENTS.md locally
If you connect 4–5 MCP servers to Claude Code or OpenAI Codex (GitHub, Playwright, Postgres, Notion), their tools/list JSON schemas silently consume 15,000–35,000 tokens on every turn before you even type a prompt. On top of that, repositories using both Claude Code ( CLAUDE.md ) and OpenAI Codex ( AGENTS.md ) or Cursor ( .cursor/rules ) quickly suffer from rule drift or accidentally include…
Auditing the schema token bloat of MCP tool usage and synchronizing CLAUDE.md with AGENTS.md locally is essential for optimizing performance and reducing security risks. The <source> material reveals that when 4–5 MCP servers are connected to Claude Code or OpenAI Codex, their tools/list JSON schemas can silently consume a significant amount of tokens, up to 35,000 per turn, even before any user input is provided.
Moreover, repositories that use both Claude Code (CLAUDE.md) and OpenAI Codex (AGENTS.md) or Cursor ( .cursor/rules ) are prone to rule drift and may accidentally include sensitive information such as exposed keys or covert prompt injections in third-party skills. To address these issues, CtxWise v1.0, a tool developed by @framy2, has been released to inspect and fix these problems efficiently.
CtxWise operates locally, making it zero API call and zero telemetry, and runs in just 50ms. By running the command "npx @framy2/ctxwise mcp-xray --probe-stdio", the tool can analyze 4 MCP servers and identify that they are using 24 tool schemas, consuming approximately 18,420 tokens per turn. This is considered "BLOATED" and represents an opportunity for optimization.
The tool also highlights specific issues, such as 2,840 tokens being used by github/create_or_update_pull_request (19 parameters) and 1,920 tokens by playwright/browser_snapshot_dom (15 parameters). By employing tree-shaking techniques, CtxWise can save around 4,760 tokens on every single turn, resulting in improved efficiency.
Furthermore, CtxWise can sync CLAUDE.md and AGENTS.md locally, ensuring that both are in parity. For instance, after running "npx @framy2/ctxwise sync --compress", Claude and Codex are both synced with 410 tokens each. Additionally, the "npx @framy2/ctxwise shield --fail-on-risk" command can flag potential risks, such as hardcoded API keys (High risk) or covert HTML comment prompt injections (High risk).
For example, it identifies a hardcoded Anthropic API key in .mcp.json and a covert HTML comment prompt injection in .claude/skills/helper/SKILL.md.
By utilizing CtxWise, developers can effectively audit the schema token bloat of their MCP tools, synchronize CLAUDE.md with AGENTS.md locally, and ensure a more efficient and secure workflow.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.