<- all tokdocs

Cloudflare Code Mode: Does 1,000 Tokens Mean MCP Is Dead?

By , founder of Mavric and Apso

View on TikTok ->

Cloudflare's Code Mode lets an AI agent use the entire Cloudflare API, over 2,500 endpoints, through two tools that take code, in about 1,000 tokens. The same API exposed as one MCP tool per endpoint would take about 1.17 million tokens. A TikTok from Max Parker (@maxwealthtech) gets those numbers right but frames them as "RIP MCP." Code Mode still runs on MCP, and the video's own last frame tags MCP "ALIVE."

What is Cloudflare Code Mode?

Code Mode changes how an agent uses tools. Instead of loading a schema for every tool and calling them one at a time, the agent writes code that calls the tools, and that code runs in a sandbox.

The idea first appeared in Cloudflare's post "Code Mode," dated September 26, 2025, by Kenton Varda and Sunil Pai. In that design, the Agents SDK fetches an MCP server's schema and generates a TypeScript API with doc comments. The agent gets one tool that runs TypeScript in a V8 isolate with no internet access. The sandbox reaches MCP servers only through bindings that call back into the agent loop, which holds the credentials.

The authors argue that passing each tool result through the model just to copy it into the next call wastes time, compute and tokens. The video makes the same complaint about round trips.

Does Code Mode really cut tokens from 1.17 million to 1,000?

Yes, for Cloudflare's own API. The video says "Cloudflare has over 2,500 endpoints. Code mode covers every single one with just search and execute in about 1,000 tokens, down from 1.17 million."

Cloudflare's February 20, 2026 post by Matt Carey, "Code Mode: give agents an entire API in 1,000 tokens," supports each part. The Cloudflare API has over 2,500 endpoints. The Code Mode server uses about 1,000 tokens through two tools, search() and execute(). An equivalent MCP server without Code Mode would use 1.17 million tokens.

Cloudflare's developer docs give a comparison table:

Approach Tools Tokens
Native MCP, full schemas 2,594 about 1,170,000
Native MCP, required parameters only 2,594 about 244,000
Code Mode 2 about 1,000

Caveats the video leaves out

There is more than one baseline. The blog post also says exposing every endpoint as its own tool "would consume over 2 million tokens." The docs table adds the 244,000-token row, which cuts the saving from about 1,170 times to about 244 times when optional parameters are dropped.

The baseline is hypothetical. Nobody ships 2,594 separate tool definitions to a model. Cloudflare itself says that much exceeds the context window of most foundation models.

It is one very large API. Cloudflare's docs say Code Mode stays at about 1,000 tokens no matter how many endpoints exist. That is a property of the search-then-execute design, not a result measured across many agents.

The exact figure is unsourced. The video's on-screen number, "1,169,837 tokens," is more precise than anything on Cloudflare's pages, which say 1.17 million or about 1,170,000.

Two releases, one sentence

The video says "Cloudflare solved this with code mode. It turns MCP tools into a TypeScript API, letting the LLM write code in an isolated sandbox instead of spamming tool calls." That describes the September 2025 design.

The 1,000-token result comes from the February 2026 server. There, search() queries the OpenAPI spec and execute() makes Cloudflare API requests. Both take JavaScript async arrow functions. The code runs in a Dynamic Worker, a V8 isolate with no file system and no environment variables, with outside fetches off by default. The two designs are five months apart.

Does Goose use Code Mode?

Yes. The video says "Block uses it in Goose." Cloudflare's February 2026 post says Goose implements Code Mode. Goose's own December 21, 2025 post says its author learned of the concept from a Cloudflare blog post. Block created Goose as an open-source agent, so "Block uses it" is loose wording for an idea Goose borrowed from Cloudflare.

Is Anthropic's programmatic tool calling the same thing?

It is the same pattern with a separate implementation. The video says "Anthropic calls it programmatic tool calling." Anthropic's docs describe Programmatic tool calling as a feature that lets Claude call your tools from code in the code execution container, cutting round trips and token use. It requires the code execution tool at version code_execution_20260120 or later.

Cloudflare's post says Anthropic's Claude SDK implements Code Mode as Programmatic Tool Calling, and that Anthropic explored the same pattern on its own in its "Code Execution with MCP" post. No source says Anthropic renamed Cloudflare's feature. Cloudflare's code runs in a Cloudflare V8 isolate, while Anthropic's runs in Anthropic's code execution container.

Is MCP dead?

No. The video opens on a gravestone reading "RIP," "MCP" and "2024 - ?" and ends with "Classic MCP usage is done." The sources say otherwise.

Cloudflare's docs list the Code Mode server under "Cloudflare API MCP server." The 1,000-token result comes from an MCP server with two tools. Goose's December 2025 post, titled "Code Mode doesn't replace MCP," says "many people claimed it was a replacement for MCP" and then states "Code Mode still uses MCP under the hood." It compares the two to HTTP and REST: MCP is the protocol, and Code Mode is a more efficient way to use it.

The video's final frame shows a gravestone labelled "THE OLD WAY" with the MCP logo beside it tagged "ALIVE." That image matches the sources. What Code Mode replaces is loading one tool schema per endpoint, not MCP.

Bottom line

Cloudflare's Code Mode server does cover over 2,500 endpoints in about 1,000 tokens, against 1.17 million for full per-endpoint schemas or 244,000 with required parameters only. It is itself an MCP server. Goose and Anthropic use the same pattern, and none of them treat it as a replacement for MCP.

Sources

Published November 12, 2026. Based on a TikTok by @maxwealthtech. Full video notes (markdown)