Configuration¶
codemode-mcp reads the same mcp.json format as Claude Desktop, Cursor and VS Code, with
an optional codemode block for its own settings. When -c isn't given, the CLI looks
for ./mcp.json, ./.mcp.json and ./.vscode/mcp.json, in that order.
mcp.json
{
"mcpServers": {
"github": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"],
"env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"}},
"linear": {"url": "https://mcp.linear.app/mcp", "oauth": true},
"docs": {"url": "https://example.com/mcp", "headers": {"Authorization": "Bearer ${DOCS_TOKEN}"}},
"legacy": {"type": "sse", "url": "https://example.com/sse"},
"fs": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/data"],
"exclude_tools": ["write_file", "move_file"]},
"old": {"command": "old-server", "disabled": true}
},
"codemode": {
"timeout": 30,
"require_approval": ["*.delete_*", "github.merge_pull_request"],
"expose_tools": ["github.get_me"],
"audit_log": "~/.codemode-mcp/audit.jsonl"
}
}
"servers" (VS Code's key) is accepted as well as "mcpServers".
Server options¶
| Key | Applies to | Description |
|---|---|---|
command, args |
stdio | Program to launch and its arguments |
env |
stdio | Extra environment variables for the server process |
cwd |
stdio | Working directory |
url |
http / sse | Server endpoint |
type / transport |
all | stdio, http (Streamable HTTP; also accepts streamable-http) or sse. Inferred if omitted |
headers |
http / sse | Static HTTP headers, e.g. API keys |
oauth |
http / sse | true, or {client_id, client_secret, scopes, redirect_port, client_name}. See OAuth |
include_tools |
all | Allow list: only these tools are available |
exclude_tools |
all | Block list |
disabled |
all | Skip this server |
Environment variables¶
Any string can use ${VAR} or ${VAR:-default}. Values are read when the config is
loaded, and a missing variable without a default is an error. This keeps secrets out of
the file.
codemode settings¶
| Setting | Default | Description |
|---|---|---|
timeout |
30 |
Wall-clock seconds per run_code. The clock pauses while waiting for approvals. If it's exceeded, the sandbox is reset. |
tool_call_timeout |
60 |
Seconds per upstream tool call |
max_tool_calls |
200 |
Upstream calls allowed in one run_code |
max_output_chars |
20000 |
Output returned to the LLM is truncated beyond this, with a hint to return less |
inline_catalog_tokens |
1500 |
If all stubs fit, they're embedded and only run_code is exposed |
inline_signatures_tokens |
600 |
Otherwise one-line signatures of every tool are embedded if they fit. Sent with every request: raising it trades tokens for fewer turns |
inline_names_tokens |
1500 |
Otherwise the tool-name list is embedded if it fits |
max_search_results |
8 |
Default number of search_tools results |
max_description_chars |
600 |
Tool descriptions are shortened to this length in stubs |
memory_mb |
512 |
Memory a script may use. Python gets a MemoryError at the limit; a sandbox that still grows well past it is restarted |
deno_path |
bundled | Use a different Deno binary (or set CODEMODE_DENO) |
persistent_state |
false |
Keep Python variables between runs. See Advanced |
expose_tools |
[] |
Hybrid mode: server.tool globs that are also exposed as direct tools |
require_approval |
[] |
server.tool globs that need human approval, or "@destructive" for every tool its server marks destructive. codemode-mcp init writes a starting list. See Approvals |
usage_tracking |
true |
Record token accounting (counts only) |
usage_db |
~/.codemode-mcp/usage.db |
SQLite path for usage data |
tokenizer |
auto |
auto (tiktoken if installed), tiktoken or chars |
audit_log |
none | JSONL file with each run's code, tool calls (with arguments) and output |
Glob patterns match either the original server.tool name or the Python name
(server.py_name). For example, "*.delete_*" matches github.delete_repo and
shop.delete-customer.
Environment variables read by codemode-mcp¶
| Variable | Purpose |
|---|---|
CODEMODE_HOME |
Data directory (usage DB, OAuth tokens). Default ~/.codemode-mcp |
CODEMODE_DENO |
Path to a Deno executable |
OPENAI_API_KEY, ANTHROPIC_API_KEY |
Used by chat / benchmark through the provider SDKs (or pick a variable with --api-key-env) |