When you add MCP servers to your AI coding agent, each one dumps its full JSON schema into context. 255 tools across all servers = 39,964 tokens. On a 128K context window, that's 31% gone before you type a single character.
I was literally paying for JSON syntax overhead. Every API call included {"content":[{"type":"text","text":"..."}]}
— 80 tokens to deliver 6 tokens of data.
I built a CLI that sits between your agent and MCP servers. It does three things:
Instead of full JSON schemas, mcptoon presents tools in a compact pipe-delimited format:
{"name":"search","description":"Search the web","inputSchema":{"type":"object","properties":{"q":{"type":"string","description":"Query"},"n":{"type":"number"}},"required":["q"]}}
search|q:s*|n:n
255 tools: 39,964 → 3,511 tokens. 91% saved. Verified with tiktoken.get_encoding("cl100k_base")
.
Schemas live on disk in ~/.mcptoon/config.json
. Your agent runs mcptoon manifest --slim
to see what's available, then mcptoon call <server> <tool> '{"param":"value"}' --toon
to execute. Only the compressed output enters context.
Tool results come back as human-readable key-value pairs instead of nested JSON:
{"content":[{"type":"text","text":"{\"name\":\"react\",\"stars\":219000}"}]}
name: react
stars: 219000
My first version replaced null
with ∅
(the empty set symbol). I thought I was being clever. Then someone ran it through tiktoken: null
= 1 token, ∅
= 2 tokens. I was literally increasing token count and calling it optimization.
The HN community called me out on it. Fair enough — I hadn't measured before shipping. Now everything is tiktoken-verified. true
stays true
. null
stays null
. No unicode tricks.
At GPT-4o pricing ($5/M tokens):
pip install mcptoon
mcptoon add fetch --stdio npx -y @anthropic/mcp-fetch
mcptoon manifest --slim # see what's available, compact
mcptoon call fetch fetch '{"url":"https://example.com"}' --toon
Works with any agent that can run shell commands. One config file for all agents — no more reconfiguring for Claude Code vs Cursor vs OpenCode.
3000 lines of Python, 309 tests, zero dependencies.
GitHub: https://github.com/activeing123/mcptoon
What's your biggest MCP token waste? How are others handling this?