The Cloudflare API has over 2,500 endpoints. Exposing each one as an MCP tool would consume over 2 million tokens. With Code Mode, we collapsed all of it into two tools and roughly 1,000 tokens of context. https://t.co/rpWBqGao0a
Cloudflare MCP Server Covers Full API in Two Tools and 1,000 Tokens
Cloudflare· Updated
Cloudflare launched a new MCP server that covers its 2,500-endpoint API in two tools and ~1,000 tokens. Code Mode lets agents write code to discover and call APIs instead of loading every tool description upfront, cutting token overhead by 99.9%.
search() and execute(). The agent writes JavaScript to discover endpoints and compose API calls, keeping the token footprint fixed at ~1,000 regardless of API size.The MCP context window problem is real: every tool definition eats tokens, making large APIs practically inaccessible to agents. Code Mode solves this at the architecture level - the agent interacts through code rather than pre-loaded descriptions. Cloudflare is open-sourcing the Code Mode SDK so developers can apply the pattern to their own servers.
If you're building MCP servers for large APIs, this is the pattern to watch. It sidesteps the tool-per-endpoint scaling problem entirely, making any API agent-accessible without blowing through context windows.
Every HeadsUpAI update is written based on its original source and reviewed before it's published. Read our editorial standards →

