MCPtoCodeMode
Allows finding and installing the Supabase MCP server from the official MCP registry, enabling models to interact with Supabase services through MCPtoCodeMode's unified execute interface.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCPtoCodeModeread these order files and total the paid ones"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCPtoCodeMode
Specification · Benchmarks · CI · MIT License · Changelog
One MCP server in front of all the MCP servers you already use. Your model sees three tools instead of hundreds, and writes one short program instead of making dozens of tool calls.
npx -y mcptocodemode demo # local comparison, no keys or config
npx -y mcptocodemode setup # add it to your coding agentssetup finds Claude Code, Codex, Cursor, Grok, OpenCode, Pi, and Claude Desktop, lets you pick which get MCPtoCodeMode, shows every file it will touch, and changes them after you confirm. It reuses the MCP servers those agents already have. Restart them afterwards.
Why
Ask an agent with seven MCP servers to "read these 25 order files and total the paid ones". That is 55 tool definitions in every prompt, 26 tool calls, and 26 turns, each re-reading every file before it. With MCPtoCodeMode the model writes this once, and only the answer comes back:
const listing = await filesystem.list_directory({ path: "/data/orders" });
const names = listing.content.split("\n").map((line) => line.replace("[FILE] ", ""));
const orders = await Promise.all(
names.map(async (name) => JSON.parse((await filesystem.read_text_file({ path: `/data/orders/${name}` })).content)),
);
const paid = orders.filter((order) => order.status === "paid");
return { paid: paid.length, total: paid.reduce((sum, order) => sum + order.total, 0) };It helps most when an agent pages through results, aggregates records, or passes files between tools. For a single call with a short answer, calling directly is simpler.
Related MCP server: pi-codemode-mcp
Benchmarks
Claude Sonnet 5.5 on real tasks, seven reference servers with 55 tools:
Plain MCP | MCPtoCodeMode | |
Correct answers, 3 tasks × 3 runs | 9 / 9 | 9 / 9 |
Input tokens | 531,480 | 94,002 (5.7× fewer) |
Cost | $1.108 | $0.222 (5× less) |
Mail: page threads, pass a 150 KB image between tools | failed, $0.756, 79 s | correct, $0.061, 10 s |
Tool definitions in every prompt | 31,179 bytes | 2,996 bytes |
It takes a few more turns (29 vs 21), since the model usually searches before it writes the program. Method, raw data, and caveats are in REPORT.md.
How it works
The model gets three tools:
searchfinds methods by keyword, with TypeScript signatures for the top hits.describereturns the full signature of a server ("notes") or a method ("notes.get").executeruns JavaScript where each server is a global:await notes.get({ id: "1" }). Only the return value,console.logoutput, and the list of methods called come back. Whatever the code puts onstatesurvives to the next run.
The code runs in a QuickJS sandbox with no network, filesystem, or credentials; its only way out is your MCP servers. The sandbox doesn't limit what a tool does, though: a tool that sends an email still sends it. Use --read-only to block writes. The full contract is SPEC.md.
Commands
Install globally with npm install -g mcptocodemode to get cm (also mcptocodemode). Without installing, use npx -y mcptocodemode <command>; npx cm is an unrelated package.
Command | What it does |
| Add MCPtoCodeMode to the agents you pick. |
| Run the local mailbox comparison. |
| Check configuration without starting servers. |
| Connect to every server and print what the model can call. |
| Search the official MCP registry, or download it for instant search. |
| Save a registry server to your config, or take one out. |
| Sign in to a remote server with OAuth, or forget it. |
| Run the MCP server. This is what agents start. |
| Write the TypeScript the sandbox implements. |
Docs
Agents: manual config for each agent, and how to hide upstream tools so only three remain.
Configuration: discovery, options, read-only mode, registry, OAuth, troubleshooting, limits.
Library
import { catalogFromServers, CodeMode } from "mcptocodemode";
const catalog = catalogFromServers([
{ name: "notes", tools: [{ name: "get", inputSchema: { type: "object", properties: { id: { type: "string" } } } }] },
]);
const mode = new CodeMode(catalog, async (call) => ({ id: call.input.id, title: "Buy milk" }));
await mode.execute(`return await notes.get({ id: "1" });`);beforeCall can refuse a method before it runs (readOnlyPolicy is a ready-made one), createCodeModeServer(mode) makes it an MCP server, and UpstreamPool connects to real servers.
Contributing
Setup and tests: CONTRIBUTING.md. Questions: SUPPORT.md. Vulnerabilities: SECURITY.md. Conduct: CODE_OF_CONDUCT.md. This repository follows the minkaworks repository standard.
The idea comes from Cloudflare Code Mode. This project speaks plain MCP, so any MCP client can use it.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Search, vet & assemble MCP servers from your agent: verified tools, risk labels, and trust scores.
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Hosted MCP runtime where your agent publishes its own tools by tool call and keeps working.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with MCP servers by writing TypeScript/JavaScript code instead of direct tool calls. Provides a code execution sandbox that accesses MCP servers through HTTP proxy endpoints.11 npm130Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP extension that allows coding agents to manage and compose MCP tools by executing JavaScript in a sandboxed environment. It features tools for listing available MCP capabilities and a management command for handling authentication and tool policies.40MIT
- AlicenseNot gradedqualityAmaintenanceEnables building safe, programmable Code Mode MCP servers from upstream tool sources, with model-authored TypeScript running in a sandbox and tool calls routed to trusted host-side providers.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceFronts every MCP server you have with two tools: search shortlists relevant tools, and execute runs sandboxed Python that calls upstream tools as mcp..(). It enables agents to make bulk, repeated, or conditional tool calls using calibrated decision-model choices instead of per-item LLM generation.3MIT