Code Mode Changed How I Think About MCP
March 27, 2026
I'm building agent-cms — a headless CMS with no UI. AI agents manage content through MCP. No buttons, no forms, no WIMP. Sunil Pai's After WIMP articulates exactly why: LLMs dissolve the boundary between "users" and "programmers." The interface isn't a dashboard — it's a conversation where the agent writes code against your system.
The CMS has 33 MCP tools. Creating a blog post with structured content is never one tool call — it's a chain: inspect the schema, create a model, add fields with validators and cross-references, create records with linked data, publish, verify. A typical editorial task is 10-20 sequential tool calls where each depends on the last.
The problem with sequential tool calls
With standard MCP, every tool call is a round-trip through the LLM. The model calls create_model, reads the response, formats the next call to create_field with the model ID from the response, waits for that, formats create_record... Each step re-processes the entire growing conversation context. Cloudflare's Code Mode blog post nails the analogy: making an LLM do this is like putting Shakespeare through a Mandarin class and asking him to write a play in it. LLMs have seen millions of lines of real code. They haven't seen millions of tool-call sequences.
What Code Mode actually does
Code Mode wraps your existing MCP server with codeMcpServer() from @cloudflare/codemode. Your 33 tools become typed methods inside a V8 sandbox. The LLM sees one tool — code — and writes JavaScript:
async () => {
const model = await codemode.create_model({
name: 'Event', apiKey: 'event', sortable: true
});
await codemode.create_field({
modelId: model.id, label: 'Title', apiKey: 'title',
fieldType: 'string', validators: { required: true }
});
await codemode.create_field({
modelId: model.id, label: 'Venue', apiKey: 'venue',
fieldType: 'link', validators: { item_item_type: ['venue'] }
});
const record = await codemode.create_record({
modelApiKey: 'event',
data: {
title: 'Future of AI Summit',
venue: venueId,
description: '## Welcome\n\nA **deep dive** into AI.'
}
});
await codemode.set_publish_status({
action: 'publish', modelApiKey: 'event', recordIds: [record.id]
});
return { modelId: model.id, recordId: record.id };
}That's 5 operations with data dependencies flowing through — model ID into field creation, record ID into publish — executed in a single sandbox invocation. The LLM never sees intermediate results it doesn't need. The V8 isolate spins up in milliseconds via Cloudflare's worker_loaders, credentials stay host-side, and the sandbox has no network access.
The test that convinced me
I gave it this task: create 3 interlinked models (venues, speakers, events), add 12 fields with cross-reference validators, create 7 records with linked data and structured text, publish everything, then query back to verify. That's 25+ operations with conditional logic, loops, and data flowing between every step.
One code call. First try. Every record published with correct cross-references, auto-generated slugs, structured text parsed from markdown.
With standard MCP that's 25 round-trips through the neural network, re-reading a growing context window each time.
Implementation
The integration was surprisingly thin. codeMcpServer() takes your existing MCP server and wraps it — zero changes to tools, services, or schemas. The only infrastructure requirement is the worker_loaders binding in your Cloudflare Worker config.
We serve Code Mode at /mcp (admin, 31 methods) and /mcp/editor (content-only subset, 20 methods — schema mutations like create_model don't exist in the editor sandbox). Standard MCP falls back when no loader binding is configured.
The bigger picture
Sunil's post argues that the successor to WIMP isn't "no interface" — it's behavior synthesized at runtime. Code Mode is exactly that. The agent doesn't click through a predetermined UI. It doesn't even make predetermined tool calls. It writes a program, scoped to the capabilities you expose, executed in an environment you control.
The CMS has no dashboard. Agents write code to manage it. That's the product.