-
Notifications
You must be signed in to change notification settings - Fork 4
Explore Code Mode pattern for token-efficient MCP interface #132
Copy link
Copy link
Open
Description
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) andexecute()(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
- Cloudflare blog post
- Current Supermodel MCP server tool definitions for comparison
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels