Install, update or remove toolscript-mcp from npm and connect it to Claude Code. Use also to switch from a GitHub clone, add a downstream server, set the policy, enable the Claude Code bridge, or log in with OAuth. Use /toolscript:start for a first run and /toolscript:doctor for a setup check. Use /toolscript:workspace for the built-in Workspace.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/yeeyon-setup)
---
name: setup
description: Install, update or remove toolscript-mcp from npm and connect it to Claude Code. Use also to switch from a GitHub clone, add a downstream server, set the policy, enable the Claude Code bridge, or log in with OAuth. Use /toolscript:start for a first run and /toolscript:doctor for a setup check. Use /toolscript:workspace for the built-in Workspace.
argument-hint: "[install|update|add|login|policy|native|uninstall]"
---
# toolscript-mcp setup
toolscript-mcp is an MCP server for code mode. The model writes one JavaScript program that calls the tools of other
MCP servers in a sandbox. This skill sets it up from npm and connects it to Claude Code.
## Rules
- Before a step that writes or deletes a file, installs packages or changes the Claude Code config, show the command
and ask the person.
- Never read, print or edit the toolscript-mcp config file, and never run `init --dry-run`. Both show the env and
header values of the servers. Use `config.mjs` to show and change the config.
- Never edit the config file of a client. Show the lines to change. Change Claude Code only with `claude mcp`
commands that the person approves.
- Write each path in full, with forward slashes, also on Windows. Put each path in double quotes. Some shells and
`claude mcp add` do not expand `~`.
- If a command fails, show its output and stop. Do not change a step to work around the failure.
The names in the commands:
- `<config>` is the toolscript-mcp config file.
- `<scope>` is `user` for a new entry, or `user` or `local` from the existing entry.
## 1. Find the state
Run `claude mcp get toolscript`. In each path of its arguments, write each `\` as `/`.
- If the entry is in the project scope, ask the person to change it in an editor and stop. The project can share this file.
- The standard npm command is `npx -y toolscript-mcp`, or `cmd /c npx -y toolscript-mcp` on Windows.
- If the package has a numeric version pin, keep that version in the npm commands below except in step 3.
- If it uses a clone, keep its config path and scope. Use step 5 to switch the launch command.
- If its arguments hold `--config`, the next argument is `<config>`. Otherwise, use the entry's `TOOLSCRIPT_CONFIG` if it sets one.
- If no config path is set, run `node "${CLAUDE_SKILL_DIR}/config.mjs" path`, and use the path it prints.
- If the config path holds `$`, a backtick, `"`, `%`, `!`, a curly quote or a long dash, stop. Ask the person to register the path in an editor.
- Do not repeat environment values from the existing entry.
Go to the step for the request of the person. For a first run, or a setup that must survive a restart of Claude Code,
run `npx -y toolscript-mcp onboard` (package 1.1.0 or later): it prints the next step, and `/toolscript:start` checks the
restart. For a check of the last run, do step 6. For `native`, do
step 8. With no request, do steps 2 to 6, then offer step 8.
## 2. Check Node and npm
Run `node --version` and `npm --version`.
- If Node is older than 22.13 or missing, stop. Tell the person to install Node 22.13 or later.
- If npm is missing, stop. Tell the person to install npm.
## 3. Install or update
With approval, run `npx -y toolscript-mcp@latest --help`. npm fetches the published package if it needs a copy.
If the entry pins a version, ask the person to update that pin in their entry. Start a new Claude Code session after
an update. The running session keeps the old server.
## 4. Write the config
If step 1 found no `<config>`, run `node "${CLAUDE_SKILL_DIR}/config.mjs" path`. The path that it prints is `<config>`.
Run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>"`.
- If it reads the config, keep it and go to step 5.
- If it cannot read the file, there is no config yet. Continue with this step.
Tell the person that init reads the user-scope MCP servers of Claude Code, Claude Desktop, Cursor and Codex. It writes
`<config>` and does not change the files of the clients. With approval, run:
```sh
npx -y toolscript-mcp init --config "<config>"
```
init prints the servers that it imported and the servers that it left out, with no secret values. Show this list to
the person. If init found no server, it writes nothing. `/toolscript:start` then offers the demo server, and step 9
adds other servers.
init sets `"untrusted": true` on each server that names Azure DevOps, and its report names them. If the person has an
Azure DevOps server that the report does not name, mark it as the end of step 9 shows.
init also prints the steps for each client. Do not run its `claude mcp add` line: step 5 adds toolscript-mcp to
Claude Code.
Show the person the servers to remove from each client. For Claude Code, offer to run the ready commands under the
label of each server. A ready command is a line that init printed, indented by 4 spaces, that starts with `node `,
`npx `, `claude ` or `pushd `. A label starts with `- ` after its indent. Never run a label line. Run the ready
commands of one server only after the person agrees. Run a `pushd` line alone first. If it prints an error, show it
and stop: the remove line is then in the wrong folder. Without an error, run all the ready commands of the server in one
shell call, the `pushd` line too, in order, as init printed them. Never type a server name into a command
yourself. For a server without a command, and for the other clients, the person
edits the file that init names.
Recommend one path to each server. If a client also lists a server directly, the model calls the direct tools, and
each full result goes into the context. MCP gives a server no list of the servers of its client. So toolscript-mcp does
not check for a duplicate while it runs. To find the other copies, run `npx -y toolscript-mcp init --list --config "<config>"`.
It shows the servers of every Claude Code scope, and the steps that remove a direct copy.
If the person wants a new import over a config that exists, run init with `--force` after approval. init keeps the old
file as `<config>.bak`, and it lists the servers that the new config leaves out.
## 5. Add toolscript-mcp to Claude Code
If the entry uses the standard npm command and the same config, go to the connection check. Keep any version pin.
On Windows, a path with `/` and the same path with `\` are the same path.
To switch from a clone, keep the existing config and scope. If the entry sets environment variables, ask the person
to change the command and arguments in an editor so those values stay. If the config uses files inside the clone,
keep those files or update their paths first. For an entry with no environment variables, ask to run
`claude mcp remove toolscript --scope <scope>` before you add the new entry.
For a different existing launch command, ask the person to update it in an editor and confirm the config path.
For a new entry or after removal, run this command with approval:
```sh
claude mcp add --scope <scope> toolscript '--' npx -y toolscript-mcp --config "<config>"
```
On Windows, run this in PowerShell:
```powershell
claude mcp add --scope <scope> toolscript '--' cmd /c npx -y toolscript-mcp --config "<config>"
```
Keep the quotes around `--`. PowerShell drops a bare `--` before it starts `claude`.
Check the connection with `claude mcp get toolscript`. It must show `Connected`.
For Claude Desktop and Cursor, show the entry for `mcpServers`. The person adds it:
```json
"toolscript": { "command": "npx", "args": ["-y", "toolscript-mcp", "--config", "<config>"] }
```
On Windows, use `"command": "cmd"` and put `"/c", "npx"` at the start of the arguments.
Tell the person to start a new Claude Code session, so the session gets `search_tools` and `run_code`.
## 6. First run
The skill `start` of this plugin guides the first run. Tell the person to run `/toolscript:start`. It picks a server
or the demo server, shows its tools, sets a starter policy and checks one `run_code` task.
## 7. Choose the policy
Run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>"`. It shows the servers and the policy, and no secret.
Each tool call of a program goes through the policy. A tool name is `mcp__<server>__<tool>`. The first rule whose
`match` glob fits the name decides. A tool that no rule matches is `ask`.
Explain these choices, and ask the person to choose one:
1. Ask for each tool. This is the empty policy that init writes. toolscript-mcp asks the person before a program
calls a tool. If the client cannot ask, the run does not start, and the result names the `allow` rule to add.
2. Allow all tools, with `deny` rules first. Use it when the client checks each `run_code` call itself, such as
Claude Code in auto mode. Add a `deny` rule for each tool that must never run. Tell the person that the permission
rules and hooks of Claude Code do not apply to the nested calls. The policy matches tool names only, not arguments.
3. Allow specific tools. Allow the tools that programs use often, such as read tools. Other tools stay `ask`. Do not
guess a name prefix such as `get_*`: a read tool can have another name, such as `issue_read` or
`alerting_rules_read`, and then it still asks. Run `npx -y toolscript-mcp tools --config "<config>" -- <server>` for each
server. If it says that the server needs an OAuth login, do step 10 first. It shows each tool with its hint and the
action of the policy, and it ends with `Commands that allow tools:`. Show the person the tools that ask, and let
them choose. For each chosen tool, run the ready command under its label. It writes nothing: it shows the new
policy and a command with `--apply`. Show the output, and with approval run that `--apply` command exactly as
printed. Do not use the label `every read-only tool above with a command`: it allows more tools than the person
chose. A tool with `a person each run` still asks under an allow rule.
The `policy` command replaces the policy with the rules in order. Each rule is an action and a match that starts with
`mcp__` or `*`. Use it for choice 2, or to write a rule that `allow` cannot:
```sh
node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" policy
node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" policy deny "mcp__<server>__*delete*" allow "*"
```
Ask the person for the rules, and run the command with approval. Show the policy that it prints.
An `allow` rule for more than one server, such as `allow "*"`, does not allow a tool of `claude-code`. toolscript-mcp
asks the person for such a tool. Only an `allow` rule that starts with `mcp__claude-code__` allows it, such as
`allow "mcp__claude-code__Read"`. To allow all tools of Claude Code, the person gives `allow "mcp__claude-code__*"`.
The same rule applies to a stdio server under another key that runs Claude Code with `mcp serve`. Any words can come
between the Claude Code word, `mcp` and `serve`, and shell operators such as `&&` or `;` split words. The Claude Code word is one of these:
- `claude`, `claude.exe`, `claude.cmd` or `claude.ps1`, alone or at the end of a path.
- `@anthropic-ai/claude-code`, also with `@<version>`.
- A path that ends in `claude-code/cli.js`.
A launcher such as `cmd /c`, `bash -lc`, `pwsh -Command` or `npx -y` can come first. Use the key
`claude-code` for any other launch (an HTTP proxy, a wrapper script).
Never allow a tool that can write the config file, such as a file server with access to its folder. A program can call
that tool to change its own policy.
If toolscript-mcp runs, it reads the policy again at each run. A new `deny` rule applies at once. A looser policy
applies after the person approves it in a prompt, or after a restart of toolscript-mcp.
## 8. Use the tools of Claude Code in programs
With this step, programs call the Read, Grep, Glob, Edit and Bash or PowerShell tools of Claude Code. toolscript-mcp starts
`claude mcp serve` as the server `claude-code`.
1. Find the `claude` executable. Its path is `<claude>`.
- On Windows, run `where.exe claude`. Use the first line that ends in `claude.exe`. Never use `claude.ps1` or
`claude.cmd`. If no line ends in `claude.exe`, stop, and tell the person that this step needs `claude.exe`.
- On Linux and macOS, run `command -v claude`, and use the path that it prints.
2. Ask for the project folder `<project>`. Propose the folder of the current project. Bash commands start there, and
Grep and Glob search there.
3. Tell the person these risks, and ask whether to continue:
- The permission rules and hooks of Claude Code do not apply on this path. The toolscript-mcp policy is the only
check.
- The policy matches tool names only. If the person approves `Bash` for a run, each Bash command of that program
runs.
- Bash, PowerShell, Edit and Write run as the person. They reach files outside `<project>`, also `<config>`.
- If a hook or a permission rule guards a tool, use the native tool of Claude Code for that work.
- See [Claude Code as a downstream server](https://github.com/yeeyon/toolscript-mcp#claude-code-as-a-downstream-server).
4. With approval, put these rules first in the policy. They allow Read, Grep and Glob, ask for the tools that change
something, and deny the other tools of Claude Code:
```sh
node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" prepend allow "mcp__claude-code__Read" allow "mcp__claude-code__Grep" allow "mcp__claude-code__Glob" ask "mcp__claude-code__Bash" ask "mcp__claude-code__PowerShell" ask "mcp__claude-code__Edit" ask "mcp__claude-code__Write" deny "mcp__claude-code__*"
```
If the person does not approve, skip this item. Without these rules, only a rule that starts with
`mcp__claude-code__` allows a tool of Claude Code. An `allow "*"` rule does not allow it.
`prepend` keeps the other rules of the person after these rules. It removes an old rule with the same match. If
the policy has such a rule with another action, tell the person before you run the command. Show the policy that
it prints. Never allow Bash, PowerShell, Edit or Write. They can change `<config>`, and so the policy.
5. Run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>"`. If it lists `claude-code`, the server exists. Go to item 7.
6. Run `node -p "require('os').tmpdir()"`. With approval, write this entry to `<tmp>/toolscript-entry.json`:
```json
{ "command": "<claude>", "args": ["mcp", "serve"], "cwd": "<project>" }
```
Then run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" add claude-code "<tmp>/toolscript-entry.json"`, and
delete the entry file.
7. Tell the person to start a new Claude Code session. toolscript-mcp starts its servers only at its own start.
## 9. Add a server
1. Ask for the server name. A name has letters, digits and hyphens, with single underscores between them.
2. Ask for the command and arguments of a stdio server, or the URL of an HTTP server.
3. Never ask for a secret value. Write `${NAME}` in its place. toolscript-mcp reads `NAME` from its environment.
4. Run `node -p "require('os').tmpdir()"`. With approval, write the entry to `<tmp>/toolscript-entry.json`:
- stdio: `{ "command": "npx", "args": ["-y", "<package>"], "env": { "API_KEY": "${API_KEY}" } }`
- stdio that works in one project folder: also add `"cwd": "<folder>"`, with the full path of the folder.
- HTTP: `{ "type": "http", "url": "https://mcp.example.com/mcp" }`
- The Azure DevOps MCP server (`@azure-devops/mcp`, or a URL on `mcp.dev.azure.com`): also add
`"untrusted": true`. Then each of its results reaches the model as untrusted text.
5. Run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" add <name> "<tmp>/toolscript-entry.json"`. It makes `<config>` if it does not exist.
Then delete the entry file.
Then run `npx -y toolscript-mcp init --list --config "<config>"`. If a client still has the same server, it is under
`Steps that remove a direct copy`. Step 4 tells why it matters.
- For the user or local scope, offer the ready commands under its label, as step 4 runs them. Never type the
name into a command yourself.
- For the project scope, tell the person that `.mcp.json` of the project holds the server. Other people can share
that file, so the person decides.
6. Tell the person to set each variable in the environment of the client, or to put the value in `<config>` in an
editor.
7. Tell the person to start a new Claude Code session. toolscript-mcp reads the servers only at its start.
An HTTP server without `headers` logs in with OAuth. Go to step 10 for it.
An Azure DevOps MCP server in `<config>` needs `"untrusted": true`. `config.mjs` shows `untrusted` at the end of the
line of such a server. init misses a server whose name, command, arguments and URL do not name Azure DevOps, such as
a local proxy. If the line of an Azure DevOps server has no `untrusted`, run this command with approval:
```sh
node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" untrusted <name>
```
Then tell the person to start a new Claude Code session. `untrusted <name> false` removes the key.
To make every session use one copy of a stdio server (the share switch must be on), run this command with approval:
```sh
node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>" share <name>
```
It sets `"share": true` on the server. `share <name> false` removes the key. It prints no secret.
## 10. Log in to an OAuth server
init lists the HTTP servers without headers, and `config.mjs` marks them `oauth`. For each one, give the person
this command:
```sh
npx -y toolscript-mcp login --config "<config>" -- <server>
```
The `--` keeps a server name that starts with `-` a name.
The person runs it. Do not run it yourself. A browser opens, and login waits 5 minutes for the approval. In Claude
Code, the person can type the command after the `!` prefix.
If `search_tools` later says that a server needs a login, give the person the command that it prints.
## 11. Uninstall
Ask before each step:
1. Run `node "${CLAUDE_SKILL_DIR}/config.mjs" "<config>"`. It shows the server names. The full entries stay in `<config>`. Tell the person to
copy the entries that they want back to their clients from `<config>` in an editor.
2. Run `claude mcp remove toolscript --scope <scope>`.
3. If the person also asks to remove saved settings, delete `<config>` and `<config>.bak`.
4. `<home>/.toolscript-mcp` holds OAuth tokens, logs, program files and the optional demo package. Delete it only on request.
5. To remove this plugin, the person runs `/plugin uninstall toolscript@toolscript-mcp`, then
`/plugin marketplace remove toolscript-mcp`.
## What stays on this computer
Tell the person these facts at the end of an install:
- The config, with the env and header values of the servers, stays in `<config>`. This skill never reads it.
- OAuth tokens stay in `<home>/.toolscript-mcp/oauth/`. The run log in `<home>/.toolscript-mcp/runs.jsonl` has
no arguments and no results.
- toolscript-mcp sends tool calls only to the servers in the config. The model gets the search results and the return
value of each program.
- [SECURITY.md](https://github.com/yeeyon/toolscript-mcp/blob/main/SECURITY.md) describes the sandbox and its limits.