A lightweight MCP orchestrator designed for efficiency at scale.
CodeModeTOON MCP Server
|
A lightweight Model Context Protocol (MCP) orchestrator designed for efficiency at scale. It features TOON compression (reducing token usage by 30-90%) and Lazy Loading, making it the ideal solution for complex, multi-tool agentic workflows.
The "Context Trap" in Agentic Workflows
Recent articles from Anthropic and Cloudflare (see Here) highlights a critical bottleneck: AI agents struggle with complex, multi-step workflows because they lack state.
While Code Execution (e.g., TypeScript) allows agents to maintain state and structure workflows effectively, it introduces a new problem: Data Bloat. Real-world operations (like SRE log analysis or database dumps) generate massive JSON payloads that explode the context window, making stateful execution prohibitively expensive.
CodeModeTOON bridges this gap. It enables:
- Stateful Execution: Run complex TypeScript workflows to maintain context outside the model.
- Context Efficiency: Use TOON Compression to "zip" the results, allowing agents to process massive datasets without blowing their token budget.
How It Works
graph LR
A[AI AgentClaude/Cursor] -->|JSON-RPC| B[CodeModeTOONServer]
B -->|Lazy Load| C[Perplexity]
B -->|Lazy Load| D[Context7]
B -->|Lazy Load| E[Custom Servers]
C -->|Raw JSON| B
D -->|Raw JSON| B
E -->|Raw JSON| B
B -->|TOONCompressed| A
style B fill:#4f46e5,color:#fff
style A fill:#10b981,color:#fff
Data Flow: Requests route through CodeModeTOON β Servers are lazy-loaded on-demand β Responses are TOON-compressed before returning to the agent.
π₯ Key Features
ποΈ TOON Compression
Reduces token usage by 30-90% for structured data.
- Validated: ~83% savings on Kubernetes audits
- Best for: SRE logs, database dumps, API responses
- How it works: Schema extraction + value compression
β‘ Lazy Loading
Servers only start when needed. Zero overhead for unused tools.
- Best for: Multi-tool workflows, resource-constrained environments
- Performance: Sub-100ms startup for active servers
π Sandboxed Execution
Secure JS execution with auto-proxied MCP tool access.
- Best for: Complex stateful workflows, batch operations
- Security: Uses Node.js
vmmodule (not for multi-tenant use)
π€ Agent-Friendly Features
Designed for programmatic discovery and self-correction.
suggest_approach: Meta-tool that recommends the best execution strategy (code vs workflow vs direct call).- Efficiency Metrics:
execute_codereturns operation counts and compression savings to reinforce efficient behavior. - Recovery Hints: Error messages include actionable next steps for agents (e.g., "Server not found? Try list_servers").
When to Use CodeModeTOON
β Perfect for:
- Multi-step AI workflows requiring state management
- Processing large structured datasets (logs, DB dumps, K8s manifests)
- Coordinating multiple MCP servers in parallel
- Token-constrained environments (reducing API costs)
β Not ideal for:
- Simple single-tool queries
- Unstructured text-heavy responses (compression <10%)
- Multi-tenant production servers (vm module security limitation)
Installation
OneβClick (Cursor)
Manual Setup
Add this to your ~/.cursor/mcp.json:
{
"mcpServers": {
"code-mode-toon": {
"type": "stdio",
"command": "npx",
"args": ["-y", "code-mode-toon"],
"env": {
"CODE_MODE_TOON_CONFIG": "~/.cursor/mcp.json"
Tools (3)
suggest_approachMeta-tool that recommends the best execution strategy (code vs workflow vs direct call).execute_codeRuns complex TypeScript workflows to maintain context outside the model with compression metrics.list_serversLists available MCP servers for discovery and recovery.Environment Variables
CODE_MODE_TOON_CONFIGrequiredPath to the MCP configuration file for server discovery.Configuration
{"mcpServers":{"code-mode-toon":{"command":"npx","args":["-y","code-mode-toon"],"env":{"CODE_MODE_TOON_CONFIG":"~/.cursor/mcp.json"}}}}