HeadsUpAI

Cloudflare MCP Server Covers Full API in Two Tools and 1,000 Tokens

· Updated

Cloudflare launched a new MCP server covering its full API - DNS, Zero Trust, Workers, R2, and more - using Code Mode, a technique that replaces thousands of tool definitions with just two: 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.

Cloudflare
Cloudflare
@Cloudflare
X

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

108retweets
View on X

Share this update