Code Mode: the better way to use MCP
Sep 26, 2025Kenton Varda, Sunil Pai

Summary
Introduces 'Code Mode' for AI agents, which transforms MCP tools into a TypeScript API. This allows LLMs to generate and execute TypeScript code that calls these APIs, improving their ability to handle complex tools and multi-step operations. The Cloudflare Agents SDK is updated to support this, fetching MCP schemas and converting them into TypeScript definitions for use within a sandboxed execution environment.
More from the Artificial Intelligence Integration & Impact trail
- Introducing Clef-omni with full multimodality, plus a faster Clef and a cheaper Clef-flash
- Introducing Web Search API via AI Gateway
- Introducing Clef: our open-source decision models, and new RL fine-tuning platform
- One year later: Sovereign AI and the fight for choice
- AI Search is now generally available