- instead of the agent calling the tools directly, code mode let the agent write a short script to do a batch/netested call of the tools so that there are less back-and-forth calls between the harness and LLM.
Claude code did not introduced this. Cloudflare did last year. In fact, both claude code and opencode are late in the game. Goose had this since Dec 2025. Codex since March 2026, pi and droid since last month.
What are you aware of? That opencode has had it experimental since a few months ago and it’s now officially on since last month and that claude code had just introduced it as experimental 10 days ago?
Yes, code mode is old news. You could have mentioned pi, or codex or something else, but you chose to mention the tool that is the most late in the game
Cloudflare has been doing this for quite some time. It’s great. Every one of my MCPs goes behind a Cloudflare mcp portal with code mode enabled by default. That one connection provides any mcp client with every mcp you have behind the portal.
Every one of my MCPs goes behind a Cloudflare mcp portal with code mode enabled by default. That one connection provides any mcp client with every mcp you have behind the portal.
can you give some more details? is this on their free tier?
Cloudflare has 2 GUI controls. MCP Portals and MCP Servers.
MCP servers you just place the http transport URL like https://saasiuse.com/mcp and then choose auth method. Auth login is the usual. Custom headers you can use API/bearer token so it's a permanent access that doesn't expire.
So say you add 20 of those.
Then you can add 2..3..20 to ONE MCP Portal to say ChatGPT or Claude code or OpenCode, whatever.
That MCP client (ChatGPT and Claude code are MCP clients) then only needs you to add 1 MCP to it. The client then only sees 5 tools. Essentially the ones you use are tool_search and then tool_execute or something like that. Another is toggle servers on/off.
So in context you don't keep 800 tools every turn. You keep 5 and it can search and execute the tools it needs.
I have 2 Google Workspace accounts for my business. Google fucking finally released an MCP for it's main products. Mail, Docs, Drive, Sheets, Slides, Workspace Search etc. Being Google, it was a massive pain in the ass to set that up but once I did, I had 7-8 MCPs per workspace and added a Google Admin portal and Google Support portal. Many clients have Google stuff built in nowadays but now I have a portable, fully accessible suite of Google MCPs and Portals that I can take with me wherever I go and will always be mine and will always work.
I could add them all to one portal, or multiple, or mix and match. For terminal clients I have one huge MCP Portal. For ChatGPT Business chats I have a Marketing Portal, Operations Portal, Google Workspace Portal etc just for scoping access.
I think it's obfuscation by complexity with Cloudflare because idk why this isn't the most popular AI companion software for everyone. It's a game changer.
To be clear, the MCP Portal Code Mode is a bit different than the harness implementations. The naming is kind of poor. I like to clarify this because they have different benefits, you can use one without getting the benefit of the other. Ideally you should use both.
Code Mode in a harness means scripting tool calls, so instead of calling read/edit/bash/etc. it all becomes a single "execute" tool. The benefit here is that it reduces turns and therefore time spent.
Cloudflare MCP Portal Code Mode implements a "search-and-execute" pattern for tool calling, and is called "tool optimization" by other MCP gateways like Toolhive. Without this feature, every tool connected via MCP injects it's full instructions into the context. The benefit here is reduced context and token usage when you have a lot of tools connected.
Yes, you are correct. Codemode writes JavaScript in a sandbox to execute commands while search and execute is different. I believe the MCP Portals have both but also it names it codemode directly in the Cloudflare GUI for some reason. So it operates via codemode for execution but it is also a search and execute style MCP.
I should also note too Cloudflare CLI 'cf cli' release candidate 1 has shipped so setting these up is significantly easier via terminal than it was before. This is separate from wrangler.
Cloudflares support agent is Kimi using codemode and is essentially an unlimited open model agent that has access to your Cloudflare account and can create complete repos you can download and configure of Cloudflare primitives. Workers, D1, durable objects. It's wild lol. Cloudflare gives away so much for free.
MCP Portals is not an agent harness itself, so it only "has" the search-and-execute pattern. The portal is indeed compatible with the OpenCode (and other harness) codemode for the JavaScript execution, though.
Within the Cloudflare ecosystem, their Agents do also support the harness Code Mode, the scripted tool-use pattern. Here's their 2 documentation pages showing their entirely different definitions of Code Mode!
Skills over mcp is also part of Aperture, a tool created by the same team that made Tailscale. It proxies your API keys as well, so you don't have to share those with a harness.
Oh shit. I'll check that out. Highly recommend Toolport for local MCPs as well. With an MCP Tunnel and Toolport you can use your local MCPs via ChatGPT lol it's wild. ChatGPT using playwright on my laptops browser is a trip and a half.
54
u/megablue 1d ago edited 23h ago
brief description of what it does
- instead of the agent calling the tools directly, code mode let the agent write a short script to do a batch/netested call of the tools so that there are less back-and-forth calls between the harness and LLM.
to enable it
add following to opencode.json
"experimental": { "full_codemode": true }26
u/AlmostEasy89 23h ago
Cloudflare has been doing this for quite some time. It’s great. Every one of my MCPs goes behind a Cloudflare mcp portal with code mode enabled by default. That one connection provides any mcp client with every mcp you have behind the portal.
1
u/squirrelscrush 11h ago
I thought it was already enabled lol
1
u/Melodic_Reality_646 2h ago
Isn’t this what smolagents from HF does?