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.
harness-code-mode
Universal async JavaScript Code Mode for Hermes Agent, Pi, Codex, Claude Code, Cursor, and any MCP-compatible AI harness — with zero runtime dependencies.
Write one short async JavaScript snippet that discovers tools on demand via BM25, fans out parallel calls with Promise.all, uses Claude Code-style $ / read / edit / write / grep / glob helpers, persists state across turns, and returns only the compact summary to the model context.
// One model turn: search + parallel fetch + filter + return ~200 bytes
const hits = searchTools("issues tracker", 3);
const issues = await tools.mcp__tracker__list_issues({ state: "open" });
const urgent = issues.filter((i) => i.labels.includes("urgent"));
const bodies = await Promise.all(
urgent.map((i) => tools.mcp__tracker__get_issue({ id: i.id })),
);
return { count: bodies.length, totalChars: bodies.reduce((s, b) => s + b.body.length, 0) };Install per Harness
Requires Node.js >=22 (Node >=25 / Hermes-bundled Node v26 recommended for OS-level network denial under --permission).
Hermes Agent
hermes plugins install weblancaster/harness-code-mode --enableIf Hermes prompts to install Node dependencies for the root
package.json, answerN(or pass--no-deps) —harness-code-modehas zero npm dependencies. Restart Hermes Desktop / gateway after installing so the running process loads the plugin.
Configure settings in config.yaml (plugins.entries.code-mode.settings) or Desktop Settings → Plugins → Code Mode.
Pi (@earendil-works/pi-coding-agent)
pi install git:github.com/weblancaster/harness-code-modePi auto-discovers adapters/pi/index.ts and skills/code-mode from package.json. By default this registers as codemode (explicitly overriding Pi's built-in codemode with exposure: "model-only", reachesTools: () => "all", and prepareLoadout). Set HARNESS_CODEMODE_PI_TOOL_NAME=harness_codemode to run it side-by-side instead.
Codex (~/.codex/config.toml)
Clone once (recommended over cold npx github: to avoid MCP startup timeouts):
git clone https://github.com/weblancaster/harness-code-mode ~/Code/harness-code-modeAdd to ~/.codex/config.toml:
[mcp_servers.codemode]
command = "node"
args = ["/ABS/PATH/TO/harness-code-mode/adapters/mcp/cli.js", "--from-codex", "~/.codex/config.toml"]
tool_timeout_sec = 600
startup_timeout_sec = 30Or via npx (allow extra startup_timeout_sec for cold fetch):
[mcp_servers.codemode]
command = "npx"
args = ["-y", "github:weblancaster/harness-code-mode", "--from-codex", "~/.codex/config.toml"]
tool_timeout_sec = 600
startup_timeout_sec = 60Avoid double-spawning upstream MCP servers: Either keep your upstream servers in a dedicated
mcp.jsonpassed via--config /path/to/mcp.json(recommended), or setenabled = falseon those individual[mcp_servers.<name>]entries in~/.codex/config.tomland pass--include-disabledalongside--from-codex ~/.codex/config.tomlso onlycodemodespawns them.
Claude Code / Cursor / OpenCode / any MCP host
claude mcp add codemode -- node /ABS/PATH/TO/harness-code-mode/adapters/mcp/cli.js --config /path/to/mcp.jsonOptional local coding helpers ($, read, edit, write, grep, glob) are off by default in MCP mode. Opt in explicitly with --allow-local-tools --workspace /path/to/repo.
Related MCP server: codemode-mcp-gateway
Sandbox API
In JS | Behavior |
| Calls any exposed MCP or built-in tool; throws catchable JS Error on failure |
| Local BM25 search ( |
| Local JSON Schema lookup ( |
| POSIX single-quoted shell helper; supports |
| Reads a file ( |
| Targeted find-and-replace edit |
| Writes a file |
| Searches file contents or finds files by glob |
| Persists across calls in the same session |
| Captured and returned as |
| The only value returned to the model context |
Harness Tool Bindings (helperBindings)
Helper | Hermes | Pi | Standalone MCP ( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Slash Commands (Hermes & Pi)
/codemode status— show exposed tool count, active sandbox workers, and Node binary/codemode reset— terminate active sandbox workers and clearstate/codemode tools [query]— search exposed Code Mode tools
Hermes Settings (plugin.yaml)
Key | Default | Meaning |
|
| Non-MCP built-in tools exposed alongside all |
|
| Default per-execution wall-clock timeout in seconds (max |
|
| Node.js V8 |
|
| Tool-call budget per execution |
|
| Max parallel tool calls for |
|
| LRU cap on live session workers |
|
| Reap idle workers after N seconds |
|
| Truncation limit on serialized output |
|
| Optional Node |
|
| Register cache-safe system prompt guidance |
Never exposed on Hermes: codemode, delegate_task, clarify, execute_code, memory, skill_manage, cronjob, cronjob_manage, send_message, tool_call, tool_search, tool_describe.
Security Model & Disclosure
Child-process isolation: Each session runs a dedicated Node.js child process launched with
--permission --allow-fs-read=<realpath(core/worker.js)> --allow-fs-read=<realpath(core/catalog.js)>,--max-old-space-size, and a scrubbed environment (PATH,HOME,LANG,LC_ALLonly — zero API keys). On Node>=25(including Hermes-bundled Node v26),--permissiondenies filesystem, child processes, workers, FFI, WASI, and outbound network sockets (ERR_ACCESS_DENIED). On Node22–24,--permissiondenies fs/child_process/workers but does not gate raw sockets.Primitive-only VM realm boundary: User code runs inside
vm.createContext(Object.create(null), { codeGeneration: { strings: true, wasm: false } }). Only primitive strings andundefinedcross the bridge (hostSend(json)never throws; replies enter via in-contextdeliver(json)), so no host-realmPromise,Error, orObjectenters the sandbox.Untrusted worker framing: The host enforces active
exec_id, tool allowlist membership, tool-call budget, concurrency cap, and wall-clockSIGKILLhard timeout on every worker frame.Native harness approvals & redaction:
Hermes: Dispatches fail-closed through
model_tools.handle_function_callunderprogrammatic_file_read()+thread_scoped_silence()with per-callcontextvars.Context.copy(),capture_thread_callbacks(),tools.interrupt.acting_for_tid,is_interrupted()polling,_TERMINAL_BLOCKED_PARAMSstripping, subagent guard, andctx.redact_text().Pi: Dispatches via
ctx.executeTool(name, args, { signal })so Pi'stool_callpermission gates, validation, andnestedCallsstay in charge.Standalone MCP (
--allow-local-tools): Off by default and requires explicit--workspace <dir>. When opted in, file operations are realpath-confined (and symlinks are rejected on write);local_shellconfines its initialworkdirto--workspace, while shell commands execute with host permissions and the host only approves the outercodemodecall.
Tests
node --test tests/*.test.js
python3 -m unittest discover -s tests -vLicense
MIT © 2026 Michael Lancaster
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
Ephemeral single-task tool forged from examples, sandbox-proven, task-bound, expiring by design.
Email inboxes, webhook URLs, mock APIs and 170+ tools for coding agents over one MCP connection.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Cross-tool persistent memory and context for AI assistants over MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides secure execution of arbitrary JavaScript code within a sandboxed QuickJS WASM environment, allowing language models or other MCP clients to safely run JavaScript code snippets without compromising the host system.5-
- AlicenseNot gradedqualityBmaintenanceExposes a single execute tool so agents can discover, inspect schemas for, and compose calls to connected upstream MCP servers by writing JavaScript that runs in a fresh sandboxed QuickJS VM. Results from combined tool calls are returned as text or JSON, keeping large tool catalogs out of the agent's context.MIT
- 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