Cloudflare introduces "Code Mode" for MCP (Model Context Protocol), where instead of exposing tools directly to LLMs, the system converts MCP tools into TypeScript APIs and asks LLMs to write code that calls these APIs. This approach leverages LLMs' superior code-writing abilities compared to tool-calling, enables handling of more complex tools, and improves efficiency when chaining multiple calls. The implementation uses Cloudflare Workers' V8 isolates for secure sandboxing, with a new Worker Loader API that creates lightweight, millisecond-startup sandboxes for executing agent-generated code.

15m read timeFrom blog.cloudflare.com
Post cover image
Table of contents
What's MCP?OK, how does it work?Dynamic Worker loading: no containers hereWorkers are better sandboxesTry it now!

Sort: