activeing123/mcptoon
A CLI tool that lets an AI agent hook up 1,000 tools without eating its context window
When an AI agent connects to multiple MCP tool servers, just the tool descriptions (schemas) can eat tens of thousands of tokens from the context window before any real work starts. mcptoon removes those schemas from context entirely, letting the agent call tools on-demand through shell commands instead. It also compresses tool call results with a format called TOON, cutting size by up to 93% compared to plain JSON.
What it does
- MCP (Model Context Protocol) is a standard that lets AI agents use external tools, but typical clients load every tool's schema into the context window at startup — 10 servers can burn 50,000-100,000+ tokens.
- mcptoon is a CLI tool, not an MCP server itself. Instead of editing an agent's mcpServers JSON config, the agent runs mcptoon shell commands, so schemas stay in a config file on disk and never enter the context window.
- Tools are lazy-loaded: even with 1,000 servers configured, none of them run until you actually call a tool.
- Results can be returned in three compressed formats — Compact, SLIM, and TOON. Per the repo's own tiktoken cl100k_base benchmark, 255 tool schemas shrink from 90,804 JSON tokens to 117 tokens with Compact (99.9% savings) or 6,174 tokens with SLIM (93% savings), and TOON-encoded call results run 30-40% smaller than JSON.
- It ships three built-in security guards — prompt-injection detection, credential-leak detection, and blocking of destructive operations like delete/drop — and has zero third-party dependencies, using only the Python standard library.
Why it matters
Anyone switching between different AI coding agents can keep the same set of tools without reconfiguring each one, freeing up context space for actual work instead of tool descriptions. As the number of connected tools grows, this approach avoids the scaling problem that kills context windows in typical MCP setups.
Terms in this repo
- MCP (Model Context Protocol) · A protocol that lets AI agents call external tools and servers in a standardized way
- context window · The maximum amount of text an AI model can consider at once
- schema · A specification describing what inputs a tool accepts and what outputs it returns
- TOON · An open data format designed to represent structured data with fewer tokens than JSON
- lazy-load · Not starting a program or server until it is actually needed
Repository description (English)
Token-efficient MCP CLI client. 97% less tokens on tool discovery, 40-60% on results. Zero deps. Cross-platform. Works with every AI agent.
Open on GitHubTrending repos
- vorssaint/vorssaint-utilsOne free menu bar app replaces a dozen paid Mac utilities
- Alishahryar1/free-claude-codeA local proxy that lets coding AI agents run on 49 free or cheap model providers instead of one paid service
- freestylefly/awesome-gpt-image-2A library of 532 reverse-engineered prompts that turn GPT-Image2 into a predictable image-making tool
- block/buzzAn open-source workspace where humans and AI agents chat, code, and review in the same rooms
- NousResearch/hermes-agentNous Research's Hermes is an AI agent that gets smarter the more you use it
- virgiliojr94/book-to-skillA tool that turns technical book PDFs into on-demand reference skills for AI coding agents
- VoltAgent/awesome-agent-skillsA single hub collecting over 1000 'how-to' manuals that make AI coding assistants act like experts
- anthropics/claude-plugins-communityA shared shelf where anyone's Claude add-ons get listed for install