codemode
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.
@orkestrate/codemode
One MCP tool (execute) that runs JS/TS glue code next to your downstream MCP
servers — with AST pre-flight validation, safe read-only auto-parallelization,
eager pre-warming, empirical output-schema learning, zero-copy image
passthrough, OAuth 2.1, and crash-checkpoint replay.
Install
bun add -g @orkestrate/codemode
# or run without installing globally:
bunx @orkestrate/codemode --helpRelated MCP server: mcpgate
Architecture
agent ──(1 tool: execute)──▶ codemode (upstream MCP, stdio or HTTP)
│ compileScript (acorn + TS fallback)
│ pre-flight → prewarm → Worker pool
▼
psychoscript sandbox (secret-free Bun Worker)
│ mcp.* host namespace (postMessage RPC)
▼
McpPool (host) ──▶ downstream MCP servers (stdio / Streamable HTTP)src/config.ts— layered configs,{env:VAR}/${VAR}runtime-only expansion, 5-harness importers, self-wrap guard.src/cache.ts— structural output learner (key names + JSON types only).src/artifacts.ts— host-side zero-copy binary store ($artifacthandles).src/client.ts— downstream MCP pool (stdio + Streamable HTTP + SSE).src/catalog.ts— TS signature rendering, token-budgetedexecutedescription, fuzzy suggestions.src/compiler.ts— AST pre-flight + read-only auto-parallelizer.src/worker.ts/src/sandbox.ts— secret-free Worker + pool, timeouts, checkpoints, TypeError hints.src/daemon.ts/src/mcp.ts— upstream handler (exactly 1 tool) + shared daemon (unix socket + loopback HTTP).src/oauth.ts— MCP OAuth 2.1 (RFC 9728 PRM, RFC 8414 AS, DCR/PKCE,0o600token store).src/cli.ts— declarative help, strict flag parser, TTY formatting.
CLI
codemode list [server] [--probe] [--json]
codemode add <name> <url> [--header "K: V"] [--local]
codemode add <name> -- <cmd> [args...] [--env K=V] [--local]
codemode rm <name> [--local]
codemode import [--from opencode|claude|codex|antigravity|fx|auto] [--write]
codemode refresh [server]
codemode exec <code | -> [--standalone] [--timeout <ms>] [--checkpoint <id>]
codemode mcp [--standalone] [--http [port]]
codemode serve [--port <n>]
codemode restart
codemode auth login <server> [--scope <scopes>] [--no-open] (alias: codemode login)
codemode auth logout <server> (alias: codemode logout)
codemode auth status
codemode setup <harness> [--http [url]]
codemode doctor [--tokens]
codemode trust [dir]
codemode untrust [dir]
codemode skill
codemode <cmd> -h | --helpsync → refresh, print-config → setup, remove → rm (hidden aliases).
Sandbox mcp API
// typed tool call (auto-unwrapped JSON; binary -> { $artifact } handle)
const issue = await mcp.github.get_issue({ owner: "a", repo: "b", number: 1 });
// dynamic dispatch / raw envelope / discovery
const r = await mcp.call("github", "get_issue", { owner: "a", repo: "b" });
const raw = await mcp.raw("github", "get_issue", { owner: "a", repo: "b" });
const all = await mcp.list(); // { server: [tools...] }
const schema = await mcp.schema("github", "get_issue");
// attach binary for upstream ImageContent passthrough
const h = await mcp.attach("<base64>", "image/png");
return { img: h };// parallel fan-out over readonly tools (also auto-parallelized by the AST)
const [a, b] = await Promise.all([
mcp.pg.query({ sql: "select 1" }),
mcp.pg.query({ sql: "select 2" }),
]);// crash recovery: retry with the checkpoint from the error
// first attempt throws on line 2; retry replays call #1 in 0ms
try {
await mcp.stripe.charge({ amount: 100 });
throw new Error("boom");
} catch (e) { throw e; }
// retry: codemode exec --checkpoint <cp-id> '<same code>'Connect your harness (copy-paste)
OpenCode (~/.config/opencode/opencode.json → mcp):
{ "mcp": { "codemode": { "type": "local", "command": ["codemode", "mcp"], "enabled": true } } }(Or run codemode setup opencode — also supports
claude, codex, antigravity, fx. codemode setup <harness> --http
emits an HTTP snippet.)
Claude Code (.mcp.json):
{ "mcpServers": { "codemode": { "command": "codemode", "args": ["mcp"] } } }Codex (~/.codex/config.toml):
[mcp_servers.codemode]
command = "codemode"
args = ["mcp"]Antigravity / fx (HTTP):
{ "mcpServers": { "codemode": { "serverUrl": "http://127.0.0.1:3779/mcp" } } }{ "mcpServers": { "codemode": { "url": "http://127.0.0.1:3779/mcp" } } }Tip: codemode import --from auto scans all five harnesses and prints a
merged config with secret placeholders preserved; add --write to save it to
~/.config/orkestrate/codemode.json.
Config precedence
~/.config/orkestrate/codemode.json → .codemode.json → --config <path>
(ORKESTRATE_CODEMODE_CONFIG overrides). Placeholders {env:VAR} / ${VAR}
expand only in memory at connect time — never on disk, never in logs.
Zero-ritual hot-reload (no sync needed)
Edit ~/.config/orkestrate/codemode.json (or ./.codemode.json) or run
codemode add / codemode rm — the daemon hot-reloads automatically on the
next request (fast stat fingerprint, last-known-good kept on mid-edit
malformed JSON). New servers appear immediately as lazy: execute calls pass
pre-flight and connect on first use, while unchanged servers stay hot.
codemode add gh https://mcp.example.com/mcp --header "Authorization: Bearer {env:TOKEN}"
codemode add local -- bun ./my-server.mjs --env KEY=val
codemode add local -- bun ./my-server.mjs --local
codemode rm gh
codemode refresh [server]
codemode restartOAuth 2.1: codemode auth login <server> [--scope ...] (login alias), codemode auth logout <server>,
codemode auth status. Tokens live in ~/.config/orkestrate/codemode-auth.json
(0o600, ORKESTRATE_CODEMODE_AUTH overrides) — never in config, logs, or
Worker memory. Sandbox extras: mcp.refresh(server?), and mcp.schema(server)
lazily probes an unprobed server.
Security
Project trust gate:
./.codemode.jsonis skipped unless explicitly approved withcodemode trust(stored in~/.config/orkestrate/codemode-trusted.json,0o600).Secret-free sandbox: Scripts run in
psychoscriptinside an isolated Bun Worker with zeroprocess.env, filesystem, or network access;maxToolCallsdefaults to50per execution.HTTP
/mcpprotections: LoopbackHostandOriginvalidation plus0o600Bearer token auth (~/.config/orkestrate/codemode-http-token).Reporting: See SECURITY.md.
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
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
One OAuth connector for your team's remote MCP servers, with Tool Packs, guardrails and logs.
Host any HTTP API as a standard MCP server; auto-distribute to 12+ mainstream agent platforms.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceTurns any OpenAPI spec into a single-tool MCP server where the model writes JavaScript against a typed api object in a QuickJS sandbox, so multi-step tasks run in one round trip and only the final result reaches context. Credentials, rate limiting, retries, write gating and audit logging stay on the host, outside the sandbox.MIT
- AlicenseNot gradedqualityBmaintenanceExposes any number of upstream MCP servers (stdio subprocesses or Streamable HTTP endpoints) as one MCP server for LLM agents, with namespaced tool names so servers cannot shadow each other. Every tool call passes centralized OAuth 2.1 bearer validation, per-client tool RBAC, rate limits, JSON Schema argument checks, a hash-chained audit log, and tool-definition pinning that quarantines changed tools until an operator approves them.MIT
- AlicenseNot gradedqualityBmaintenanceActs as a single proxy in front of multiple MCP servers, exposing search, describe, and execute tools so models can write short TypeScript programs against typed stubs and run them in a credential-isolating QuickJS sandbox with policy, budgets, approvals, and audit controls.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceAggregates many upstream MCP servers behind a single proxy so AI coding editors can access hundreds of tools without hitting tool-count limits, while trimming tool schemas to cut prompt token usage by up to ~98%. It also sandboxes tool calls by blocking path traversal, dangerous shell chaining, and host environment variable leakage.PolyForm Noncommercial 1.0.0