toolscript-mcp
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.
toolscript-mcp
A standalone MCP server for code mode. The model writes one JavaScript program that calls the tools of your other MCP servers in a sandbox. The program filters and joins the data there. Only the result goes back into the context.
The goal is a server that works with any MCP client, for example Claude Code, Claude Desktop, Cursor and Codex.
New in 1.1.0: MCP Skills, SDK v2, the 2026-07-28 protocol. The server runs on SDK v2. By default, a client of the
2026-07-28 protocol gets a session of that protocol and finds the hint notes of toolscript-mcp as Skills. Every other
client and server gets the protocol of 1.0.5. Protocol starts with the way back: TOOLSCRIPT_PROTOCOL=legacy. Whether Skills save tokens is not measured here. The
measurement is issue 229.
Install from npm. Set it up from npm with
npx -y toolscript-mcp init. Read Limits before you use it.
Features
Two tools.
search_toolsfinds downstream tools and shows their argument types.run_coderuns an async JavaScript program. A 2026-07-28 connection with Skills on lists a third,add_hint, that proposes a hint for you to approve.Servers. Local stdio and remote HTTP servers, with OAuth login or AWS SigV4 signing.
Policy. Ordered
allow,denyandaskrules check each nested call.Results. Compact output,
await recall(n)for kept results andawait saveFile(name, data)for exports.Local development. The built-in Workspace lists, searches and reads the files of one folder. With a write grant, it edits them. It is off by default.
Clients. Claude Code, Claude Desktop, Cursor and Codex. See Client setup. A manual smoke test passed in Codex CLI 0.171.0 with
codex exec. See the result.
JavaScript variables do not persist between runs. A program cannot read MCP resources, and toolscript-mcp has no tool that writes a hint or a saved function. On a 2026-07-28 connection, hint files and saved functions are served to the client as Skills. See Roadmap for the remaining work.
Related MCP server: localforge-codemode
Why
When a model calls MCP tools one by one, every full result goes into its context. Large results fill the context with raw JSON, and each step costs a round trip. With code mode, the loops, filters and joins run in a program. The model sees only the answer.
How it works
Your MCP client connects to toolscript-mcp. toolscript-mcp connects to your other MCP servers.
The model finds tools with
search_tools. A keyword search shows its best matches in full. Each full match has a TypeScript declaration of itscall(): the nested types and the note of each argument. If 3 or fewer tools match, each one shows in full. If more match, match 1 always shows in full. Matches 2 and 3 show in full while all full matches total 4,000 characters or less. The other matches show as one summary each. The same tool on a second server shows as one line that names the full match above. That line takes no full place.The model sends one program to
run_code.The program runs in a separate Node process. Each nested tool call goes through your allow, deny and ask rules.
The return value of the program goes back to the model. If the formatted value is longer than 20,000 characters, the model gets its shape and the first 3,000 characters of compact JSON.
Your MCP client sees only search_tools and run_code. It does not see the tools of your other servers.
An example program:
const issues = await call("mcp__jira__search_issues", {
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 }))The model sees a short list of keys and titles, not every full issue.
Numbers
A bench of 6 tasks in headless Claude Code 2.1.332 with Haiku 5.5, 5 runs per task, compares direct tool calls with toolscript-mcp. Read Measured for the method, and the comparison with Claude Code Code Mode.
Direct tool calls | toolscript-mcp | |
Correct answers | 30/30 | 30/30 |
Mean cost per task | $0.0058 | $0.0024 |
Tool result characters in the context, mean | 39,213 | 3,022 |
On the 2 tasks with small results, toolscript-mcp cost more, because it adds a search step.
The paid Codex benchmark covers six tasks with gpt-6-luna on Codex CLI 0.172.0.
It records 18 runs each for direct MCP calls, native Code Mode, and toolscript-mcp.
Quick start
You need Node 22.13 or later and npm.
Let Claude Code set it up
Paste this prompt into Claude Code. The agent runs onboard and asks you before each change.
Set up toolscript-mcp for me in Claude Code.
1. Run `npx -y toolscript-mcp@latest --version`. If it prints a version below 1.1.0, stop and tell me.
2. Run `npx -y toolscript-mcp@latest onboard`. It prints one next step. Do that step, then run onboard again.
3. Do one printed step at a time. Ask me before each step that writes a file, installs a package or changes Claude Code.
4. Run each command that onboard prints exactly as printed.
5. Never read or print the toolscript-mcp config file.
6. When onboard asks for a restart of Claude Code, stop and tell me.After the restart, paste this line into the new session:
Continue the toolscript-mcp setup: run `npx -y toolscript-mcp@latest onboard`, run the task that it prints with its marker line as the first line of the run_code program, then run `npx -y toolscript-mcp@latest onboard verify` and show me its last line.The setup ends with ready only after the restarted server ran a task. See Set up with one prompt.
Install with the plugin
/plugin marketplace add yeeyon/toolscript-mcp
/plugin install toolscript@toolscript-mcpThen run /toolscript:setup. See With the Claude Code plugin.
Install with npm
npx -y toolscript-mcp initinit imports user-scope servers from Claude Code, Claude Desktop, Cursor and Codex. It writes a config and prints the client changes. See From npm.
Try the demo server
The demo server has sample data and needs no account.
npm install --prefix toolscript-demo toolscript-mcp@latestThe demo file is toolscript-demo/node_modules/toolscript-mcp/demo/server.mjs. Add it to your config as Demo server shows.
Client setup in brief
Replace the example config path with your absolute config path. Use the server name toolscript.
Claude Code on Linux and macOS:
claude mcp add --scope user toolscript '--' npx -y toolscript-mcp --config "/absolute/path/to/config.json"Claude Desktop, Cursor and Codex need a different entry. Read Client setup for each client.
Documentation
Roadmap
Move the core and the sandbox runner out of the Claude Code plugin.
Start the sandbox on Linux, macOS and Windows.
Read a server config, connect to your MCP servers and add
search_tools.Add
run_codewith allow, deny and ask rules.Write the docs and add the release workflow.
Compare toolscript-mcp with Claude Code Code Mode in the bench.
Log in to remote servers with OAuth.
Offer guided setup through the Claude Code plugin.
Run Claude Code tools through the optional stdio bridge, with a project
cwd.Require per-run approval for tools marked for user interaction.
Keep images and other non-text results as files, and show the images that a program returns.
Publish 1.0.0 to npm.
Run the Codex comparison and publish the results.
Keep state between
run_codecalls, as an option.Serve hint files and saved functions as MCP Skills on the 2026-07-28 protocol. See Skills.
Credits
toolscript-mcp is derived from claude-code-mode by Gabriele
Pavanello, under the MIT License, at commit eea4077. The sandbox runner, its protocol, tool search, output
projection and the hint format are his work.
Do you use only Claude Code? Then use his plugin. It reuses the MCP connections and the permission checks of Claude Code.
toolscript-mcp is an independent project. Gabriele Pavanello does not endorse it. It is not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.
Licence
The package has no runtime dependency. dist/host/main.js holds the MCP TypeScript SDK v2, @modelcontextprotocol/client,
server and core 2.4.0 (Apache License 2.0), and the packages that they use. These are under the MIT, ISC and BSD-3-Clause licences.
dist/third-party-licenses.txt holds their licence texts.
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
Run JavaScript and TypeScript an assistant wrote, with only the access each request lends it.
A sandbox for background JavaScript automation with schedules, webhooks, files, secrets, and logs.
Create, deploy and run serverless JavaScript functions on microfn from any MCP client.
Build and run AI workflows, agents, data tables and 1000+ API integrations from any MCP client.
Related MCP Servers
- 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.291 npm8MIT
- AlicenseNot gradedqualityBmaintenanceEnables models to send a single execute tool a JavaScript program that calls LocalForge tools as await tools.localforge.<tool>({...}), so only the program's return value is sent back instead of every intermediate tool result. Programs run in a confined JS-subset interpreter, keeping LocalForge's roots, denied paths, and mode in force for each inner call.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables an agent to interact with any remote MCP server through a single run(code) tool, executing short JavaScript scripts that call server tools, filter results, and return only the needed answer.MIT
- AlicenseNot gradedqualityBmaintenanceEnables any MCP client to execute JavaScript with shell, file, search, and MCP helpers in a single tool call, returning only the code's result to reduce token usage and model turns.65 npm1MIT