MCP setup · updated 2026-10-26

Give Codex a token-cost auditor

The TokenZero MCP server lets Codex 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

[mcp_servers.tokenzero]
command = "npx"
args = ["-y", "@tokenzero/mcp"]   # ~/.codex/config.toml

The same four tools; Codex reads AGENTS.md, which init --agent-rules fills in.

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 Codex 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.