Tech News
← Back to articles

Show HN: I built an MCP server using Cloudflare's code mode pattern

read original related products more articles

Code Mode MCP Server

A local implementation of the "Code Mode" workflow for MCP servers. Instead of struggling with multiple tool calls, LLMs write TypeScript/JavaScript code that calls a simple HTTP proxy to access your MCP servers.

Note: It does not attempt to handle the MCP -> typescript API transpilation layer. Would be cool but I really wanted to test the workflow.

https://blog.cloudflare.com/code-mode/

What is this?

This implements the core insight that LLMs are much better at writing code than at tool calling. Instead of exposing many tools directly to the LLM (which it struggles with), this server gives the LLM just one tool: execute_code . The LLM writes code that makes HTTP requests to access your other MCP servers.

How it works

LLM gets one tool: execute_code - executes TypeScript/JavaScript LLM writes code: Uses fetch() to call http://localhost:3001/mcp/* endpoints HTTP proxy forwards: Transparently proxies requests to your actual MCP servers Results flow back: Through the code execution to the LLM

This gives you all the benefits of complex tool orchestration, but leverages what LLMs are actually good at: writing code.

Installation

... continue reading