toolscript-mcp 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -61
- package/dist/host/main.js +26 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@ servers in a sandbox. The program filters and joins the data there. Only the res
|
|
|
5
5
|
|
|
6
6
|
The goal is a server that works with any MCP client, for example Claude Code, Claude Desktop, Cursor and Codex.
|
|
7
7
|
|
|
8
|
-
> **
|
|
9
|
-
> [
|
|
8
|
+
> **Install from npm.** Set it up [from npm](#from-npm) with `npx -y toolscript-mcp init`. Read
|
|
9
|
+
> [Limits](#limits) before you use it.
|
|
10
10
|
|
|
11
11
|
- [Features](#features)
|
|
12
12
|
- [Measured](#measured)
|
|
@@ -66,7 +66,7 @@ It uses Sonnet 5.5 on Windows 11, with 6 tasks and 3 runs per task and arm. All
|
|
|
66
66
|
| Mean seconds per task | 12.7 | 9.9 | 10.6 |
|
|
67
67
|
|
|
68
68
|
The table excludes two cold runs. One slow server start remains in the toolscript-mcp mean.
|
|
69
|
-
These results use commit `49d871f`, fixed fake data and one model. They
|
|
69
|
+
These results use commit `49d871f`, fixed fake data and one model. They cover that commit in Claude Code.
|
|
70
70
|
Read [bench/RESULTS-codemode.md](bench/RESULTS-codemode.md) for the method, cold runs and limits.
|
|
71
71
|
|
|
72
72
|
## How it works
|
|
@@ -100,60 +100,34 @@ The model sees a short list of keys and titles, not every full issue.
|
|
|
100
100
|
|
|
101
101
|
## Install
|
|
102
102
|
|
|
103
|
-
You need Node 22.13 or later and npm.
|
|
103
|
+
You need Node 22.13 or later and npm.
|
|
104
104
|
|
|
105
105
|
### From npm
|
|
106
106
|
|
|
107
|
-
This works once 1.0.0 is published. Until then, use the GitHub clone or the Claude Code plugin below.
|
|
108
|
-
|
|
109
107
|
```sh
|
|
110
108
|
npx -y toolscript-mcp init
|
|
111
109
|
```
|
|
112
110
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
`args = ["-y", "toolscript-mcp", "--config", "/absolute/path/to/config.json"]`. Then follow
|
|
111
|
+
init imports user-scope servers from Claude Code, Claude Desktop and Cursor. It writes a toolscript-mcp config
|
|
112
|
+
and prints the client changes. Use [Client setup](#client-setup) for Codex or a manual setup. Then follow
|
|
116
113
|
[Configure downstream servers](#configure-downstream-servers).
|
|
117
114
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
The `beta` branch points at a commit of `main` that passed every test. Clone it once, and `npm ci` builds `dist/`:
|
|
121
|
-
|
|
122
|
-
```sh
|
|
123
|
-
git clone --branch beta https://github.com/yeeyon/toolscript-mcp.git ~/toolscript-mcp
|
|
124
|
-
cd ~/toolscript-mcp
|
|
125
|
-
npm ci
|
|
126
|
-
node dist/host/main.js init
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
init imports the user-scope servers of Claude Code, Claude Desktop and Cursor. It writes a toolscript-mcp config
|
|
130
|
-
and prints the client changes. It does not edit your client files. It does not import Codex configs.
|
|
131
|
-
See [init](#init) for the options.
|
|
132
|
-
|
|
133
|
-
Next, follow [Client setup](#client-setup) and [Configure downstream servers](#configure-downstream-servers).
|
|
134
|
-
Use an absolute path to `dist/host/main.js` in your client.
|
|
115
|
+
To update, run `npx -y toolscript-mcp@latest --help` and restart your client. If your client entry pins a version,
|
|
116
|
+
change the version in that entry before you restart.
|
|
135
117
|
|
|
136
|
-
|
|
118
|
+
#### Move an existing clone setup to npm
|
|
137
119
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Then start a new session of your client. Do not start the server with `npx github:…` in a client.
|
|
145
|
-
In a measured start, the GitHub check of npx added about 12 seconds.
|
|
120
|
+
1. Find the config path in the existing client entry. If it uses the default path, keep that default.
|
|
121
|
+
2. Replace the client entry's command and arguments. Keep the same config path and any environment variables. Use
|
|
122
|
+
[Client setup](#client-setup).
|
|
123
|
+
3. Restart the client and run a task through toolscript-mcp. Check it with [runs](#check-a-server-and-a-run).
|
|
146
124
|
|
|
147
|
-
The
|
|
148
|
-
|
|
149
|
-
they start with `npx -y toolscript-mcp`. On Windows, each path in them has forward slashes. So the login command
|
|
150
|
-
works in cmd.exe, PowerShell and Git Bash. Run the Claude Code step of an npm install in PowerShell or cmd.exe. Run
|
|
151
|
-
`node dist/host/main.js --help` to see the usage.
|
|
125
|
+
The config keeps your servers and policy. The same user account also keeps its saved OAuth tokens.
|
|
126
|
+
If an entry uses a file inside the clone, keep that file or update its path first.
|
|
152
127
|
|
|
153
128
|
#### With the Claude Code plugin
|
|
154
129
|
|
|
155
|
-
This repo is also a Claude Code plugin marketplace. Its plugin `toolscript`
|
|
156
|
-
Claude Code, run:
|
|
130
|
+
This repo is also a Claude Code plugin marketplace. Its plugin `toolscript` guides the npm setup. In Claude Code, run:
|
|
157
131
|
|
|
158
132
|
```text
|
|
159
133
|
/plugin marketplace add yeeyon/toolscript-mcp
|
|
@@ -163,7 +137,7 @@ Claude Code, run:
|
|
|
163
137
|
Then run `/toolscript:setup`, or ask Claude to set up toolscript-mcp. The skill asks you before each step that changes
|
|
164
138
|
something:
|
|
165
139
|
|
|
166
|
-
1. It checks Node and
|
|
140
|
+
1. It checks Node and npm, then checks that the published package starts.
|
|
167
141
|
2. It runs `init` when you agree, and shows the servers that init imported.
|
|
168
142
|
3. It adds toolscript-mcp to Claude Code with `claude mcp add`.
|
|
169
143
|
4. It sends you to `/toolscript:start` for the first run. See the list below.
|
|
@@ -181,25 +155,25 @@ something:
|
|
|
181
155
|
6. After a run works, the skill offers to remove the direct copy of the server from Claude Code. It shows the scope of the copy first.
|
|
182
156
|
|
|
183
157
|
`/toolscript:doctor` checks the whole setup and changes no setting. It runs [doctor](#doctor), then checks the Claude
|
|
184
|
-
Code registration
|
|
158
|
+
Code registration and the direct copies of your servers. For each problem, it names the step that fixes it.
|
|
185
159
|
|
|
186
160
|
The skills do not edit the config files of your clients. They show the lines to change. To update or uninstall
|
|
187
161
|
toolscript-mcp, ask Claude again.
|
|
188
162
|
|
|
189
163
|
### Client setup
|
|
190
164
|
|
|
191
|
-
Replace
|
|
165
|
+
Replace the example config path with your absolute config path. Use the server name `toolscript`.
|
|
192
166
|
|
|
193
167
|
Claude Code on Linux and macOS:
|
|
194
168
|
|
|
195
169
|
```sh
|
|
196
|
-
claude mcp add --scope user toolscript '--'
|
|
170
|
+
claude mcp add --scope user toolscript '--' npx -y toolscript-mcp --config "/absolute/path/to/config.json"
|
|
197
171
|
```
|
|
198
172
|
|
|
199
173
|
Claude Code on Windows, in PowerShell:
|
|
200
174
|
|
|
201
175
|
```powershell
|
|
202
|
-
claude mcp add --scope user toolscript '--'
|
|
176
|
+
claude mcp add --scope user toolscript '--' cmd /c npx -y toolscript-mcp --config "C:/tools/toolscript-config.json"
|
|
203
177
|
```
|
|
204
178
|
|
|
205
179
|
Keep the quotes around `'--'`. The PowerShell `claude.ps1` shim drops a bare `--`, so it can misread `--config`.
|
|
@@ -210,8 +184,8 @@ Claude Desktop (`claude_desktop_config.json`) and Cursor (`~/.cursor/mcp.json`):
|
|
|
210
184
|
{
|
|
211
185
|
"mcpServers": {
|
|
212
186
|
"toolscript": {
|
|
213
|
-
"command": "
|
|
214
|
-
"args": ["
|
|
187
|
+
"command": "npx",
|
|
188
|
+
"args": ["-y", "toolscript-mcp", "--config", "/absolute/path/to/config.json"]
|
|
215
189
|
}
|
|
216
190
|
}
|
|
217
191
|
}
|
|
@@ -221,8 +195,8 @@ Codex (`~/.codex/config.toml`):
|
|
|
221
195
|
|
|
222
196
|
```toml
|
|
223
197
|
[mcp_servers.toolscript]
|
|
224
|
-
command = "
|
|
225
|
-
args = ["
|
|
198
|
+
command = "npx"
|
|
199
|
+
args = ["-y", "toolscript-mcp", "--config", "/absolute/path/to/config.json"]
|
|
226
200
|
default_tools_approval_mode = "approve"
|
|
227
201
|
```
|
|
228
202
|
|
|
@@ -231,7 +205,8 @@ toolscript-mcp still checks its own policy on each call of a program.
|
|
|
231
205
|
In a test on Windows, Codex started toolscript-mcp in the folder where `codex exec` ran. A downstream server with
|
|
232
206
|
no `cwd` in its entry starts in that folder too.
|
|
233
207
|
|
|
234
|
-
On Windows,
|
|
208
|
+
On Windows, set the command to `cmd` and put `"/c", "npx"` at the start of the arguments in JSON and TOML.
|
|
209
|
+
Use a config path such as `C:/tools/toolscript-config.json`.
|
|
235
210
|
If you put the config file in the default place, you can omit `--config` and its path.
|
|
236
211
|
See [The config file](#the-config-file).
|
|
237
212
|
|
|
@@ -284,12 +259,13 @@ npm ci
|
|
|
284
259
|
npm run build
|
|
285
260
|
```
|
|
286
261
|
|
|
287
|
-
|
|
262
|
+
For a development session, use `node` as the client command. Replace the npm arguments with
|
|
263
|
+
`["/absolute/path/to/toolscript-mcp/dist/host/main.js", "--config", "/absolute/path/to/config.json"]`.
|
|
288
264
|
|
|
289
265
|
### init
|
|
290
266
|
|
|
291
|
-
- `
|
|
292
|
-
|
|
267
|
+
- `npx -y toolscript-mcp init` imports the user-scope servers of Claude Code, Claude Desktop and Cursor.
|
|
268
|
+
To add servers from a project, use `--list` and `--add` below.
|
|
293
269
|
- If two clients have a server with the same name, init keeps the first one. The order is Claude Code, Claude
|
|
294
270
|
Desktop, Cursor.
|
|
295
271
|
- init does not import an SSE server, a disabled server, or toolscript-mcp itself.
|
|
@@ -515,13 +491,19 @@ worked. Without `--server`, the run must call a tool of any server. These cases
|
|
|
515
491
|
|
|
516
492
|
#### Demo server
|
|
517
493
|
|
|
518
|
-
`demo/server.mjs` is a read-only MCP server with 40 sample pull requests
|
|
519
|
-
|
|
494
|
+
`demo/server.mjs` is a read-only MCP server with 40 sample pull requests. It needs no account.
|
|
495
|
+
Install the npm package in a folder of your choice to give the demo file a stable path.
|
|
496
|
+
|
|
497
|
+
```sh
|
|
498
|
+
npm install --prefix "/absolute/path/to/demo-package" toolscript-mcp@latest
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
Add the demo file to your config. Replace the example path with your path.
|
|
520
502
|
|
|
521
503
|
```json
|
|
522
504
|
{
|
|
523
505
|
"mcpServers": {
|
|
524
|
-
"demo": { "command": "node", "args": ["/absolute/path/to/toolscript-mcp/demo/server.mjs"] }
|
|
506
|
+
"demo": { "command": "node", "args": ["/absolute/path/to/demo-package/node_modules/toolscript-mcp/demo/server.mjs"] }
|
|
525
507
|
},
|
|
526
508
|
"policy": [{ "match": "mcp__demo__list_pull_requests", "action": "allow" }]
|
|
527
509
|
}
|
|
@@ -876,7 +858,7 @@ The `claude mcp serve` bridge costs about 315 MB of private memory in each sessi
|
|
|
876
858
|
toolscript-mcp logs in to a remote HTTP server with OAuth. You do not need a proxy such as `mcp-remote`.
|
|
877
859
|
|
|
878
860
|
1. Add the server to the config with `"type": "http"` and `url`, without `headers`.
|
|
879
|
-
2. Run `
|
|
861
|
+
2. Run `npx -y toolscript-mcp login <server>`. If your config uses another path, add `--config <path>`.
|
|
880
862
|
3. Log in and approve the access in the browser. If the browser does not open, open the URL that login prints.
|
|
881
863
|
|
|
882
864
|
login waits 5 minutes for the browser and 30 s for the token exchange. Then it connects to the server and prints the
|
|
@@ -1255,11 +1237,11 @@ Code 2.1.325.
|
|
|
1255
1237
|
- [x] Write the docs and add the release workflow.
|
|
1256
1238
|
- [x] Compare toolscript-mcp with Claude Code Code Mode in the bench.
|
|
1257
1239
|
- [x] Log in to remote servers with OAuth.
|
|
1258
|
-
- [x] Offer guided
|
|
1240
|
+
- [x] Offer guided setup through the Claude Code plugin.
|
|
1259
1241
|
- [x] Run Claude Code tools through the optional stdio bridge, with a project `cwd`.
|
|
1260
1242
|
- [x] Require per-run approval for tools marked for user interaction.
|
|
1261
1243
|
- [x] Keep images and other non-text results as files, and show the images that a program returns.
|
|
1262
|
-
- [
|
|
1244
|
+
- [x] Publish 1.0.0 to npm.
|
|
1263
1245
|
- [ ] Run the Codex comparison and publish its results.
|
|
1264
1246
|
- [ ] Keep state between `run_code` calls, as an option.
|
|
1265
1247
|
- [ ] Serve hint files and saved functions as tools.
|
package/dist/host/main.js
CHANGED
|
@@ -17294,6 +17294,7 @@ var rankTools = (tools, query, limit) => {
|
|
|
17294
17294
|
} else if (short.includes(word)) hit = 3;
|
|
17295
17295
|
else if (word.length >= 4 && joinedIn(segs, word)) hit = 2.5;
|
|
17296
17296
|
else if (ofServer.has(word)) hit = 2;
|
|
17297
|
+
else if (tool.actions?.has(word) && !FILLER.has(word)) hit = 1.5 - 0.01 * Math.min(segs.length, 20);
|
|
17297
17298
|
else if (description.includes(word)) hit = 1;
|
|
17298
17299
|
else if (stem2 !== word && (short.includes(stem2) || description.includes(stem2))) hit = 0.5;
|
|
17299
17300
|
else if (stem2 !== word && stem2.length >= 4 && joinedIn(segs, stem2)) hit = 0.5;
|
|
@@ -18736,9 +18737,33 @@ var namesByServer = (all, cap = NAMES_CAP) => {
|
|
|
18736
18737
|
return `mcp__${s.key}__: ${s.names.slice(0, s.shown).join(", ")}${more > 0 ? ` (+${more} more)` : ""}`;
|
|
18737
18738
|
});
|
|
18738
18739
|
};
|
|
18740
|
+
var ACTION_PROPERTIES = ["action", "method", "operation"];
|
|
18741
|
+
var MAX_ACTION_VALUE = 40;
|
|
18742
|
+
var MAX_ACTION_WORDS = 50;
|
|
18743
|
+
var actionWords = (inputSchema) => {
|
|
18744
|
+
const words2 = /* @__PURE__ */ new Set();
|
|
18745
|
+
if (!isObject3(inputSchema) || !Object.hasOwn(inputSchema, "properties")) return words2;
|
|
18746
|
+
const properties = inputSchema.properties;
|
|
18747
|
+
if (!isObject3(properties)) return words2;
|
|
18748
|
+
for (const key of ACTION_PROPERTIES) {
|
|
18749
|
+
const property = Object.hasOwn(properties, key) ? properties[key] : void 0;
|
|
18750
|
+
if (!isObject3(property) || !Array.isArray(property.enum)) continue;
|
|
18751
|
+
for (let i = 0; i < property.enum.length && i < MAX_ENUM; i++) {
|
|
18752
|
+
const value = property.enum[i];
|
|
18753
|
+
if (typeof value !== "string" || value.length > MAX_ACTION_VALUE) continue;
|
|
18754
|
+
for (const word of value.toLowerCase().split(/[^a-z0-9]+/))
|
|
18755
|
+
if (word !== "" && words2.size < MAX_ACTION_WORDS) words2.add(word);
|
|
18756
|
+
}
|
|
18757
|
+
}
|
|
18758
|
+
return words2;
|
|
18759
|
+
};
|
|
18739
18760
|
var searchResult = (states, query, limit, shapes = /* @__PURE__ */ new Map(), canAsk = true) => {
|
|
18740
18761
|
const all = catalogOf(states);
|
|
18741
|
-
const found = rankTools(
|
|
18762
|
+
const found = rankTools(
|
|
18763
|
+
all.map((t) => ({ ...t, actions: actionWords(t.inputSchema) })),
|
|
18764
|
+
query,
|
|
18765
|
+
limit
|
|
18766
|
+
);
|
|
18742
18767
|
const tail = notConnectedText(states);
|
|
18743
18768
|
if (found.length === 0) {
|
|
18744
18769
|
const shown = query.length > ECHO_MAX ? `${query.slice(0, ECHO_MAX)}... (${query.length} characters)` : query;
|