Show HN: I built an MCP server using Cloudflare's code mode pattern
github.comIf you run `deno check` before executing the code you'd get the type-safety loop (working on this now)
Later I want to see what'd happen if you give the LLM a repo of sorts to store useful snippets and functions with comments for later use. So the LLM itself would save workflows, be able to import them into the Deno environment and chain those together.
It definitely needs a prompt that tells it to use the MCP server but I can see it being pretty powerful.
I only did simple tests like get Reddit posts, their comments, find the weather on those days, stick them in duckdb, and run some social media metric queries.
I could see that same test being: "find me leads, filter by keywords, run against some parquet file stored somewhere using duckdb, craft an email for my boss."
I'm kind of ranting but I think this a pretty exciting approach.
Edit: GraphQL style codegen layer but for all your APIs seems like a pretty obvious middle layer for this, maybe next weekend.
> Later I want to see what'd happen if you give the LLM a repo of sorts to store useful snippets and functions with comments for later use. So the LLM itself would save workflows, be able to import them into the Deno environment and chain those together.
OMG this is the first thing you should do. We have similar now and its freaking amazing. Just discussing yesterday how I can't remember it going off the rails since implementing automem last week even.
Best thing it does, fully recaps all your daily accomplishments, across all platforms (Claude Code, Claude Desktop, ChatGPT, Cursor).
https://i.postimg.cc/Z0tYGKvf/Screenshot-2025-09-28-at-3-15-... https://i.postimg.cc/SQX6bTzV/Screenshot-2025-09-28-at-3-16-...
Called Automem by a friend of my (Jack Arturo), currently closed-source, though I'm sure you could reverse engineer it enough.
- its a hosted stack of FalkorDB + QDrant - has endpoints for creating/retrieving memories - embeds stuff using ChatGPT models - Uses Graph nodes for relating memories together - Has a dream/sleeping phase which degrades long term memory relevant, finds and tracks patterns and more. - Has an MCP which connects any AI directly to memory - Automated hooks which record memory queues on commit, deploy, learning moments - Automated storing of all queued memories on chat end. - A lot more magic under the hood too.
So in reality you get a near biological memory, useful by any MCP agent. To be fair Jack has about a 2 month head start on the rest of us with this idea haha.
--
The setup were building will be an always running setup, so it also has a scheduling runtime in Node that uses MD files to create automatable workflows, some uses agents, some just run bash. They can call mcps, tools, run commands, log output, use automem etc, all in human readable text.
https://i.postimg.cc/Y246Bnmx/Screenshot-2025-09-28-at-3-11-... https://i.postimg.cc/ThM2zY5Z/Screenshot-2025-09-28-at-3-17-... https://i.postimg.cc/vT6H26T7/Screenshot-2025-09-28-at-3-17-...
PS Keep up the great work on your codemode service, got some great ideas from yours to incorporate to ours that should resolve the one or 2 issues we had outstanding. Will share if I get it working, https://github.com/danieliser/code-mode if it gets any where
Sounds very cool.
I actually didn't end up implementing the memory. Instead I went down the 'get rid of the MCP' route. https://github.com/jx-codes/mcp-rpc
Basically instead of mcp servers you write typescript files that are parsed to generate a typed client, these are executed in one deno sandbox, and the LLM code gets that typed client and its scripts are run in a sandbox with only net allowed.
Been having some fun testing it out today.
If you have time to take a look I would be curious to hear what you think.
Just because an agent “lives” in the environment, doesn’t make it RL. It needs a reward function, or even better something like Gym.
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
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.
In which case your likely wrong, people do want it, and AI will be very good at orchestrating simple patterns.
CF definitely has a vested interest.. The problem for them now that I see is that THEY DIDN"T ACTUALLY LAUNCH IT... but did describe what it is/does in complete detail.
Now there are gonna be dozens of non CF locked clones, just like the one OP linked.
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?
The fetch code isn't any better than the tool code I agree, but typescript code is more common so I'd guess this would be too?
But anyway I think the real power comes with the type-safety part that I left out this morning (working on it now). From what I understand Cloudflare is essentially generating an SDK for the LLM to write code against.
Instead of writing that fetch call. The LLM would generate
``` const redditResults = await redditMCP_getTopPosts(subreddit); const insertMutation = await duckdb_Insert("SQL STUFF", redditResults.map(...)); const results = await duckDb_Query(args: duckDb_QueryArgs); return resultsInSomeNiceFormat; ```
Where the method names come from the MCP server tools, and the argument types are autogenerated from the MCP schemas themselves.
No idea if this is a valuable workflow or not personally. I just thought it was cool and wanted to tinker with it.
Except it can use Typescript to manipulate the data mid stream.
So in reality this is MCP Middleware + MCP Orchestration + Tool Call Efficiency.
It will save tokens as well due to only returning what it needs, but more so just think of going from 10 consecutive tool calls, to 1 call that gives you everything you need and nothing you don't, with 1/10th the time taken to accomplish.
Yeah since it's using Deno it'd be cool just use Deno throughout. Definitely gotta clean up the code quite a bit.
If Bun had a sandbox I'd use it.
Deno isn't my cup of tea (although I appreciate it more after building with it the past two days). My impression is that it is lightweight, you can deploy it easily to edge workers and it's built on rust so you can actually use it to build your own runtime with only the parts you want. (I was working on this for a game when I ran into the CF blog article).
Node/npm is the grandpa, can't go wrong but it doesn't run typescript by default and you'll lose cool points.
pnpm is cool don't really know what makes it different these days except it has a nice cache by default so you get faster installs, and you can do monorepos semi-easily. It's my default if I can't use Bun.
Bun is newer and my current favorite. You can compile to single executable, have access to most of the npm ecosystem (some packages still have minor issues), you have a built in sqlite db so it's great for prototyping, and some other niceties.
There's a lot more to it but that's the important differences I run into in my day to day.
http://github.com/gvkhna/vibescraper
I told Jared if bun had a sandbox i’m pretty sure everyone would use it.
I always gravitate to Bun when I can, it feels light and fresh.
Also I'm definitely going to try out your project this weekend, I've been looking for something like this to put together a free college info aggregation site from the college's public sites themselves, like financial aid dates, on campus programs, etc..
So once it has the API shape in memory, it could make dozens of tool calls in a single call.
It isn't about token saving, its about time/efficiency of tool usage/response time accumulation.
Instead of 20 separate tool calls one after the other, you get one larger, orchestrated one that only returns exactly what it needed.
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
For those of you interested, I wrote out and built an more RPC typescript centric approach to avoid using other MCP servers at all. Would appreciate some thoughts!
[1] Not all, some use different formats, e.g. GLM uses plain text with special tokens to denote param names and values.