Changelog¶
0.3.1¶
No code changes. The package metadata now points at the project's current home:
- Repository and issue links go to
github.com/shivamkr09/codemode-mcp. - The author field names
shivamkr09.
0.3.0¶
Measured for the first time against real models, 0.2.0 turned out not to work with small ones: they wrote scripts that never called the tools. This release fixes that, adds the benchmark that found it, and closes four safety gaps. Results are on the benchmarks page of the docs.
Upgrading from 0.2.0. Three things behave differently:
serve --transport httpanddashboardon a host other than127.0.0.1/localhostnow need an access token inCODEMODE_TOKEN. This includes the Docker image.memory_mbis enforced. A script that used more than the limit (512 MB by default) used to get away with it and now gets aMemoryError; raise the setting if you need more.- A tool that returns Python-style text such as
"[(1, 'a')]"now reaches the script as a list or dict, not a string.
Security¶
- HTTP needs a token off localhost.
serve --transport httpanddashboardrefuse to start on any host other than127.0.0.1/localhostunlessCODEMODE_TOKENis set (--token-envpicks another variable). With a token, every request must sendAuthorization: Bearer <token>; browsers can use it as a Basic-auth password for the dashboard. This changes the Docker image: it listens on0.0.0.0, so it now needs-e CODEMODE_TOKEN. memory_mbis now a real limit. It used to set only V8's heap, which does not cover Python's memory: a script could allocate 2 GB under a 512 MB limit. Python's heap can no longer grow past it (MemoryError), and the host restarts a sandbox process that grows more than 384 MB beyond it.- Approval answers are bound to their question. In the suspend-and-resume flow (protocol 2026-07-28+), a repeated or late answer could approve the next, different call of the same script, a retry with an unknown state ran the script a second time, and two calls started together overwrote each other's question. Each question now has a single-use token, unknown retries get an error, and questions are asked one at a time.
"@destructive"inrequire_approvalmatches every tool its own server marks as destructive.codemode-mcp initwrites["@destructive", "*.delete*", "*.remove*", "*.drop*"]into new configs, andserveprints a note when nothing needs approval.
Fixed¶
- A server that fails to start says why. Instead of "unhandled errors in a TaskGroup",
the error names a command that is not on
PATH, or tells you to run the server's command yourself when it exits early. - Small models now use the tools. The
run_codeinstructions say outright that the sandbox is empty and that the tools are the only way to reach any data, show a call that exists in your catalog instead of aserver.tool_nameplaceholder, and say whether variables survive between scripts. - Corrective hints. When a script calls no tools and reaches for
subprocess,sqlite3,open()and the like, forgets anawait, or uses a variable from an earlier script, the result now ends with one line saying what to do instead. - Text results that are Python literals become values. Servers written in Python often
return
str(rows), which is not JSON, so scripts received a string where they expected a list. These are now parsed (never evaluated). A tool that returned such text now yields alistordictinstead of astr. - Classic-MCP estimate no longer overstates savings for multi-call runs. The estimate
charged every classic tool definition once per upstream call, as if each call were an
LLM turn of its own. It now charges them once per
run_code, which is a lower bound on what a classic agent would use. Events recorded by earlier versions keep their old numbers; runcodemode-mcp usage --clearto start again from clean data.
Added¶
- Conversation state.
run_openaiandrun_anthropickeep Python variables for the length of one conversation and clear them afterwards (keep_state=Falseturns it off).async with cm.conversation():does the same for your own loop. The proxy is unchanged: setpersistent_statethere. inline_signatures_tokens(default 600): for small to medium catalogs, one-line signatures of every tool go into therun_codedescription, so the first script needs nosearch_toolscall.search_toolsfetches several tools by exact name in one call, and a server name lists everything on that server.- Benchmark suite (
benchmarks/): six tasks over five real MCP servers, run through classic tool calling and Code Mode with the same model. Records provider-reported tokens, prompt-cache hits, cost and turns, checks every answer against a ground truth, and saves after every run. Works with any OpenAI-compatible endpoint and with Google Cloud Vertex AI (--vertex-project). The suite includes tasks where Code Mode is expected to make no difference.--styles proxy proxy-stateruns the tasks throughcodemode-mcp serveas an MCP client app would, and four more tasks (--group unseen) were added after the fixes to check that the gains were not specific to the first six. - The agent loops ask again when a provider returns a reply with no message, instead of
raising
AttributeError. codemode_mcp.benchmark.run_classic()andrun_codemode()to run one style on its own.RunStats.cached_tokensandAgentResult.cached_tokens: input tokens served from the provider's prompt cache. Reasoning tokens that a provider reports only in its total are now counted as output.UsageTracker.classic_payload_cost()andclassic_run_cost().- Docs: a "Start here" path for beginners (what Code Mode is, a first run that needs no API key, connecting an AI app, a first Python agent), a benchmarks page, and a new theme.
Changed¶
- The
run_codeinstructions are longer: about 450 tokens for a small catalog, up from about 300. Definition counts quoted in the docs are updated to match. - README and docs no longer call the bundled-example token counts "measured": they are counts from example servers with no model involved, and are labelled as such.
0.2.0¶
Monitoring¶
- Token accounting: every call is recorded locally in SQLite: Code Mode tokens against a conservative classic-MCP estimate. tiktoken is used when installed.
codemode-mcp usage: terminal summary.codemode-mcp dashboard: offline web dashboard; also served at/dashboard/in HTTP mode, or with--dashboard-port.codemode-mcp benchmark: runs a prompt through a real LLM with both classic tool calling and Code Mode, then compares the provider-measured tokens, turns and answers.
Connectivity¶
- OAuth 2.1 for remote servers (
"oauth": true): dynamic client registration or a pre-registered client, a browser sign-in with a localhost callback, and stored, auto-refreshed tokens. Addscodemode-mcp login. - Resources and prompts: the proxy passes them through. Inside the sandbox, use
resources.list()/resources.read().
Tools and execution¶
- Hybrid mode (
expose_tools): selected tools are also exposed directly. persistent_state: keeps variables betweenrun_codecalls.require_approval: human approval through MCP elicitation, with suspend/resume on 2026-07-28+ connections, a y/N prompt in the CLI, or a callback in the library.audit_log: JSONL record of each run's code, tool calls and output.
Packaging¶
codemode-mcp init: imports servers from Claude Desktop, Cursor, VS Code or Windsurf, and can rewrite the client config (--install, with a backup).- Proxy rebuilt on the low-level MCP server API.
- Project infrastructure: CI matrix (3 OSes × Python 3.11–3.13), PyPI Trusted Publishing, a Docker image, ruff, issue templates, and security and contributing guides.
0.1.0¶
- First release:
search_tools+run_codeover any MCP servers, a Deno + Pyodide sandbox, an MCP proxy, a Python library, OpenAI/Anthropic agent loops and the CLI.