{"slug": "how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers", "title": "How I Cut MCP Token Usage by 91% (and Learned a Humbling Lesson About Tokenizers)", "summary": "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.", "body_md": "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.\n\nI was literally paying for JSON syntax overhead. Every API call included `{\"content\":[{\"type\":\"text\",\"text\":\"...\"}]}`\n\n— 80 tokens to deliver 6 tokens of data.\n\nI built a CLI that sits between your agent and MCP servers. It does three things:\n\nInstead of full JSON schemas, mcptoon presents tools in a compact pipe-delimited format:\n\n```\n# Full JSON (287 tokens per tool):\n{\"name\":\"search\",\"description\":\"Search the web\",\"inputSchema\":{\"type\":\"object\",\"properties\":{\"q\":{\"type\":\"string\",\"description\":\"Query\"},\"n\":{\"type\":\"number\"}},\"required\":[\"q\"]}}\n\n# SLIM format (26 tokens):\nsearch|q:s*|n:n\n```\n\n255 tools: 39,964 → 3,511 tokens. **91% saved.** Verified with `tiktoken.get_encoding(\"cl100k_base\")`\n\n.\n\nSchemas live on disk in `~/.mcptoon/config.json`\n\n. Your agent runs `mcptoon manifest --slim`\n\nto see what's available, then `mcptoon call <server> <tool> '{\"param\":\"value\"}' --toon`\n\nto execute. Only the compressed output enters context.\n\nTool results come back as human-readable key-value pairs instead of nested JSON:\n\n```\n# JSON result (80 tokens):\n{\"content\":[{\"type\":\"text\",\"text\":\"{\\\"name\\\":\\\"react\\\",\\\"stars\\\":219000}\"}]}\n\n# TOON result (12 tokens):\nname: react\nstars: 219000\n```\n\nMy first version replaced `null`\n\nwith `∅`\n\n(the empty set symbol). I thought I was being clever. Then someone ran it through tiktoken: `null`\n\n= 1 token, `∅`\n\n= 2 tokens. I was literally increasing token count and calling it optimization.\n\nThe HN community called me out on it. Fair enough — I hadn't measured before shipping. Now everything is tiktoken-verified. `true`\n\nstays `true`\n\n. `null`\n\nstays `null`\n\n. No unicode tricks.\n\nAt GPT-4o pricing ($5/M tokens):\n\n```\npip install mcptoon\nmcptoon add fetch --stdio npx -y @anthropic/mcp-fetch\nmcptoon manifest --slim    # see what's available, compact\nmcptoon call fetch fetch '{\"url\":\"https://example.com\"}' --toon\n```\n\nWorks with any agent that can run shell commands. One config file for all agents — no more reconfiguring for Claude Code vs Cursor vs OpenCode.\n\n3000 lines of Python, 309 tests, zero dependencies.\n\nGitHub: [https://github.com/activeing123/mcptoon](https://github.com/activeing123/mcptoon)\n\nWhat's your biggest MCP token waste? How are others handling this?", "url": "https://wpnews.pro/news/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers", "canonical_source": "https://dev.to/mcptokensaver/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers-5hl1", "published_at": "2026-08-16 02:35:21+00:00", "updated_at": "2026-08-16 02:40:47.286874+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "large-language-models"], "entities": ["mcptoon", "MCP", "tiktoken", "GPT-4o", "Claude Code", "Cursor", "OpenCode", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers", "markdown": "https://wpnews.pro/news/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers.md", "text": "https://wpnews.pro/news/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers.txt", "jsonld": "https://wpnews.pro/news/how-i-cut-mcp-token-usage-by-91-and-learned-a-humbling-lesson-about-tokenizers.jsonld"}}