Every tool your MCP server exposes is serialized into the model's context window on every request — before the user types a word. mcp-tokenlint measures that hidden cost and gives you ranked, deterministic ways to shrink it.
Every existing fix — Tool Search, gateways, proxies, dynamic toolsets — is consumer / runtime-side. mcp-tokenlint is shift-left: it scores and shrinks your footprint at publish time, in your own repo, in CI.
mcp-tokenlint — MCP token-budget report Score 41/100 (grade F) ████████░░░░░░░░░░░░ 18,204 tokens across 37 tools · avg 492/tool Sub-scores budget 42 ██████░░░░░░░░ toolCount 90 █████████████░ perToolBloat 55 ███████░░░░░░░ hygiene 30 ████░░░░░░░░░░ Suggestions (est. recoverable: ~6,300 tokens) ▲ search_documents An enum has 51 values (103 tokens). Validate server-side instead… ▲ search_documents Description is 108 tokens. Tighten to ~60; cut examples/preamble. ▲ create_report inputSchema is 740 tokens. Flatten nesting, drop unused fields…
# Point it at a live server over stdio npx github:fernforge/mcp-tokenlint --cmd "npx -y @modelcontextprotocol/server-filesystem ." # Or lint a tools/list dump npx github:fernforge/mcp-tokenlint tools.json # Gate a number in CI npx github:fernforge/mcp-tokenlint tools.json --min-score 70
Fully deterministic — no LLM, no black box. Token counts use the o200k_base encoding as a stable, reproducible proxy for context cost; the scoring curve is open in src/score.ts.
# .github/workflows/mcp-budget.yml
- uses: fernforge/mcp-tokenlint@main
with:
cmd: "node build/server.js" # or: tools: tools.json
min-score: 70
Writes a Markdown report to the job summary and exposes score / total-tokens outputs you can gate on or post as a PR comment.
Real scores for popular MCP servers, measured over stdio. Re-run any row yourself.
| Server | Tools | Tokens | Score | Grade |
|---|---|---|---|---|
server-everything | 13 | 1,423 | 99 | A |
server-filesystem | 14 | 2,741 | 94 | A |
server-memory | 9 | 2,230 | 94 | A |
sequential-thinking | 1 | 942 | 73 | C |
One fat tool can sink a whole server: sequential-thinking exposes a single tool, but its description alone is 566 tokens. Token cost is per-definition, not per-server. Full scorecard →