@pottogames/mcpaudit
v1.0.0
Published
Measure how many tokens your MCP servers silently eat from every request. Find the bloat, cut the cost.
Downloads
18
Maintainers
Readme
mcpaudit
Your MCP servers are eating your context window on every single request. Find out how much.
npx mcpauditNo install, no config, no signup. It finds your MCP servers, asks each one what tools it exposes, and counts exactly what they cost you.
The problem
Every MCP tool definition — name, description, and full JSON schema — is injected into the model's context on every request. Not once per session. Every request.
A server with 30 tools can cost 15,000 tokens. Connect five or six and you're routinely burning 30–50k tokens before you type a single character. On a 200k window that's a quarter of your context gone; on a smaller model it's the whole thing.
You're paying for it twice: once in tokens, and once in quality. Past roughly 30% context consumption, tool-selection accuracy measurably degrades — the model is choosing from a longer menu of near-identical options.
Most people have no idea it's happening, because nothing reports it.
What you get
MCP AUDIT · what your MCP servers cost on every request
──────────────────────────────────────────────────────────────────
38,412 tokens loaded before you type anything
from 6 servers · 94 tools
████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 19.2% of a 200,000 window
WHERE IT GOES
playwright ████████████████████████████ 14,203 (31 tools)
github ███████████████░░░░░░░░░░░░░ 7,891 (22 tools)
filesystem ████████░░░░░░░░░░░░░░░░░░░░ 4,120 (11 tools)
slack ██████░░░░░░░░░░░░░░░░░░░░░░ 3,455 (9 tools)
ESTIMATED COST (this overhead only, not your actual usage)
$2.07 / day $45.62 / month $547.44 / year
WHAT TO FIX
HIGH "playwright" alone is 37% of your MCP overhead
31 tools, 14,203 tokens on every request.
→ Disable it in projects that don't use it, or filter its tool list.
saves ~7,101 tokensCommands
npx mcpaudit # scan and report
npx mcpaudit --requests 400 # your actual request volume
npx mcpaudit --json # machine-readable
npx mcpaudit --json --max-tokens 25000 # fail CI when bloat creeps in
npx mcpaudit --config ./mcp.json --only # audit one specific configOptions
| Flag | Does |
|---|---|
| --json | Machine-readable output |
| --out <file> | Write the report to a file |
| --requests <n> | Requests/day for the cost estimate (default 200) |
| --price <n> | USD per 1M input tokens (default 3.00) |
| --window <n> | Context window size (default 200,000) |
| --max-tokens <n> | Exit non-zero above this budget — for CI |
| --no-probe | Don't launch servers; read configs only |
| --config <path> | Include an extra config file |
| --only | With --config, scan only that file |
| --timeout <ms> | Per-server probe timeout (default 20000) |
Supported clients
Auto-discovered, no setup:
Claude Code · Claude Desktop · Cursor · Windsurf · VS Code · Zed · project-local .mcp.json
Using something else? --config <path> works with any file that has an mcpServers block. Open an issue with the path and it gets added.
How the numbers are produced
Token counts are measured, not estimated. We launch each server, complete the MCP handshake, call tools/list, and run the real schemas through a BPE tokenizer. Anthropic's tokenizer isn't byte-identical to cl100k, so treat counts as accurate to roughly ±10% for Claude — the ranking of offenders, which is what you act on, is unaffected.
Cost is an estimate, and labelled as one. It depends on request volume and cache behaviour that can't be observed from outside. We model the cache-friendly case, so the figure errs low. Change the assumptions with --requests and --price.
Safety. mcpaudit launches the servers already in your own config — the same ones your editor launches at startup — and only ever calls tools/list. It never invokes a tool. Use --no-probe to skip launching entirely.
Pro — $39 once
The free scan tells you what it costs. Pro fixes it.
mcpaudit optimize— generates trimmed configs you can paste- Tool allowlists ranked by actual usefulness
- Dead-tool detection
- Duplicate-registration cleanup across clients
- Full findings list (free shows the top 3)
- CI mode with before/after reporting
One payment. No subscription. Works offline — the licence is verified locally, so the CLI never phones home.
mcpaudit activate <your-key>Requirements
Node 18+. That's it.
Licence
MIT for the scanner. Pro features are source-available under a commercial licence.
