cd /news/developer-tools/how-i-cut-mcp-token-usage-by-91-and-… · home topics developer-tools article
[ARTICLE · art-98410] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

How I Cut MCP Token Usage by 91% (and Learned a Humbling Lesson About Tokenizers)

A developer built mcptoon, a CLI tool that reduces MCP server token usage by 91% by replacing verbose JSON schemas with a compact pipe-delimited format. The tool, which sits between AI coding agents and MCP servers, was verified with tiktoken and is available on GitHub.

read2 min views1 publishedAug 16, 2026

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?

── more in #developer-tools 4 stories · sorted by recency
── more on @mcptoon 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-i-cut-mcp-token-…] indexed:0 read:2min 2026-08-16 ·