FAQ & troubleshooting¶
General¶
Does it work with any MCP server?
Yes, any server reachable over stdio, Streamable HTTP or SSE, including
OAuth-protected ones. Tools are converted from their JSON Schemas automatically.
Unusual schemas fall back to dict / Any types, and the original names and
argument keys are always used when calling the server.
Will my LLM know how to use it?
Current models are very good at writing short Python scripts against typed
signatures. Often they're better at it than at chaining many tool calls. The tool
descriptions tell the model to do the whole task in one script and to return only what
it needs. Small local models may need a stronger system prompt: use cm.system_prompt.
When does Code Mode not save tokens?
When there are very few tools and the task needs a single tool call with a small
result. Then the run_code description (about 250 tokens of instructions) can cost
more than the schemas it replaces. codemode-mcp stats shows the definition cost for
your servers, and benchmark measures real tasks. Use
hybrid mode for a few frequent, simple tools.
Can scripts use pip packages like pandas?
Not yet. Only the Python standard library is available in the sandbox (json, re,
datetime, statistics, collections, asyncio, …).
Is it production ready?
It's a 0.x release. The sandbox, OAuth, approvals and proxy are covered by integration tests on Windows, macOS and Linux, but expect rough edges with unusual servers. Please report them.
Troubleshooting¶
Deno executable not found
The deno wheel should provide it. Reinstall with pip install --force-reinstall deno,
or point to your own binary with CODEMODE_DENO=/path/to/deno.
First run_code is slow / setup hangs
The first run downloads Pyodide (about 10 MB) from npm. Run codemode-mcp setup once
while online. Behind a proxy, set HTTPS_PROXY so that Deno can download it.
Execution timed out after 30s (sandbox was reset)
The script took too long, often because of a slow upstream tool or a large loop.
Raise codemode.timeout or tool_call_timeout, or ask the model to batch its calls
with asyncio.gather.
requires human approval, but no approver is available
The tool matches require_approval, but the client doesn't support elicitation.
Use a client that does, run through codemode-mcp chat, set an approval_callback in
Python, or remove the pattern.
Failed to connect to MCP server 'x'
Run codemode-mcp -v stats -c mcp.json to see the upstream server's stderr. Common
causes: npx or the command isn't on the PATH of the process that launched
codemode-mcp (desktop apps often have a minimal PATH, so use absolute paths), a
missing environment variable, or a wrong URL.
OAuth browser window doesn't open
The sign-in URL is also printed to stderr. Open it manually, or run
codemode-mcp login <server> from a terminal. Make sure the redirect port (default
33418) is free.
Client shows Environment variable 'X' referenced in config is not set
${X} in mcp.json must be defined in the environment of the process that starts
codemode-mcp, which for a desktop client means its environment. Use
${X:-default}, or set it in the client's env block for the codemode server.
Tokens look estimated (chars/4)
Install exact counting with pip install "codemode-mcp[tokens]".