Context
Cloudflare published a blog post on their "Code Mode MCP" pattern: https://blog.cloudflare.com/code-mode-mcp/
Instead of exposing thousands of individual tool definitions (which bloats context windows), they expose just 2 tools: search() and execute(). The agent writes JavaScript code against a typed SDK, which runs in a sandboxed V8 isolate. This achieves a 99.9% token reduction — their full API surface would consume 1.17M tokens as traditional MCP tools, but Code Mode uses ~1,000 tokens.
Relevance to Supermodel
As we add more graph types and analysis endpoints, the number of MCP tools grows. Each tool definition consumes context tokens on every agent turn. The Code Mode pattern could let us:
- Expose the full Supermodel API surface with minimal token overhead — replace individual graph/analysis tools with
search() (to discover available endpoints/operations) and execute() (to run typed API calls)
- Let agents compose multi-step workflows — e.g., generate a call graph, then filter to a specific module, then check for dead code — all in a single
execute() call rather than multiple tool round-trips
- Progressive capability discovery — new API endpoints become available automatically without shipping new tool definitions
Key Design Questions
- What's the right SDK surface to expose? (REST client vs. higher-level graph query DSL)
- Sandbox approach — Cloudflare uses V8 isolates. We could use Node VM, Deno, or similar
- How to handle auth/scoping within the sandbox
- Whether this complements or replaces the current per-tool MCP approach
References
Context
Cloudflare published a blog post on their "Code Mode MCP" pattern: https://blog.cloudflare.com/code-mode-mcp/
Instead of exposing thousands of individual tool definitions (which bloats context windows), they expose just 2 tools:
search()andexecute(). The agent writes JavaScript code against a typed SDK, which runs in a sandboxed V8 isolate. This achieves a 99.9% token reduction — their full API surface would consume 1.17M tokens as traditional MCP tools, but Code Mode uses ~1,000 tokens.Relevance to Supermodel
As we add more graph types and analysis endpoints, the number of MCP tools grows. Each tool definition consumes context tokens on every agent turn. The Code Mode pattern could let us:
search()(to discover available endpoints/operations) andexecute()(to run typed API calls)execute()call rather than multiple tool round-tripsKey Design Questions
References