CodeModeTOON MCP Server

$npx -y code-mode-toon
README.md

A lightweight MCP orchestrator designed for efficiency at scale.

CodeModeTOON MCP Server

  </a>
</td>
<td>
  <strong>Listed on Glama MCP Directory</strong>
  One-click installation for AI assistants
</td>

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:

  1. Stateful Execution: Run complex TypeScript workflows to maintain context outside the model.
  2. 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 vm module (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_code returns 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

claude_desktop_config.json
{"mcpServers":{"code-mode-toon":{"command":"npx","args":["-y","code-mode-toon"],"env":{"CODE_MODE_TOON_CONFIG":"~/.cursor/mcp.json"}}}}

Try it

β†’Suggest the best approach for analyzing these Kubernetes audit logs using TOON compression.
β†’Execute a TypeScript workflow to aggregate data from my database and Perplexity, then return the compressed result.
β†’List all available MCP servers that CodeModeTOON can lazy-load.
β†’Run a sandboxed JS execution to process this large JSON payload and show me the token savings.

Frequently Asked Questions

What are the key features of CodeModeTOON?

TOON Compression: Reduces token usage by 30-90% for structured data like logs and DB dumps.. Lazy Loading: Servers only start when needed, ensuring zero overhead for unused tools.. Sandboxed Execution: Secure JS execution with auto-proxied MCP tool access via Node.js vm module.. Agent-Friendly Recovery: Error messages include actionable hints like 'Try list_servers' for self-correction..

What can I use CodeModeTOON for?

SRE log analysis where massive JSON payloads would otherwise explode the context window.. Coordinating multiple MCP servers in parallel for complex multi-step AI workflows.. Reducing API costs in token-constrained environments by 'zipping' structured responses.. Maintaining stateful execution for complex TypeScript workflows outside the model's context..

How do I install CodeModeTOON?

Install CodeModeTOON by running: npx -y code-mode-toon

What MCP clients work with CodeModeTOON?

CodeModeTOON works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use CodeModeTOON with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free