CloudflareKenton Varda
Code Mode: the better way to use MCP
Code Mode rethinks MCP by converting MCP tools into a TypeScript API and having an LLM write code that calls that API, rather than invoking tools directly. The approach lets agents handle more and more complex tools when exposed as code rather than as raw tool calls, and shines when chaining multiple calls because the LLM can skip intermediate transfers by writing code that reads only the final results.
It explains MCP as a uniform way to expose an API with documentation and out-of-band authorization, with tools being remote procedure calls that the LLM can invoke via a defined format. The article notes that code mode runs the generated code inside a secure, isolated sandbox, using Cloudflare Workers isolates rather than containers, which start in milliseconds and use only a few megabytes of memory.
It also describes the Worker Loader API, which loads dynamic workers on demand, and highlights bindings as a way to access MCP servers without leaking API keys or broad network access. The piece includes examples of converting MCP server schemas into TypeScript definitions and points readers to further docs and production beta sign-ups, with the post dated 26 September 2025.