Give Claude Code a token-cost auditor
The TokenZero MCP server lets Claude Code audit the project it is working in for LLM token waste, price model alternatives at list prices, make a request body cache-friendly, and provision a workspace key, all in one tool call each.
Setup
claude mcp add --transport http tokenzero https://tokenzero.sh/mcp # or local, no network for audits: claude mcp add tokenzero -- npx -y @tokenzero/mcp
Add the AGENTS.md section with npx -y @tokenzero/cli init --agent-rules so the agent audits before opening PRs.
Tools
audit_repo_token_waste: static audit of a local directory, a public GitHub repo or a diff; runs locally, nothing uploaded.calculate_model_arbitrage: price a workload for the requested model and its cheaper sibling, with and without caching (table 2026-10-26).optimize_prompt_payload: rewrite an OpenAI or Anthropic request so its static prefix is provider-cacheable.provision_workspace: create a workspace and key with no form.
Protocol
Streamable HTTP at https://tokenzero.sh/mcp and stdio via npx -y @tokenzero/mcp. MCP 2026-07-28 (per-request _meta versioning, server/discover, typed results) with the initialize-era handshake still accepted for older clients.
Questions
Does Claude Code need a TokenZero account?
No. Audits and arbitrage run locally. optimize_prompt_payload and provision_workspace call the hosted service; the latter creates a free workspace.
Is my code uploaded?
No. The audit reads files locally and reports findings with file and line. Only a hosted audit of a public GitHub repository fetches code, from GitHub.