Show HN: I built an MCP server using Cloudflare's code mode pattern (github.com)

87 points by jmcodes ↗ HN
Read this article by Cloudflare this morning https://blog.cloudflare.com/code-mode/ the main argument being that LLMs are much better at writing typescript code than tool calls because they've seen typescript code many more times.

HN Discussion: https://news.ycombinator.com/item?id=45399204 https://news.ycombinator.com/item?id=45386248

Deno provides a great sandbox environment for Typescript code execution because of its permissions system which made it easy to spin up code that only has access to fetch and network calls.

Stick an MCP proxy on top of that and you've got "CodeMode" (code intermixed with MCP tool calls) for more advanced workflow orchestration.

https://github.com/jx-codes/codemode-mcp

There's a lot of things that can be improved here. Like a virtual file system for the agent to actually build up its solution instead of being forced to one shot the solution but the bones are there.

12 comments

[ 3.4 ms ] story [ 42.6 ms ] thread
I was just reflecting on this blog post after reading it this morning. What do you think on code mode after implementing it? At this point would not be better to just have a sandboxed api environment with customizable api/tools endpoints? basically an RL environment :)
I read it as this leading towards an alternative to MCP, what many people have been thinking about as well. Just that to not completely pull the rug on the most hyped thing right now, they are like this is a better way to do MCP.
Haha yes, yes it is. I wrote out and implemented that approach in the links below. I've been playing with it for a few hours and I have to say I actually really really like it.

One thing I ran into is that since the RPC calls are independent Deno processes, you can't keep say DuckDB or SQLite open.

But since it's just typescript on Deno. I can just use a regular server process instead of MCP, expose it through the TS RPC files I define, and the LLM will have access to it.

https://github.com/jx-codes/mcp-rpc https://news.ycombinator.com/item?id=45420133

This is a terrible idea masquerading as innovation. Cloudflare wants you to believe LLMs write TypeScript better than they make tool calls, but they're really just creating another dependency on their infrastructure.

1. Tool calls are intentionally simple; adding a code generation layer introduces needless complexity and failure points.

2. Cloudflare already acts as a man-in-the-middle for ~20% of the Internet with limited transparency about government data requests

3. This is clearly designed to drive adoption of their Worker platform and create lock-in for AI agent developers

Similar to their x402 payment scheme that reinvents HTTP 402 under their control, the community has already built alternatives (see the Aperture implementation from Lightning) that don't require surrendering more of your stack to Cloudflare.

Remember what's happening here: a company with unprecedented visibility into web traffic wants even more control over how AI agents interact with the internet. Even if you don't believe that AI will eventually self govern itself, this is a horrible idea to limit individual's ability to automate portions of their access to the web.

No thanks.

> LLMs are much better at writing code than at tool calling.

Wait, really? This is harder to get right:

``` { "jsonrpc": "2.0", "id": 102, "method": "tools/call", "params": { "name": "book_flight", "arguments": { "origin": "SFO", "destination": "JFK", "departureDate": "2025-10-15", "returnDate": "2025-10-18", "passengers": 2, "cabinClass": "business" } } } ```

Than the equivalent... but with `method: "POST"` boilerplate, etc? Or is it literally the chaining of tools that's missing from—and fundamentally faulty in—MCP client implementations?

I find it interesting how this project uses all three major JavaScript runtimes in a single project. Bun for the code itself, Deno for sandboxing and Node for running the MCP server. Says something about the ecosystem.
does this approach actually work? is it more reliable than plain mcp calls?
The valuable lesson from what Cloudflare claims is that if you want to make an LLM perform as you expect you have to build considering their strengths and weaknesses.

You can see the same behavior if you try to ask an LLM to code in an API that is not commonly used.

When it comes to MCP tooling I followed a different path but with similar assumptions.

There are tools that LLMs have been Rled to death to use. So I’m modeling my tools after them.

Specifically, I try to have a “glob” tool, used to let the LLM figure out structure. A search and a read tool and use regexp as much as possible for passing parameters.

You can see an early version of this pattern here: https://github.com/typedef-ai/fenic/blob/main/examples/mcp/d...

It has been working well, at least in terms of the model knowing how to invoke and use the tools.

I have to say though that each model is different. I see differences between Claude code and Codex when I use the MCP for development, at least on how good they are in retrieving the information they need.

Maybe I should try to run some benchmarking and compare more formally

MCP is the best SDK
Many [1] models expect (MCP) tool calls to be formatted as a JSON. So if you expose code execition as an MCP tool to such model, it will have to generate the code escaped as a JSON string. I would exepct this to tank code generation quality.

[1] Not all, some use different formats, e.g. GLM uses plain text with special tokens to denote param names and values.