npx claudepluginhub mKeRix/toolscriptExecute TypeScript code that calls MCP tools with full type safety
Share bugs, ideas, or general feedback.
Token-efficient tool usage via MCP Code Mode: Execute TypeScript code that calls MCP tools with full type safety.
Toolscript is a lightweight CLI tool and Claude Code plugin that enables LLMs to write TypeScript code calling MCP (Model Context Protocol) tools. It provides automatic type generation, sandboxed execution, and seamless Claude Code integration.
The idea of using MCP tools as code instead of direct LLM calls was described in popular blog posts from Anthropic and CloudFlare. The main problems with the current protocol implementations are:
Toolscript solves these issues by:
The goal of the project is to enable agents to be more cost-efficient and accurate at complex tasks.
Toolscript requires the following to be available on the machine it is run on:
The Toolscript CLI can be installed and upgraded from JSR:
deno install --global --allow-net --allow-read --allow-write --allow-env --allow-run --allow-sys --allow-ffi --unstable-webgpu -r -f --name toolscript jsr:@toolscript/cli
To install the matching Claude Code plugin, open claude and type:
/plugin marketplace add mKeRix/toolscript
/plugin install toolscript@toolscript
Finally, restart Claude Code to activate the plugin.
There are no special integrations for other agentic tools available yet, but as a CLI Toolscript can be used by any agent that has shell access.
To do so, please ensure that a gateway is running on your machine (via toolscript gateway start) and then instruct your agent (via system prompt, plugins etc.) how to find and use tools.
You can take inspiration from the Claude Code skill definition to do so.
You can create .toolscript.json files on two levels to configure the servers it will load, which are merged together into the configuration that will be used. If a server name appears in multiple files, the latest definition wins.
~/.toolscript.json - user-level configuration for servers that you want to have enabled across all projects you are working on.toolscript.json - project-level configuration for servers that are specific to a single repository or should be shared with your team via the repositoryThe Toolscript config format resembles the MCP configuration found in Claude Code to make porting between the tools easier. An example config can be found below:
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
"env": {
"LOG_LEVEL": "debug"
},
"includeTools": ["read_file", "write_file"],
"excludeTools": ["delete_file"]
},
"web-search": {
"type": "http",
"url": "http://localhost:3000",
"headers": {
"Authorization": "Bearer ${SEARCH_API_KEY:-default-key}"
}
},
"github": {
"type": "sse",
"url": "https://api.example.com/github",
"headers": {
"Authorization": "Bearer ${GITHUB_TOKEN}"
}
}
}
}