
Code mode for MCP tools in Claude Code: one sandboxed JavaScript program instead of many tool calls
Code mode for MCP tools in Claude Code: one sandboxed JavaScript program instead of many tool calls
·
code-mode is a Claude Code plugin. Claude writes one JavaScript program that calls your MCP tools in a sandbox, filters and joins the data there, and sends back only the answer.
Measured: the same 30/30 correct answers at 43% lower cost per task with Haiku 5.5. How we measured · If it saves you tokens, ⭐ the repo.
Install · Demo · Measured · Example · How it works · Config
Needs Claude Code and Node.js 22.13+. No dependencies. In a Claude Code session:
/plugin marketplace add gabe4coding/claude-code-mode
/plugin install code-mode@claude-code-modeStart a new session and ask for anything that needs several MCP calls. Using auto mode with Claude Code older than 2.1.301? Add allow rules first: Permissions.
The full film with sound:
https://github.com/user-attachments/assets/468c412f-ecae-4e04-a53b-8a291561a052
| Without code-mode | With code-mode |
|---|---|
| Claude calls tools one by one | Claude writes one program |
| Every full result lands in context | Results are filtered in a sandbox |
| Context fills with raw JSON | Only the answer comes back |
unshare -rn works.The bench in bench/ runs six tasks in headless Claude Code against a fake MCP server.
Each task has traps: pages, nested fields, bots and results larger than 20,000 characters.
Haiku 5.5, without and with code-mode (5 runs of each task, plugin 0.6.0 and 0.6.1, 2026-10-10). In 0.6.0 the code-mode start line did not reach the model, so Haiku called most tools directly.
| Tools called directly (0.6.0) | Through code-mode (0.6.1) | |
|---|---|---|
| Share of MCP calls made directly | 89% | 2% |
| Correct answers | 30/30 | 30/30 |
| Cost per task | $0.007 | $0.004 |
| Input tokens per task | 167,297 | 149,995 |
| Output tokens per task | 1,814 | 1,194 |
| Seconds per task | 13.5 | 11.6 |
Opus 5.5, output projection off and on: duplicate MCP calls per task went from 1.37 to 0.10. Cost and correct answers did not change. Refer to PR #11.
Limits: these are bench tasks in headless runs. Interactive sessions were not measured. Most input tokens are the fixed context of Claude Code, so the input saving is smaller than the cost saving. To run the bench again, refer to Development.
"Which of my open Jira issues have no update in the last 14 days?"
const issues = await call("mcp__claude_ai_Jira__searchJiraIssuesUsingJql", {
cloudId: "example.atlassian.net",
jql: "assignee = currentUser() AND statusCategory != Done",
})
const cutoff = Date.now() - 14 * 24 * 3600 * 1000
return issues.issues
.filter(i => Date.parse(i.fields.updated) < cutoff)
.map(i => ({ key: i.key, title: i.fields.summary }))Claude sees a short list of keys and titles, not every full issue.
| Page | |
|---|---|
| Installation | Requirements, install, local folder, update |
| Usage | The three tools, how to write a program, the result |
| Hints | Write hints, approve proposals, the safety rules |
| Saved functions | Approve or write functions that programs use again |
| Permissions | Manual and auto mode, allow rules |
| Configuration | Every option and its default |
| How it works | One run from start to end, the four sandbox layers |
| Troubleshooting | Common errors and known limits |
| Development | Layout, tests, releases |
Issues and PRs welcome. If code-mode saves you tokens, a ⭐ helps others find it.
MIT. See LICENSE.
This repo does not document an install step we could read. Check the README on GitHub.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/claude-code-mode to learn what the "Claude Code Mode" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
This server doesn't publish a machine-readable tool manifest, and it doesn't expose a public endpoint we could ask. Connect the server locally to see what it exposes.
We could not run this server: it ships no npx package for our sandbox and no public endpoint. The four checks that need a live server are left out, and the grade tops out at B until one exists.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/claude-code-mode)Nothing comparable is listed yet.
v0.12.20Release notesv0.12.8Release notesv0.12.7Release notesv0.12.5Release notesv0.10.2Release notesv0.10.1Release notesConnect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "claude-code-mode" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.