code-mode-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
code-mode-mcp
Let the model write one script instead of making twenty tool calls.
An MCP server that runs model-written JavaScript against your files, shell and other MCP servers in a single call. Only the returned value goes back into the context.
Install · How it works · Script API · Configuration · CLI
Why
Agents chain tool calls: read a file, grep, read three more, call an API, filter. Every intermediate result fills up the context and every step costs a round trip. Code Mode turns that chain into one program:
// one run_script call
const files = await fs.glob("src/**/*.ts");
const hits = await Promise.all(files.map(async (f) => ({ f, n: (await fs.read(f)).split("TODO").length - 1 })));
return hits.filter((h) => h.n).sort((a, b) => b.n - a.n).slice(0, 5);The model gets back only the top five. The idea is known as "Code Mode". This server brings it to any MCP client: Claude, Cursor, Codex, OpenCode, VS Code, Windsurf or your own agent.
Related MCP server: codemode-node
Features
Two tools.
run_scriptruns code or a saved script.save_scriptsaves a reusable action.MCP proxy. Calls any other MCP server as
mcp.<server>.<tool>(args), over stdio or HTTP.Helpers and saved scripts. Your own functions, loaded from a folder and listed for the model automatically.
Layered config. A global layer plus a per-project layer. Nothing company-specific lives in the code.
Secrets out of files. Use
${env:VAR}and${cmd:...}in server env and headers.Runs anywhere.
npxwith Node 20+, or a standalone binary with no runtime at all.Never left running. A script that times out or returns is cancelled, and every process it started is killed.
There is no sandbox. Scripts run with your user's permissions and without permission prompts. Use it locally only.
Install
Pick one way to run it. All three start the same stdio MCP server.
Runner | Command | Needs |
bunx |
| |
npx |
| Node 20+ |
binary |
| nothing (see below) |
Standalone binary for macOS and Linux, checksum verified:
curl -fsSL https://raw.githubusercontent.com/Zovaris/code-mode-mcp/main/install.sh | shAdd it to your client
The examples use bunx. For npx, swap the command for npx and the args for ["-y", "@zovaris/code-mode-mcp"]. For the binary, use its path as the command and drop the args.
Claude Code
claude mcp add -s user code-mode -- bunx --bun @zovaris/code-mode-mcpClaude Desktop (claude_desktop_config.json), Cursor (~/.cursor/mcp.json), Windsurf (~/.codeium/windsurf/mcp_config.json)
{
"mcpServers": {
"code-mode": { "command": "bunx", "args": ["--bun", "@zovaris/code-mode-mcp"] }
}
}VS Code (.vscode/mcp.json)
{
"servers": {
"code-mode": { "type": "stdio", "command": "bunx", "args": ["--bun", "@zovaris/code-mode-mcp"] }
}
}Codex CLI (~/.codex/config.toml)
[mcp_servers.code-mode]
command = "bunx"
args = ["--bun", "@zovaris/code-mode-mcp"]OpenCode (opencode.json)
{
"mcp": {
"code-mode": { "type": "local", "command": ["bunx", "--bun", "@zovaris/code-mode-mcp"] }
}
}GUI apps such as Claude Desktop may not see your shell's PATH. If bunx is not found, use its full path (which bunx).
Then add the MCP servers you want to reach from scripts to ~/.config/code-mode/servers.json (see Configuration).
How it works
model ──run_script({code})──▶ code-mode-mcp ──▶ fs / grep / sh
│
└──────▶ mcp.<server>.<tool>() ──▶ other MCP servers
model ◀──── returned value only ──┘At startup, code-mode reads the layers and connects proxied servers lazily, on first use.
The tool description lists the API, your helpers and your saved scripts in a short form.
The script runs as an async function body. Logs and the return value come back, truncated to
CODE_MODE_MAX_OUTPUT.
Tools
Tool | Input | Does |
|
| Runs a JS body or a saved script |
|
| Saves to |
Script API
Every call is async, so await it. The working directory is the client's project folder.
Global | Does |
| Files |
| ripgrep (falls back to |
|
|
| Proxied MCP servers |
| One-line tool signatures, cached in |
| Saved scripts |
| Signatures of helpers and scripts |
| Utilities |
run_script stops at timeout_ms (120 s by default). When a script times out or returns, pending calls reject, later calls throw, and its shell processes, including their children, are killed.
Configuration
Everything specific to you is data, kept in a layer folder:
File | Holds |
| MCP servers to proxy, in the same shape as |
| Your settings, exposed to helpers and scripts as |
| Helpers: adapters that turn MCP or shell calls into plain functions |
| Saved actions: function bodies with a comment header |
There are two layers. The global one is ~/.config/code-mode/ (or $CODE_MODE_HOME). The project one is .code-mode/, found by walking up from the cwd. The project layer wins: config.json deep-merges, and servers, helpers and scripts are overridden by name.
Proxied servers
{
"mcpServers": {
"local-tool": { "command": "my-mcp", "args": ["serve"] },
"tracker": {
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer ${env:TRACKER_API_KEY}" }
},
"oauth-server": { "command": "npx", "args": ["-y", "mcp-remote", "https://mcp.example.com/mcp"] }
}
}Helpers
// lib/code-host.js
export const docs = { myPRs: "myPRs({state?}) -> [{repo, number, title, url}] // my PRs" };
export default ({ mcp, sh, fs, grep, config }) => ({
myPRs: async ({ state = "open" } = {}) => { /* reads config.codeHost */ },
});Saved scripts
// scripts/issue-prs.js
// @description My issues with the PRs that mention each
// @param states string[]? issue states
const issues = await myIssues({ states: args.states ?? config.issues.activeStates });
return Promise.all(issues.map(async (i) => ({ id: i.id, prs: await prsMentioning(i.id) })));Working examples live in examples/. Copy what you want into a layer folder:
File | Gives |
|
|
|
|
|
|
|
|
| TODO/FIXME comments grouped by file |
| What changed on the branch, its commits and new TODOs |
| Your issues with the PRs that mention each |
| Which local services are up, and how to start the rest |
CLI
code-mode-mcp --version
code-mode-mcp scripts # list saved scripts
code-mode-mcp run todos '{"limit":5}' # run a saved script
code-mode-mcp eval 'return (await fs.glob("**/*.ts")).length'Env | Default |
|
|
|
|
Development
bun install
bun run dev # run from source
bun test
bun run typecheck
bun run build # dist/index.js for Node
bun run build:bin # bin/code-mode-mcp standalone binaryReleases: bump version in package.json and push a vX.Y.Z tag. The release workflow tests, publishes to npm and attaches binaries for macOS and Linux (arm64 and x64) with SHA256SUMS.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Create, schedule, and run JavaScript jobs, manage files, and inspect runs from your AI agent.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Remote MCP for 1,500+ APIs. Vault-managed credentials; OAuth or API key. Search, load, and execute.
Build and run AI workflows, agents, data tables and 1000+ API integrations from any MCP client.
Related MCP Servers
- AlicenseAqualityFmaintenanceComposes arbitrary MCP tools using JavaScript, enabling discovery, composition, and execution of other MCP servers through a single 'exec' tool.19 npm1MIT
- AlicenseAqualityBmaintenanceEnables agents to accomplish multi-step work by writing a single sandboxed JavaScript program that drives shell, filesystem, HTTP, and every tool of any configured MCP server, returning only a small summary instead of raw JSON. This collapses dozens of advertised tool schemas into one tool, cutting per-request context by roughly 26× while keeping disabled upstream servers reachable.164 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to reach every configured MCP server through just three tools (search, describe, execute) and a sandboxed JavaScript runtime, so a model writes one short program instead of making dozens of tool calls. Runs without network, filesystem, or credential access, returning only the result.28 npm9MIT
- AlicenseNot gradedqualityBmaintenanceEnables models to run JavaScript programs in a sandbox that call other MCP server tools, filter and join their results, and return only the final result to the context.2MIT