toolmenu 0.23.0 → 0.25.0

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 CHANGED
@@ -4,6 +4,7 @@
4
4
  [![ci](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml/badge.svg)](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml)
5
5
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/niksa90/toolmenu/blob/main/LICENSE)
6
6
  [![MCP: 2026-07-28 and 2025](https://img.shields.io/badge/MCP-2026--07--28%20%C2%B7%202025-6E56CF)](https://modelcontextprotocol.io)
7
+ [![toolmenu](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fniksa90%2Ftoolmenu%2Fmain%2Fdocs%2Ftoolmenu-badge.json)](https://github.com/niksa90/toolmenu)
7
8
 
8
9
  **Checks for MCP servers' tool lists: changes that confuse agents, break prompt caches or break clients, caught before your users hit them.**
9
10
 
@@ -36,7 +37,7 @@ It runs on the 22-server [bench](bench/README.md) and on hosted servers (GitHub,
36
37
  Notion, Supabase, Vercel…). What it has found on real servers is in
37
38
  [docs/FINDINGS.md](https://github.com/niksa90/toolmenu/blob/main/docs/FINDINGS.md).
38
39
 
39
- > **Status: 0.23.** Spec in [docs/SPEC.md](https://github.com/niksa90/toolmenu/blob/main/docs/SPEC.md),
40
+ > **Status: 0.25.** Spec in [docs/SPEC.md](https://github.com/niksa90/toolmenu/blob/main/docs/SPEC.md),
40
41
  > every rule in [docs/RULES.md](docs/RULES.md), changes in [CHANGELOG.md](CHANGELOG.md).
41
42
 
42
43
  <details>
@@ -160,6 +161,34 @@ makes the exit code 2, because it wasn't checked; one marked `disabled` is liste
160
161
  left alone. URLs are printed without their query, which can hold a key. Nothing is
161
162
  written unless `--out-dir` names a folder for each server's menu file.
162
163
 
164
+ ## For the agent building your server: `mcp`
165
+
166
+ `toolmenu mcp` is toolmenu as an MCP server (stdio), so Claude Code, Cursor or any
167
+ other client can check the server it's working on while it works. In Claude Code, as a
168
+ plugin (the server, and skills for checking a change, checking a release, and setting up CI):
169
+
170
+ ```
171
+ /plugin marketplace add niksa90/toolmenu
172
+ /plugin install toolmenu@toolmenu
173
+ ```
174
+
175
+ Or just the server, in any client: `claude mcp add toolmenu -- npx -y toolmenu mcp`, or
176
+ `{"command": "npx", "args": ["-y", "toolmenu", "mcp"]}` in an `mcpServers` config.
177
+
178
+ | Tool | Runs |
179
+ |---|---|
180
+ | `snapshot_menu` | `snapshot`: findings and token cost; writes the menu file only with `save_as` |
181
+ | `diff_menus` | `diff`: breaking changes, the token change and the version bump between two menu files |
182
+ | `check_session` | `session --auto`: calls the read-only tools and reports each menu change |
183
+ | `explain_rule` | `explain`: what a rule checks and how to change its level |
184
+
185
+ Each tool runs the CLI in a child process and returns its text report, so options,
186
+ `toolmenu.config.json` and stored OAuth logins work as they do on the command line.
187
+ Relative paths resolve from the folder `toolmenu mcp` runs in, or a call's `cwd`.
188
+ `snapshot_menu` and `check_session` start the command you give them, as the CLI does;
189
+ clients ask before each tool call unless you allow it. toolmenu's own menu passes its
190
+ checks with no findings, on both protocols and in a session (the test suite checks).
191
+
163
192
  ## In CI: one PR comment
164
193
 
165
194
  ```yaml
@@ -176,7 +205,7 @@ jobs:
176
205
  - uses: actions/setup-node@v7
177
206
  with: { node-version: 22 }
178
207
  - run: npm ci && npm run build
179
- - uses: niksa90/toolmenu@v0.16.1
208
+ - uses: niksa90/toolmenu@v0.25.0
180
209
  with:
181
210
  command: node dist/server.js
182
211
  baseline: menu.json # your committed snapshot
@@ -201,8 +230,55 @@ and anything `session` caught. The same report goes to the job summary.
201
230
  | `release` | `auto` | Release versions for the bump check. `auto` reads `package.json`, `pyproject.toml` or `Cargo.toml` on the base branch and the head, or compares the tag with the previous one on a tag push. Set `"1.4.0..1.5.0"` yourself, or `off` |
202
231
  | `fail-on` | `error` | Fail the job on findings at or above this level |
203
232
  | `comment` | `true` | Post and update the PR comment |
233
+ | `sarif` | | A folder to also write the findings to as SARIF, for code scanning (below) |
204
234
  | `version` | the Action's own | toolmenu version from npm: by default the one matching the Action tag you pinned (`latest` for the newest). The Action installs toolmenu from npm, so it needs a published version |
205
235
 
236
+ ### In the Security tab: code scanning
237
+
238
+ With `sarif`, findings also go to GitHub code scanning: alerts in the Security tab,
239
+ each on the line of its tool in your `menu.json`, and a code scanning check on the pull
240
+ request. GitHub shows an alert inline in the pull request only when that line changed in
241
+ it, so most stay in the Security tab and the check. Run the workflow on pushes to your
242
+ default branch too, so GitHub has a base to compare a pull request's alerts with. Code scanning is free for public repositories; private ones need GitHub Advanced
243
+ Security.
244
+
245
+ ```yaml
246
+ on:
247
+ pull_request:
248
+ push:
249
+ branches: [main] # the base GitHub compares a pull request's alerts with
250
+ permissions:
251
+ contents: read
252
+ pull-requests: write
253
+ security-events: write # to upload SARIF
254
+ steps:
255
+ # … checkout, build, as above
256
+ - uses: niksa90/toolmenu@v0.25.0
257
+ with:
258
+ command: node dist/server.js
259
+ sarif: toolmenu-sarif
260
+ - uses: github/codeql-action/upload-sarif@v4
261
+ if: always() # findings fail the toolmenu step; upload them anyway
262
+ with:
263
+ sarif_file: toolmenu-sarif
264
+ ```
265
+
266
+ Outside the Action: `toolmenu snapshot --sarif toolmenu.sarif -- node dist/server.js`
267
+ writes the file beside the usual report (`diff` and `session` take `--sarif` too), or
268
+ `--format sarif` prints it instead.
269
+
270
+ ### A badge for your README
271
+
272
+ ```sh
273
+ npx toolmenu snapshot --badge toolmenu-badge.json -- node dist/server.js
274
+ ```
275
+
276
+ writes a [shields.io endpoint](https://shields.io/badges/endpoint-badge) file (tools,
277
+ tokens, and errors or warnings, in red, yellow or green) and prints the README line
278
+ for it. Commit it with `menu.json`: it changes when the baseline does, so nothing
279
+ has to commit from CI. The badge at the top of this README is toolmenu's own MCP
280
+ server (`toolmenu mcp`), checked by itself.
281
+
206
282
  Server behind auth, or PRs from forks and Dependabot? See [docs/github-action.md](https://github.com/niksa90/toolmenu/blob/main/docs/github-action.md).
207
283
  Server that unlocks tools on request? Snapshot the full menu for the baseline and run the session on the default one: [servers that unlock tools](https://github.com/niksa90/toolmenu/blob/main/docs/github-action.md#servers-that-unlock-tools).
208
284
  PRs without secrets are skipped, and a skipped check still passes; the `skipped` output tells you.
@@ -0,0 +1,20 @@
1
+ import type { Finding, Menu } from './types.js';
2
+ export interface Badge {
3
+ schemaVersion: 1;
4
+ label: string;
5
+ message: string;
6
+ color: string;
7
+ cacheSeconds: number;
8
+ }
9
+ /** "~980", "~4.1K", "~12K": the size people compare, not the exact estimate. */
10
+ export declare function compactTokens(n: number): string;
11
+ /** The endpoint JSON: tools and tokens, and the findings that matter (errors, else warnings). */
12
+ export declare function badge(menu: Menu, findings: Finding[]): Badge;
13
+ /** `owner/repo` of a GitHub remote URL (https or ssh), or undefined. */
14
+ export declare function githubRepo(remote: string): string | undefined;
15
+ /**
16
+ * The README line for a badge file: a shields endpoint badge reading the file from
17
+ * GitHub on the default branch, linking to toolmenu. With no GitHub remote, a
18
+ * template to fill in.
19
+ */
20
+ export declare function badgeMarkdown(badgePath: string, cwd?: string): string;
package/dist/badge.js ADDED
@@ -0,0 +1,59 @@
1
+ /*
2
+ * The README badge: a shields.io endpoint file (https://shields.io/badges/endpoint-badge)
3
+ * that `snapshot --badge <path>` writes beside the menu file. Committed with the
4
+ * baseline, it changes when the baseline does, so no CI has to commit anything:
5
+ * shields reads it from the repository.
6
+ */
7
+ import { execFileSync } from 'node:child_process';
8
+ import { relative, resolve, sep } from 'node:path';
9
+ import { counts } from './report.js';
10
+ import { repoRoot } from './sarif.js';
11
+ /** "~980", "~4.1K", "~12K": the size people compare, not the exact estimate. */
12
+ export function compactTokens(n) {
13
+ if (n < 1000)
14
+ return `~${n}`;
15
+ const k = n / 1000;
16
+ return `~${k < 10 ? k.toFixed(1).replace(/\.0$/, '') : Math.round(k)}K`;
17
+ }
18
+ /** The endpoint JSON: tools and tokens, and the findings that matter (errors, else warnings). */
19
+ export function badge(menu, findings) {
20
+ const c = counts(findings);
21
+ const tools = `${menu.tools.length} tool${menu.tools.length === 1 ? '' : 's'}`;
22
+ const found = c.error ? ` · ${c.error} error${c.error === 1 ? '' : 's'}` : c.warn ? ` · ${c.warn} warning${c.warn === 1 ? '' : 's'}` : '';
23
+ return {
24
+ schemaVersion: 1,
25
+ label: 'toolmenu',
26
+ message: `${tools} · ${compactTokens(menu.totalTokens)} tokens${found}`,
27
+ color: c.error ? 'red' : c.warn ? 'yellow' : 'brightgreen',
28
+ // shields caches for at least 300 s; an hour is plenty for a file that changes with releases.
29
+ cacheSeconds: 3600,
30
+ };
31
+ }
32
+ /** `owner/repo` of a GitHub remote URL (https or ssh), or undefined. */
33
+ export function githubRepo(remote) {
34
+ const m = /github\.com[/:]([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/.exec(remote.trim());
35
+ return m ? `${m[1]}/${m[2]}` : undefined;
36
+ }
37
+ function git(args, cwd) {
38
+ try {
39
+ return execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || undefined;
40
+ }
41
+ catch {
42
+ return undefined;
43
+ }
44
+ }
45
+ /**
46
+ * The README line for a badge file: a shields endpoint badge reading the file from
47
+ * GitHub on the default branch, linking to toolmenu. With no GitHub remote, a
48
+ * template to fill in.
49
+ */
50
+ export function badgeMarkdown(badgePath, cwd = process.cwd()) {
51
+ const root = repoRoot(cwd);
52
+ const path = relative(root, resolve(cwd, badgePath)).split(sep).join('/');
53
+ const repo = githubRepo(git(['remote', 'get-url', 'origin'], cwd) ?? '');
54
+ // origin/HEAD names the default branch when the clone recorded it; else the current one.
55
+ const branch = git(['symbolic-ref', '--short', 'refs/remotes/origin/HEAD'], cwd)?.replace(/^origin\//, '') ?? git(['symbolic-ref', '--short', 'HEAD'], cwd) ?? 'main';
56
+ const raw = `https://raw.githubusercontent.com/${repo ?? '<owner>/<repo>'}/${branch}/${path}`;
57
+ // The badge links to toolmenu: what it is, for whoever clicks it on the README.
58
+ return `[![toolmenu](https://img.shields.io/endpoint?url=${encodeURIComponent(raw)})](https://github.com/niksa90/toolmenu)`;
59
+ }
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export declare function main(argv: string[]): Promise<number>;
2
+ export declare function main(given: string[]): Promise<number>;
package/dist/cli.js CHANGED
@@ -23,7 +23,10 @@ import { autoScenario, loadValuesFile, parseAssumeReadOnly, parseValueFlag, scen
23
23
  import { authDir, listLogins, login, logout } from './auth.js';
24
24
  import { existingMessage, initReport, planInit, shellWord, writeInit } from './init.js';
25
25
  import { SEVERITY_RANK } from './types.js';
26
+ import { toSarif } from './sarif.js';
27
+ import { badge, badgeMarkdown } from './badge.js';
26
28
  import { VERSION } from './version.js';
29
+ import { SECRET_ARGS_ENV } from './mcp-env.js';
27
30
  import { CLI_OPTIONS } from './options.js';
28
31
  import { editDistance } from './words.js';
29
32
  import { formatScan, ListError, loadList, scan, scanExit } from './scan.js';
@@ -31,7 +34,8 @@ import { explain, findRule, formatExplained, listRules, ruleDocs } from './rule-
31
34
  import { commandHelp, commandOptions, isCommand, overview, unknownCommand } from './help.js';
32
35
  class UsageError extends Error {
33
36
  }
34
- export async function main(argv) {
37
+ export async function main(given) {
38
+ const argv = withSecretArgs(given);
35
39
  const dash = argv.indexOf('--');
36
40
  const before = dash === -1 ? argv : argv.slice(0, dash);
37
41
  const command = dash === -1 ? undefined : argv.slice(dash + 1);
@@ -76,9 +80,28 @@ export async function main(argv) {
76
80
  const one = stray.length === 1;
77
81
  process.stderr.write(`toolmenu: ${sub} ignores ${stray.join(', ')}: ${one ? 'it is' : 'they are'} for other commands.\n → Next: Leave ${one ? 'it' : 'them'} out to silence this; toolmenu ${sub} --help lists the options ${sub} takes.\n`);
78
82
  }
79
- const format = (values.json ? 'json' : values.format ?? 'text');
80
- if (!['text', 'json', 'github', 'markdown'].includes(format))
81
- throw new UsageError(`--format must be text, json, github or markdown`);
83
+ const asked = values.json ? 'json' : values.format ?? 'text';
84
+ if (!['text', 'json', 'github', 'markdown', 'sarif'].includes(asked))
85
+ throw new UsageError(`--format must be text, json, github, markdown or sarif`);
86
+ // SARIF is a findings file for code scanning: --format sarif prints it instead of the
87
+ // report, --sarif <path> writes it beside the report.
88
+ const sarifCommands = ['snapshot', 'diff', 'session'];
89
+ if ((asked === 'sarif' || values.sarif !== undefined || values['sarif-menu'] !== undefined) && !sarifCommands.includes(sub))
90
+ throw new UsageError(`SARIF output (--format sarif, --sarif, --sarif-menu) goes with snapshot, diff or session; ${sub} has none.`);
91
+ if (sub === 'session' && (values.plan || values.init) && (asked === 'sarif' || values.sarif !== undefined))
92
+ throw new UsageError('SARIF needs findings: --plan and --init run nothing.');
93
+ const sarifToStdout = asked === 'sarif';
94
+ const format = (sarifToStdout ? 'text' : asked);
95
+ /** Print the report, or the SARIF log with --format sarif; write --sarif's file too. */
96
+ const emit = async (report, findings, command, menuPath) => {
97
+ const menu = values['sarif-menu'] ?? menuPath;
98
+ if (values.sarif !== undefined)
99
+ await writeFile(values.sarif, toSarif(findings, { command, menuPath: menu }) + '\n');
100
+ if (sarifToStdout)
101
+ process.stdout.write(toSarif(findings, { command, menuPath: menu }) + '\n');
102
+ else if (report)
103
+ process.stdout.write(show(report) + '\n');
104
+ };
82
105
  // Colour for a report read in a terminal (colour.ts); piped, CI and other formats stay plain.
83
106
  const show = (report) => (format === 'text' && colourFor(process.stdout) ? colourise(report) : report);
84
107
  const failOn = (values['fail-on'] ?? 'error');
@@ -91,6 +114,14 @@ export async function main(argv) {
91
114
  return authCommand(rest, values);
92
115
  if (sub === 'explain')
93
116
  return explainCommand(rest, command, format);
117
+ if (sub === 'mcp') {
118
+ if (command || rest.length)
119
+ throw new UsageError('mcp takes no server: it is one. Add it to a client as: npx -y toolmenu mcp');
120
+ // Loaded only here: the CLI's other commands don't need the server SDK.
121
+ const { serveMcp } = await import('./mcp.js');
122
+ await serveMcp();
123
+ return 0;
124
+ }
94
125
  // The invocation up to the server, for examples in messages: a session example
95
126
  // without --auto or --scenario wouldn't run.
96
127
  const scenarioFlag = values.scenario ? ` --scenario ${shellWord(values.scenario)}` : '';
@@ -190,7 +221,7 @@ export async function main(argv) {
190
221
  release,
191
222
  serverVersionIsRelease: values['server-version-is-release'] ?? config.serverVersionIsRelease,
192
223
  });
193
- process.stdout.write(show(formatDiff(result, before.tools.length, after.tools.length, format)) + '\n');
224
+ await emit(formatDiff(result, before.tools.length, after.tools.length, format), result.findings, 'diff', rest[1]);
194
225
  return result.findings.some((f) => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) ? 1 : 0;
195
226
  }
196
227
  if (sub === 'history') {
@@ -351,9 +382,7 @@ export async function main(argv) {
351
382
  result.auto = { ...result.auto, ...auto };
352
383
  if (values['union-out'])
353
384
  await writeFile(values['union-out'], JSON.stringify(result.union, null, 2) + '\n');
354
- const output = formatSession(result, format);
355
- if (output)
356
- process.stdout.write(show(output) + '\n');
385
+ await emit(formatSession(result, format), result.findings, 'session', values['union-out'] ?? (existsSync('menu.json') ? 'menu.json' : undefined));
357
386
  return result.findings.some((f) => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) ? 1 : 0;
358
387
  }
359
388
  if (sub === 'session') {
@@ -376,9 +405,7 @@ export async function main(argv) {
376
405
  const result = await session(sessionTarget, scenario, { timeoutMs, processes, rules: config.rules, ignore: config.ignore, scenarioName: values.scenario, unionOut: !!values['union-out'] });
377
406
  if (values['union-out'])
378
407
  await writeFile(values['union-out'], JSON.stringify(result.union, null, 2) + '\n');
379
- const output = formatSession(result, format);
380
- if (output)
381
- process.stdout.write(show(output) + '\n');
408
+ await emit(formatSession(result, format), result.findings, 'session', values['union-out'] ?? (existsSync('menu.json') ? 'menu.json' : undefined));
382
409
  return result.findings.some((f) => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) ? 1 : 0;
383
410
  }
384
411
  const target = parseTarget(rest, command, values.header ?? [], values.env ?? [], values['no-auth'], prefix, protocol);
@@ -393,9 +420,12 @@ export async function main(argv) {
393
420
  const outPath = values['no-write'] ? undefined : values.out ?? 'menu.json';
394
421
  if (outPath)
395
422
  await writeFile(outPath, JSON.stringify(menu, null, 2) + '\n');
396
- const output = formatSnapshot(menu, findings, format, outPath, cost, notOffered);
397
- if (output)
398
- process.stdout.write(show(output) + '\n');
423
+ await emit(formatSnapshot(menu, findings, format, outPath, cost, notOffered), findings, 'snapshot', outPath);
424
+ if (values.badge !== undefined) {
425
+ await writeFile(values.badge, JSON.stringify(badge(menu, findings), null, 2) + '\n');
426
+ // stderr: stdout stays the report (or the JSON/SARIF a script parses).
427
+ process.stderr.write(`toolmenu: wrote the badge to ${values.badge}. Commit it with the menu file; in the README:\n ${badgeMarkdown(values.badge)}\n`);
428
+ }
399
429
  return findings.some((f) => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) ? 1 : 0;
400
430
  }
401
431
  function parseTarget(positionals, command, headers, env, noAuth, prefix, protocol) {
@@ -568,6 +598,28 @@ function commandIn(args) {
568
598
  }
569
599
  return undefined;
570
600
  }
601
+ /**
602
+ * toolmenu mcp passes header and env values (credentials) in TOOLMENU_MCP_ARGS, a JSON
603
+ * array of arguments, not on the command line: argv is readable by any local user.
604
+ * They go before the server command's "--". Removed from the environment once read.
605
+ */
606
+ function withSecretArgs(argv) {
607
+ const raw = process.env[SECRET_ARGS_ENV];
608
+ if (raw === undefined)
609
+ return argv;
610
+ delete process.env[SECRET_ARGS_ENV];
611
+ let extra;
612
+ try {
613
+ extra = JSON.parse(raw);
614
+ }
615
+ catch {
616
+ extra = undefined;
617
+ }
618
+ if (!Array.isArray(extra) || !extra.every((a) => typeof a === 'string'))
619
+ throw new UsageError(`${SECRET_ARGS_ENV} must be a JSON array of strings.`);
620
+ const dash = argv.indexOf('--');
621
+ return dash === -1 ? [...argv, ...extra] : [...argv.slice(0, dash), ...extra, ...argv.slice(dash)];
622
+ }
571
623
  function parseRelease(value) {
572
624
  const m = /^(.+?)\.\.(.+)$/.exec(value);
573
625
  if (!m)
package/dist/connect.d.ts CHANGED
@@ -73,6 +73,15 @@ export interface ConnectOptions {
73
73
  timeoutMs?: number;
74
74
  }
75
75
  export declare function connect(target: Target, options?: ConnectOptions): Promise<Connection>;
76
+ /**
77
+ * Where a redirect response points, when it leaves the request's origin as the MCP
78
+ * SDK (2.3 and later) judges it: same scheme and host:port, or http to https on the
79
+ * same host with default ports, is within. Anything else the SDK leaves to it.
80
+ */
81
+ export declare function crossOriginRedirect(input: string | URL | Request, response: Response): {
82
+ from: string;
83
+ to: string;
84
+ } | undefined;
76
85
  export interface ToolList {
77
86
  tools: Record<string, unknown>[];
78
87
  /** Every page's raw result, for schema validation. */
package/dist/connect.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
2
2
  import { StdioClientTransport, getDefaultEnvironment } from '@modelcontextprotocol/client/stdio';
3
3
  import { hasLogin, StoredOAuthProvider } from './auth.js';
4
- import { explain, isCredentialHeader, Trace } from './explain.js';
4
+ import { explain, isCredentialHeader, redirectError, Trace } from './explain.js';
5
5
  import { endSession } from './close.js';
6
6
  import { eraOf } from './menu.js';
7
7
  import { VERSION } from './version.js';
@@ -282,6 +282,29 @@ function watchProcess(stdio, trace) {
282
282
  }
283
283
  };
284
284
  }
285
+ /**
286
+ * Where a redirect response points, when it leaves the request's origin as the MCP
287
+ * SDK (2.3 and later) judges it: same scheme and host:port, or http to https on the
288
+ * same host with default ports, is within. Anything else the SDK leaves to it.
289
+ */
290
+ export function crossOriginRedirect(input, response) {
291
+ if (![301, 302, 303, 307, 308].includes(response.status))
292
+ return undefined;
293
+ const location = response.headers.get('location');
294
+ if (!location)
295
+ return undefined;
296
+ let from;
297
+ let to;
298
+ try {
299
+ from = new URL(typeof input === 'string' || input instanceof URL ? input : input.url);
300
+ to = new URL(location, from);
301
+ }
302
+ catch {
303
+ return undefined;
304
+ }
305
+ const within = (from.protocol === to.protocol && from.host === to.host) || (from.protocol === 'http:' && to.protocol === 'https:' && from.hostname === to.hostname && !from.port && !to.port);
306
+ return within ? undefined : { from: from.href, to: to.href };
307
+ }
285
308
  /** fetch, noting each JSON-RPC request's method and the answer's status, content type and final URL. */
286
309
  function tracedFetch(trace) {
287
310
  return async (input, init) => {
@@ -299,6 +322,14 @@ function tracedFetch(trace) {
299
322
  if (method)
300
323
  trace.send(method);
301
324
  const response = await fetch(input, init);
325
+ // A redirect the SDK won't follow because it leaves the origin (2.3 and later). Its
326
+ // own error names the target; this one also says which clients fail the same way,
327
+ // and what to run next. explain() returns it as it is.
328
+ const to = crossOriginRedirect(input, response);
329
+ if (to) {
330
+ trace.redirect ??= { ...to, status: response.status };
331
+ throw redirectError(trace.redirect);
332
+ }
302
333
  if (method) {
303
334
  trace.http.set(method, { status: response.status, statusText: response.statusText, contentType: response.headers.get('content-type') ?? '', url: response.url });
304
335
  }
package/dist/diff.js CHANGED
@@ -402,9 +402,8 @@ const MAX_DEPTH = 64;
402
402
  function headerLoss(t, headers, old) {
403
403
  if (!headers)
404
404
  return undefined;
405
- const dropped = (tool) => headerFaults(tool).filter((f) => f.dropped);
406
- const broken = dropped(t);
407
- if (!broken.length || (old && dropped(old).length))
405
+ const broken = headerFaults(t);
406
+ if (!broken.length || (old && headerFaults(old).length))
408
407
  return undefined;
409
408
  return {
410
409
  rule: 'diff/x-mcp-header-invalid',
package/dist/explain.d.ts CHANGED
@@ -18,6 +18,12 @@ export declare class Trace {
18
18
  contentType: string;
19
19
  url: string;
20
20
  }>;
21
+ /** HTTP: a redirect to another origin, which the MCP SDK (2.3 and later) doesn't follow. */
22
+ redirect?: {
23
+ from: string;
24
+ to: string;
25
+ status: number;
26
+ };
21
27
  process?: ChildProcess;
22
28
  /** How the process ended. `afterStop`: it ended after toolmenu sent it SIGTERM, so the exit may be toolmenu's doing. */
23
29
  exit?: {
@@ -133,3 +139,13 @@ export declare function explain(error: unknown, trace: Trace, context: ExplainCo
133
139
  export declare function ignoredProxy(env?: NodeJS.ProcessEnv, host?: string): string | undefined;
134
140
  /** What to do about an ignored proxy, for this Node. */
135
141
  export declare function proxyAdvice(proxy: string, version?: string): string;
142
+ /**
143
+ * The server redirected to another origin. The MCP TypeScript SDK follows a redirect
144
+ * only within the request's origin since 2.3 (before, it re-sent custom headers,
145
+ * credentials included, wherever a redirect pointed). Other clients may still follow it.
146
+ */
147
+ export declare function redirectError(r: {
148
+ from: string;
149
+ to: string;
150
+ status: number;
151
+ }, cause?: unknown): ConnectError;
package/dist/explain.js CHANGED
@@ -11,6 +11,8 @@ export class Trace {
11
11
  answered = new Set();
12
12
  /** HTTP: the last response to each method (status, content type, final URL). */
13
13
  http = new Map();
14
+ /** HTTP: a redirect to another origin, which the MCP SDK (2.3 and later) doesn't follow. */
15
+ redirect;
14
16
  process;
15
17
  /** How the process ended. `afterStop`: it ended after toolmenu sent it SIGTERM, so the exit may be toolmenu's doing. */
16
18
  exit;
@@ -319,6 +321,10 @@ export function bodyExcerpt(body, max = 100) {
319
321
  export function explain(error, trace, context) {
320
322
  if (error instanceof ConnectError || !(error instanceof Error))
321
323
  return error;
324
+ // Whatever the SDK made of it (a transport error, or a probe that waited for a reply):
325
+ // the server sent the request to another origin, and nothing past that was tried.
326
+ if (trace.redirect)
327
+ return redirectError(trace.redirect, error);
322
328
  // A stored OAuth login that can't be used already says why, and what to run.
323
329
  const login = causes(error).find((e) => e instanceof LoginNeededError);
324
330
  if (login)
@@ -618,3 +624,11 @@ function explainHttp(error, trace, context, target) {
618
624
  }
619
625
  return error;
620
626
  }
627
+ /**
628
+ * The server redirected to another origin. The MCP TypeScript SDK follows a redirect
629
+ * only within the request's origin since 2.3 (before, it re-sent custom headers,
630
+ * credentials included, wherever a redirect pointed). Other clients may still follow it.
631
+ */
632
+ export function redirectError(r, cause) {
633
+ return new ConnectError(`The server redirects to another origin (HTTP ${r.status}). toolmenu doesn't follow it, and neither do clients built on the MCP TypeScript SDK 2.3 or later (they won't re-send headers or credentials to another host).`, [['url', r.from], ['redirects to', r.to]], `Check with the URL it redirects to: toolmenu snapshot ${r.to}. If it's your server, give clients that URL: those on the TypeScript SDK can't reach the old one.`, 'server/discover', { cause, status: r.status });
634
+ }
package/dist/help.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const COMMANDS: readonly ['init', 'snapshot', 'diff', 'session', 'history', 'auth', 'scan', 'explain'];
1
+ export declare const COMMANDS: readonly ['init', 'snapshot', 'diff', 'session', 'history', 'auth', 'scan', 'explain', 'mcp'];
2
2
  export type Command = (typeof COMMANDS)[number];
3
3
  /** `toolmenu --help`: what toolmenu is and which command to reach for. */
4
4
  export declare function overview(): string;
package/dist/help.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * codes. Option names and behaviour live in cli.ts; this file only describes them.
5
5
  */
6
6
  import { VERSION } from './version.js';
7
- export const COMMANDS = ['init', 'snapshot', 'diff', 'session', 'history', 'auth', 'scan', 'explain'];
7
+ export const COMMANDS = ['init', 'snapshot', 'diff', 'session', 'history', 'auth', 'scan', 'explain', 'mcp'];
8
8
  /** Every option, once: its spelling and what it does (continuation lines are indented by the renderer). */
9
9
  const OPTIONS = {
10
10
  out: ['--out <path>', ['where to write the menu (default: menu.json)']],
@@ -12,7 +12,10 @@ const OPTIONS = {
12
12
  routes: ['--routes <path>', ['routes.yml: pin which words route to which tools']],
13
13
  catalog: ['--catalog', ['also read the operations behind a search tool (search and execute:', 'discover, search_*_tools) or command routers (listed with learn: true,', 'never run) and keep them in the menu file for diff']],
14
14
  config: ['--config <path>', ['config file (default: toolmenu.config.json, if present)']],
15
- format: ['--format <fmt>', ['text (default), json, github (annotations) or markdown (PR comments)']],
15
+ format: ['--format <fmt>', ['text (default), json, github (annotations), markdown (PR comments)', 'or sarif (code scanning; snapshot, diff and session)']],
16
+ badge: ['--badge <path>', ['also write a README badge there (a shields.io endpoint file: tools, tokens,', 'errors or warnings). Commit it with the menu file; it prints the README line']],
17
+ sarif: ['--sarif <path>', ['also write the findings as SARIF 2.1.0 to this file, for GitHub code', 'scanning (upload it with github/codeql-action/upload-sarif)']],
18
+ 'sarif-menu': ['--sarif-menu <path>', ['the committed menu file SARIF results point at, at each tool\'s line', '(default: the menu file this command wrote, or diff\'s newer one)']],
16
19
  json: ['--json', ['same as --format json']],
17
20
  'fail-on': ['--fail-on <level>', ['exit 1 on findings at this level or above: error (default), warn, info']],
18
21
  header: ['--header "<k>: <v>"', ['HTTP header, repeatable (e.g. "Authorization: Bearer ...")']],
@@ -85,7 +88,7 @@ const HELP = {
85
88
  'reports what in the menu confuses agents or breaks prompt caches.',
86
89
  SERVER_NOTE,
87
90
  ],
88
- own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check'],
91
+ own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check', 'sarif', 'sarif-menu', 'badge'],
89
92
  shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
90
93
  examples: [
91
94
  'toolmenu snapshot -- npx -y @modelcontextprotocol/server-memory',
@@ -97,7 +100,7 @@ const HELP = {
97
100
  summary: 'compare two menu files: breaking changes, token change, semver bump',
98
101
  usage: ['toolmenu diff [options] <old.json> <new.json>'],
99
102
  about: ['Compares two menus written by snapshot (or session --union-out). Starts no server.'],
100
- own: ['release', 'server-version-is-release'],
103
+ own: ['release', 'server-version-is-release', 'sarif', 'sarif-menu'],
101
104
  shared: ['config', 'format', 'json', 'fail-on'],
102
105
  examples: ['toolmenu diff menu.json new-menu.json', 'toolmenu diff --release 1.4.0..1.5.0 --format markdown old.json new.json'],
103
106
  exits: ['0 no findings at or above --fail-on', '1 findings at or above --fail-on', "2 a menu file can't be read, or bad usage"],
@@ -115,7 +118,7 @@ const HELP = {
115
118
  'prompt cache, a different menu in a fresh process.',
116
119
  SERVER_NOTE,
117
120
  ],
118
- own: ['scenario', 'auto', 'init', 'plan', 'value', 'values-file', 'assume-read-only', 'open-world', 'create-handles', 'max-calls', 'max-calls-per-unlock', 'save-scenario', 'union-out', 'elicitation'],
121
+ own: ['scenario', 'auto', 'init', 'plan', 'value', 'values-file', 'assume-read-only', 'open-world', 'create-handles', 'max-calls', 'max-calls-per-unlock', 'save-scenario', 'union-out', 'elicitation', 'sarif', 'sarif-menu'],
119
122
  shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
120
123
  examples: [
121
124
  'toolmenu session --auto -- node dist/index.js',
@@ -185,6 +188,20 @@ const HELP = {
185
188
  examples: ['toolmenu explain naming/vague-id', 'toolmenu explain handle-lifetime', 'toolmenu explain --json diff/param-required'],
186
189
  exits: ['0 explained', "2 no such rule (the closest ones are named), or bad usage"],
187
190
  },
191
+ mcp: {
192
+ summary: 'serve toolmenu to an agent as an MCP server (stdio)',
193
+ usage: ['toolmenu mcp'],
194
+ about: [
195
+ 'An MCP server over stdio, for the agent building your server: snapshot_menu, diff_menus,',
196
+ 'check_session and explain_rule, each running the matching command. Relative paths and',
197
+ 'toolmenu.config.json resolve from the folder it runs in, or a tool call\'s cwd.',
198
+ 'Claude Code: claude mcp add toolmenu -- npx -y toolmenu mcp',
199
+ ],
200
+ own: [],
201
+ shared: [],
202
+ examples: ['claude mcp add toolmenu -- npx -y toolmenu mcp', '{"mcpServers": {"toolmenu": {"command": "npx", "args": ["-y", "toolmenu", "mcp"]}}}'],
203
+ exits: ['0 the client closed the connection', '2 bad usage'],
204
+ },
188
205
  };
189
206
  function optionLines(keys) {
190
207
  const width = Math.max(...keys.map((k) => OPTIONS[k][0].length)) + 2;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The environment variable toolmenu mcp passes credential arguments in (header and env
3
+ * values), shared with the CLI. Its own module so the CLI doesn't load the server SDK.
4
+ */
5
+ export declare const SECRET_ARGS_ENV = "TOOLMENU_MCP_ARGS";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The environment variable toolmenu mcp passes credential arguments in (header and env
3
+ * values), shared with the CLI. Its own module so the CLI doesn't load the server SDK.
4
+ */
5
+ export const SECRET_ARGS_ENV = 'TOOLMENU_MCP_ARGS';
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ import { McpServer } from '@modelcontextprotocol/server';
2
+ import { SECRET_ARGS_ENV } from './mcp-env.js';
3
+ export { SECRET_ARGS_ENV };
4
+ /** A whole run's ceiling. Each request inside it already has the CLI's own --timeout. */
5
+ export declare const RUN_LIMIT_MS: number;
6
+ export interface CliRun {
7
+ code: number;
8
+ stdout: string;
9
+ stderr: string;
10
+ /** Why the run was stopped, when toolmenu mcp stopped it. */
11
+ stopped?: string;
12
+ }
13
+ /** Kill every run still going, at once: toolmenu mcp itself is exiting. */
14
+ export declare function killAllNow(): void;
15
+ /** Stop every run still going, and wait for it: the client closed the connection. */
16
+ export declare function stopAll(): Promise<void>;
17
+ export interface RunOptions {
18
+ /** Arguments that carry credentials, passed through the environment (SECRET_ARGS_ENV). */
19
+ secretArgs?: string[];
20
+ signal?: AbortSignal;
21
+ limitMs?: number;
22
+ }
23
+ /** Run the toolmenu CLI with these arguments, from this folder. */
24
+ export declare function runCli(args: string[], cwd: string, options?: RunOptions): Promise<CliRun>;
25
+ type Text = {
26
+ content: {
27
+ type: 'text';
28
+ text: string;
29
+ }[];
30
+ isError?: boolean;
31
+ };
32
+ /** A CLI run as a tool result. Findings are a report, not a failure: only exit 2 (couldn't run) is an error. */
33
+ export declare function toResult(run: CliRun): Text;
34
+ type ServerArgs = {
35
+ command?: string[];
36
+ url?: string;
37
+ headers?: Record<string, string>;
38
+ env?: Record<string, string>;
39
+ cwd?: string;
40
+ };
41
+ export interface ServerSpec {
42
+ /** Before "--": the URL, if any. */
43
+ before: string[];
44
+ /** Header and env values, passed through the environment. */
45
+ secret: string[];
46
+ /** "--" and the command, if any. */
47
+ after: string[];
48
+ }
49
+ /** The CLI arguments that name the server, or why they can't. */
50
+ export declare function serverArgs(a: ServerArgs): ServerSpec | {
51
+ error: string;
52
+ };
53
+ /** The folder a call runs in, or why it can't. */
54
+ export declare function folder(baseCwd: string, cwd?: string): {
55
+ dir: string;
56
+ } | {
57
+ error: string;
58
+ };
59
+ export declare function build(baseCwd?: string): McpServer;
60
+ /**
61
+ * Serve over stdio until the client closes stdin, then stop every run still going.
62
+ * A client that closes stdin may send SIGTERM before the runs are stopped: on that, or
63
+ * on any exit, what's left is killed at once rather than left running.
64
+ */
65
+ export declare function serveMcp(): Promise<void>;
package/dist/mcp.js ADDED
@@ -0,0 +1,293 @@
1
+ /*
2
+ * `toolmenu mcp`: toolmenu as an MCP server (stdio), so an agent building an MCP
3
+ * server can check its menu while it works. Each tool runs the CLI in a child process
4
+ * (no shell) and returns its report: the same checks, options, config and exit codes
5
+ * as on the command line, and a crash or hang in one check can't take the server down.
6
+ *
7
+ * Each child runs in its own process group, so cancelling a call, its time running
8
+ * out, or the client closing the connection stops the child and the server it started.
9
+ */
10
+ import { spawn, spawnSync } from 'node:child_process';
11
+ import { statSync } from 'node:fs';
12
+ import { isAbsolute, resolve } from 'node:path';
13
+ import { fileURLToPath } from 'node:url';
14
+ import { McpServer } from '@modelcontextprotocol/server';
15
+ import { serveStdio } from '@modelcontextprotocol/server/stdio';
16
+ import * as z from 'zod';
17
+ import { CLIENT_NAMES } from './clients.js';
18
+ import { VERSION } from './version.js';
19
+ import { SECRET_ARGS_ENV } from './mcp-env.js';
20
+ export { SECRET_ARGS_ENV };
21
+ const CLI = fileURLToPath(new URL('./cli.js', import.meta.url));
22
+ /** A whole run's ceiling. Each request inside it already has the CLI's own --timeout. */
23
+ export const RUN_LIMIT_MS = 10 * 60_000;
24
+ const OUTPUT_LIMIT = 64 * 1024 * 1024;
25
+ const WINDOWS = process.platform === 'win32';
26
+ /**
27
+ * Runs still going, by the CLI's pid. On Linux and macOS each run is a process group
28
+ * (the CLI and the server it started), kept until nothing in it is alive, not until
29
+ * the CLI exits: a server that ignores SIGTERM outlives the CLI that started it.
30
+ * Windows has no process groups to signal: there a run is the CLI's process tree,
31
+ * which taskkill /T ends while the CLI is still its root.
32
+ */
33
+ const runs = new Map();
34
+ /** Whether anything in the run is still alive. */
35
+ function runAlive(pid) {
36
+ if (WINDOWS) {
37
+ const child = runs.get(pid);
38
+ return !!child && child.exitCode === null && child.signalCode === null;
39
+ }
40
+ try {
41
+ process.kill(-pid, 0);
42
+ return true;
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ /** Signal the whole run. On Windows, any stop is taskkill /T /F: there's no polite one for a console process. */
49
+ function signalRun(pid, signal) {
50
+ if (WINDOWS) {
51
+ spawnSync('taskkill', ['/pid', String(pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true });
52
+ return;
53
+ }
54
+ try {
55
+ process.kill(-pid, signal);
56
+ }
57
+ catch {
58
+ // Already gone.
59
+ }
60
+ }
61
+ /** Stop a run: SIGTERM, then SIGKILL to whatever in it is still there 2 s later. */
62
+ async function stopRun(pid) {
63
+ if (runAlive(pid)) {
64
+ signalRun(pid, 'SIGTERM');
65
+ const end = Date.now() + 2_000;
66
+ while (runAlive(pid) && Date.now() < end)
67
+ await new Promise((r) => setTimeout(r, 50));
68
+ if (runAlive(pid))
69
+ signalRun(pid, 'SIGKILL');
70
+ }
71
+ runs.delete(pid);
72
+ }
73
+ /** Kill every run still going, at once: toolmenu mcp itself is exiting. */
74
+ export function killAllNow() {
75
+ for (const pid of runs.keys())
76
+ signalRun(pid, 'SIGKILL');
77
+ }
78
+ /** Stop every run still going, and wait for it: the client closed the connection. */
79
+ export async function stopAll() {
80
+ await Promise.all([...runs.keys()].map(stopRun));
81
+ }
82
+ /** Run the toolmenu CLI with these arguments, from this folder. */
83
+ export function runCli(args, cwd, options = {}) {
84
+ const { secretArgs = [], signal, limitMs = RUN_LIMIT_MS } = options;
85
+ return new Promise((done) => {
86
+ if (signal?.aborted)
87
+ return done({ code: 2, stdout: '', stderr: '', stopped: 'The call was cancelled before it started.' });
88
+ // NO_COLOR: the report goes to an agent, not a terminal. NODE_NO_WARNINGS: Node's
89
+ // own notices (experimental features) aren't findings, and would read as if they
90
+ // were. Neither reaches the server under test: it gets a minimal environment.
91
+ const env = { ...process.env, NO_COLOR: '1', NODE_NO_WARNINGS: '1' };
92
+ delete env[SECRET_ARGS_ENV];
93
+ if (secretArgs.length)
94
+ env[SECRET_ARGS_ENV] = JSON.stringify(secretArgs);
95
+ // detached: its own process group (Linux, macOS). On Windows it would open a console
96
+ // window for every run instead, so there the run stays attached and hidden.
97
+ const child = spawn(process.execPath, [CLI, ...args], { cwd, env, detached: !WINDOWS, windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
98
+ if (child.pid)
99
+ runs.set(child.pid, child);
100
+ let stdout = '';
101
+ let stderr = '';
102
+ let stopped;
103
+ const halt = (why) => {
104
+ stopped ??= why;
105
+ if (child.pid)
106
+ void stopRun(child.pid);
107
+ };
108
+ child.stdout.on('data', (d) => {
109
+ stdout += d;
110
+ if (stdout.length > OUTPUT_LIMIT)
111
+ halt(`The report passed ${OUTPUT_LIMIT / 1024 / 1024} MB, so the run was stopped.`);
112
+ });
113
+ child.stderr.on('data', (d) => {
114
+ stderr += d;
115
+ if (stderr.length > OUTPUT_LIMIT)
116
+ stderr = stderr.slice(-OUTPUT_LIMIT);
117
+ });
118
+ const timer = setTimeout(() => halt(`The run took longer than ${limitMs / 60_000} minutes, so it was stopped. A server that is slow to answer each request can be given a longer --timeout in toolmenu.config.json, or fewer calls (max_calls).`), limitMs);
119
+ const onAbort = () => halt('The call was cancelled, so the run was stopped.');
120
+ signal?.addEventListener('abort', onAbort, { once: true });
121
+ let finished = false;
122
+ // A child that fails to start can emit both error and close: answer once.
123
+ const finish = (code) => {
124
+ if (finished)
125
+ return;
126
+ finished = true;
127
+ clearTimeout(timer);
128
+ signal?.removeEventListener('abort', onAbort);
129
+ // Whatever the CLI left behind (a server it couldn't stop) goes with it.
130
+ if (child.pid)
131
+ void stopRun(child.pid);
132
+ done({ code, stdout, stderr, ...(stopped ? { stopped } : {}) });
133
+ };
134
+ // Never Node's own error message: it repeats the command line.
135
+ child.on('error', (error) => {
136
+ stderr += `toolmenu mcp couldn't start the toolmenu CLI (${error.code ?? 'error'}).`;
137
+ finish(2);
138
+ });
139
+ child.on('close', (code) => finish(stopped ? 2 : code ?? 2));
140
+ });
141
+ }
142
+ /** A CLI run as a tool result. Findings are a report, not a failure: only exit 2 (couldn't run) is an error. */
143
+ export function toResult(run) {
144
+ const out = run.stdout.trim();
145
+ if (run.code === 2) {
146
+ const why = [run.stopped, run.stderr.trim()].filter(Boolean).join('\n\n') || out || 'toolmenu exited with code 2.';
147
+ return { content: [{ type: 'text', text: why }], isError: true };
148
+ }
149
+ const notes = run.stderr.trim();
150
+ const tail = run.code === 1 ? '\n\nExit 1: there are error-level findings.' : '';
151
+ return { content: [{ type: 'text', text: `${out || 'No output.'}${tail}${notes ? `\n\nNotes:\n${notes}` : ''}` }] };
152
+ }
153
+ const serverShape = {
154
+ command: z
155
+ .array(z.string())
156
+ .min(1)
157
+ .optional()
158
+ .describe('The command that starts a stdio server, one word per item: ["node", "dist/server.js"]. Give this or url.'),
159
+ url: z.string().optional().describe('A Streamable HTTP endpoint: https://example.com/mcp. Give this or command.'),
160
+ headers: z.record(z.string(), z.string()).optional().describe('HTTP headers for a url server: {"Authorization": "Bearer ..."}.'),
161
+ env: z.record(z.string(), z.string()).optional().describe('Environment variables for a command server. It gets a minimal environment plus these.'),
162
+ cwd: z.string().optional().describe('Folder to run from: where the server starts, toolmenu.config.json is read and relative paths resolve. Default: where toolmenu mcp runs.'),
163
+ };
164
+ /** The CLI arguments that name the server, or why they can't. */
165
+ export function serverArgs(a) {
166
+ if (!a.command === !a.url)
167
+ return { error: 'Give the server as command (a stdio server, e.g. ["node", "dist/server.js"]) or url (an HTTP server), one of the two.' };
168
+ if (a.url) {
169
+ if (a.env && Object.keys(a.env).length)
170
+ return { error: 'env goes with command: an HTTP server is already running. Use headers for credentials.' };
171
+ if (!/^https?:\/\//.test(a.url))
172
+ return { error: `url must be an http(s) URL; got "${a.url}". For a stdio server, give command.` };
173
+ return { before: [a.url], secret: Object.entries(a.headers ?? {}).flatMap(([k, v]) => ['--header', `${k}: ${v}`]), after: [] };
174
+ }
175
+ if (a.headers && Object.keys(a.headers).length)
176
+ return { error: 'headers go with url. Pass a stdio server its credentials with env.' };
177
+ return { before: [], secret: Object.entries(a.env ?? {}).flatMap(([k, v]) => ['--env', `${k}=${v}`]), after: ['--', ...a.command] };
178
+ }
179
+ /** The folder a call runs in, or why it can't. */
180
+ export function folder(baseCwd, cwd) {
181
+ const dir = cwd ? resolve(baseCwd, cwd) : baseCwd;
182
+ try {
183
+ if (statSync(dir).isDirectory())
184
+ return { dir };
185
+ return { error: `cwd "${cwd ?? dir}" is a file, not a folder.` };
186
+ }
187
+ catch {
188
+ return { error: `cwd "${cwd ?? dir}" doesn't exist (resolved to ${dir}). Give the server's project folder.` };
189
+ }
190
+ }
191
+ /** A path as an absolute one, so a value starting with "-" can't be read as an option. */
192
+ const absolute = (dir, path) => (isAbsolute(path) ? path : resolve(dir, path));
193
+ const failed = (text) => ({ content: [{ type: 'text', text }], isError: true });
194
+ export function build(baseCwd = process.cwd()) {
195
+ const server = new McpServer({ name: 'toolmenu', version: VERSION }, {
196
+ capabilities: { tools: {} },
197
+ // The same four tools for everyone, always: an hour, and shared caches may keep it.
198
+ cacheHints: { 'tools/list': { ttlMs: 3_600_000, cacheScope: 'public' }, 'server/discover': { ttlMs: 3_600_000, cacheScope: 'public' } },
199
+ instructions: "toolmenu checks an MCP server's tool list (its menu) the way clients and agents meet it. " +
200
+ 'After changing a server\'s tools: snapshot_menu for findings and token cost, diff_menus against the committed menu.json for breaking changes, check_session to see whether the menu changes mid-session. ' +
201
+ 'Each finding ends with a → Next: step; explain_rule says what a rule checks.',
202
+ });
203
+ /** Run a command for a server: the folder checked, credentials kept out of argv. */
204
+ const forServer = async (a, ctx, args) => {
205
+ const s = serverArgs(a);
206
+ if ('error' in s)
207
+ return failed(s.error);
208
+ const f = folder(baseCwd, a.cwd);
209
+ if ('error' in f)
210
+ return failed(f.error);
211
+ return toResult(await runCli([...args(f.dir, s), ...s.after], f.dir, { secretArgs: s.secret, signal: ctx.mcpReq.signal }));
212
+ };
213
+ server.registerTool('snapshot_menu', {
214
+ description: "Check an MCP server's tool list: start or connect to it, list its tools, and report findings (what agents misread, what breaks clients or prompt caches) and the token cost. " +
215
+ 'Writes the menu file only when save_as is given (the baseline for diff_menus).',
216
+ inputSchema: {
217
+ ...serverShape,
218
+ save_as: z.string().optional().describe('Write the menu here (menu.json for a baseline), relative to cwd. Default: not written.'),
219
+ client: z.enum(CLIENT_NAMES).optional().describe('Also check the menu as this client loads it: what it cuts, finds and refuses.'),
220
+ catalog: z.boolean().optional().describe('Also read the operations behind a search tool or command routers.'),
221
+ },
222
+ annotations: { title: 'Snapshot a server menu', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
223
+ }, (a, ctx) => forServer(a, ctx, (dir, s) => [
224
+ 'snapshot',
225
+ ...s.before,
226
+ a.save_as ? `--out=${absolute(dir, a.save_as)}` : '--no-write',
227
+ ...(a.client ? [`--client=${a.client}`] : []),
228
+ ...(a.catalog ? ['--catalog'] : []),
229
+ ]));
230
+ server.registerTool('diff_menus', {
231
+ description: 'Compare two menu files (from snapshot_menu save_as, or toolmenu snapshot): breaking changes for clients, the token change per conversation, and the version bump it needs. Reads files only.',
232
+ inputSchema: {
233
+ before: z.string().describe('The older menu file, e.g. the committed menu.json.'),
234
+ after: z.string().describe('The newer menu file.'),
235
+ release: z.string().optional().describe('The release versions to check the bump against: "1.4.0..1.5.0".'),
236
+ cwd: serverShape.cwd,
237
+ },
238
+ annotations: { title: 'Diff two menus', readOnlyHint: true, openWorldHint: false },
239
+ }, async (a, ctx) => {
240
+ const f = folder(baseCwd, a.cwd);
241
+ if ('error' in f)
242
+ return failed(f.error);
243
+ const args = ['diff', absolute(f.dir, a.before), absolute(f.dir, a.after), ...(a.release ? [`--release=${a.release}`] : [])];
244
+ return toResult(await runCli(args, f.dir, { signal: ctx.mcpReq.signal }));
245
+ });
246
+ server.registerTool('check_session', {
247
+ description: "Check whether an MCP server's menu changes while an agent works: call its tools marked readOnlyHint whose arguments the schema can fill, list the menu after each call, and report each change with the call that caused it. " +
248
+ 'Calls only read-only tools; never one marked openWorldHint unless open_world is set.',
249
+ inputSchema: {
250
+ ...serverShape,
251
+ max_calls: z.number().int().min(1).optional().describe('At most this many calls (default 20).'),
252
+ open_world: z.boolean().optional().describe('Also call read-only tools marked openWorldHint (web search, fetch): they may cost API credits.'),
253
+ },
254
+ annotations: { title: 'Run a session against a server', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
255
+ }, (a, ctx) => forServer(a, ctx, (_dir, s) => [
256
+ 'session',
257
+ '--auto',
258
+ ...s.before,
259
+ ...(a.max_calls ? [`--max-calls=${a.max_calls}`] : []),
260
+ ...(a.open_world ? ['--open-world'] : []),
261
+ ]));
262
+ server.registerTool('explain_rule', {
263
+ description: "Explain a toolmenu rule by the name a finding gives (naming/vague-id): what it checks, its default level and how to change it. Without rule, lists every rule.",
264
+ inputSchema: { rule: z.string().optional().describe('The rule, as a finding names it: naming/vague-id, or just vague-id.') },
265
+ annotations: { title: 'Explain a rule', readOnlyHint: true, openWorldHint: false },
266
+ }, async (a, ctx) => {
267
+ if (a.rule !== undefined && !/^[a-z0-9][a-z0-9/_-]*$/i.test(a.rule))
268
+ return failed(`"${a.rule}" isn't a rule name. Rules look like naming/vague-id; call explain_rule without rule to list them.`);
269
+ return toResult(await runCli(['explain', ...(a.rule ? [a.rule] : [])], baseCwd, { signal: ctx.mcpReq.signal }));
270
+ });
271
+ return server;
272
+ }
273
+ /**
274
+ * Serve over stdio until the client closes stdin, then stop every run still going.
275
+ * A client that closes stdin may send SIGTERM before the runs are stopped: on that, or
276
+ * on any exit, what's left is killed at once rather than left running.
277
+ */
278
+ export async function serveMcp() {
279
+ process.once('exit', killAllNow);
280
+ for (const [signal, code] of [['SIGTERM', 143], ['SIGINT', 130], ['SIGHUP', 129]]) {
281
+ process.once(signal, () => {
282
+ killAllNow();
283
+ process.exit(code);
284
+ });
285
+ }
286
+ const handle = serveStdio(() => build());
287
+ await new Promise((done) => {
288
+ process.stdin.once('end', done);
289
+ process.stdin.once('close', done);
290
+ });
291
+ await stopAll();
292
+ await handle.close().catch(() => { });
293
+ }
package/dist/options.d.ts CHANGED
@@ -2,6 +2,15 @@ export declare const CLI_OPTIONS: {
2
2
  readonly out: {
3
3
  readonly type: 'string';
4
4
  };
5
+ readonly sarif: {
6
+ readonly type: 'string';
7
+ };
8
+ readonly badge: {
9
+ readonly type: 'string';
10
+ };
11
+ readonly 'sarif-menu': {
12
+ readonly type: 'string';
13
+ };
5
14
  readonly 'out-dir': {
6
15
  readonly type: 'string';
7
16
  };
package/dist/options.js CHANGED
@@ -4,6 +4,9 @@
4
4
  */
5
5
  export const CLI_OPTIONS = {
6
6
  out: { type: 'string' },
7
+ sarif: { type: 'string' },
8
+ badge: { type: 'string' },
9
+ 'sarif-menu': { type: 'string' },
7
10
  'out-dir': { type: 'string' },
8
11
  'offline-check': { type: 'boolean' },
9
12
  concurrency: { type: 'string' },
@@ -202,7 +202,7 @@
202
202
  "spec/x-mcp-header": {
203
203
  "command": "snapshot",
204
204
  "severity": "error",
205
- "text": "`since: 2026-07-28`. An `x-mcp-header` annotation the spec doesn't allow (SEP-2243): empty; not an RFC 9110 token; the same header twice ignoring case; on a parameter that isn't `string`, `integer` or `boolean`, or has no single `type`; anywhere but a parameter reached through `properties` alone. Streamable HTTP clients **MUST** leave such a tool out of `tools/list`, and the official SDK client does, with only a console warning. Error on an HTTP server, warn on stdio (clients there MAY ignore the annotation). `number` is warn on both: the spec forbids it, the SDK client accepts it for now. Every broken annotation in a tool is listed (the SDK stops at the first). Checked against the SDK client's behaviour in the tests"
205
+ "text": "`since: 2026-07-28`. An `x-mcp-header` annotation the spec doesn't allow (SEP-2243): empty; not an RFC 9110 token; the same header twice ignoring case; on a parameter that isn't `string`, `integer` or `boolean`, or has no single `type`; anywhere but a parameter reached through `properties` alone. Streamable HTTP clients **MUST** leave such a tool out of `tools/list`, and the official SDK client does, with only a console warning. Error on an HTTP server, warn on stdio (clients there MAY ignore the annotation). A `number` parameter counts too: the SDK client drops those tools since 2.4. Every broken annotation in a tool is listed (the SDK stops at the first). Checked against the SDK client's behaviour in the tests"
206
206
  },
207
207
  "write/no-dry-run": {
208
208
  "command": "snapshot",
@@ -6,8 +6,6 @@ export interface HeaderFault {
6
6
  /** The annotation's value, as written. */
7
7
  header: unknown;
8
8
  problem: string;
9
- /** The SDK client drops the tool for this (true), or only the spec forbids it (false: `number`). */
10
- dropped: boolean;
11
9
  }
12
10
  /** Every broken x-mcp-header annotation in a tool's input schema; empty when all are valid or there are none. */
13
11
  export declare function headerFaults(tool: MenuTool): HeaderFault[];
@@ -9,8 +9,8 @@ import { count, names } from './rule.js';
9
9
  *
10
10
  * The checks follow the spec and the SDK client's own scan
11
11
  * (scanXMcpHeaderDeclarations in @modelcontextprotocol/client), which decides
12
- * what SDK-based clients actually drop. Where the two differ (`number`: the spec
13
- * forbids it, the SDK accepts it), the finding says so.
12
+ * what SDK-based clients actually drop. The two agree: since SDK 2.4 the client
13
+ * drops a tool whose header is on a number parameter too, as the spec says.
14
14
  */
15
15
  const KEY = 'x-mcp-header';
16
16
  // RFC 9110 §5.1 token: 1*tchar. No spaces, control characters or delimiters.
@@ -34,7 +34,7 @@ export function headerFaults(tool) {
34
34
  const where = path.length ? path.join('.') : 'the schema root';
35
35
  if (KEY in schema) {
36
36
  const raw = schema[KEY];
37
- const fault = (problem, dropped = true) => faults.push({ path: where, header: raw, problem, dropped });
37
+ const fault = (problem) => faults.push({ path: where, header: raw, problem });
38
38
  if (!reachable || path.length === 0) {
39
39
  fault(path.length === 0
40
40
  ? 'it sits on the schema root, not on a parameter'
@@ -57,7 +57,7 @@ export function headerFaults(tool) {
57
57
  else {
58
58
  // number takes part in the uniqueness check too: the SDK client registers it.
59
59
  if (type === 'number')
60
- fault('the parameter is a number; the spec allows only string, integer or boolean (the official SDK client accepts number for now, other clients may not)', false);
60
+ fault('the parameter is a number; it must be string, integer or boolean (make it an integer or a string: a header carries text anyway)');
61
61
  const prior = seen.get(raw.toLowerCase());
62
62
  if (prior !== undefined)
63
63
  fault(`"${raw}" is already used by ${prior}; header names must differ ignoring case`);
@@ -95,20 +95,15 @@ export const xMcpHeader = {
95
95
  const faults = headerFaults(tool);
96
96
  if (!faults.length)
97
97
  continue;
98
- const dropped = faults.some((f) => f.dropped);
99
98
  const where = faults.map((f) => f.path);
100
99
  findings.push({
101
100
  tool: tool.name,
102
101
  // Over HTTP the tool is gone for every compliant client. On stdio clients may
103
102
  // ignore the annotation, but the same server is often deployed over HTTP too.
104
- severity: dropped ? (http ? 'error' : 'warn') : 'warn',
105
- message: dropped
106
- ? `${tool.name} has ${faults.length === 1 ? 'an x-mcp-header annotation' : `${count(faults.length, 'x-mcp-header annotation')}`} the spec doesn't allow (on ${names(where, 4)}), and Streamable HTTP clients must then leave the whole tool out of their menu. The official SDK client does, with only a console warning, so the agent never sees ${tool.name} and nothing tells the server.${http ? ' toolmenu reads the list off the wire, which is why it is in this menu.' : ' Over stdio clients may ignore the annotation, so it shows here; served over HTTP, it would be gone.'}`
107
- : `${tool.name} mirrors a number parameter into a header (${names(where, 4)}). The spec allows only string, integer or boolean there, so a strict Streamable HTTP client must leave the tool out of its menu; the official SDK client keeps it for now (its conformance tests expect number to work, a gap tracked upstream).`,
103
+ severity: http ? 'error' : 'warn',
104
+ message: `${tool.name} has ${faults.length === 1 ? 'an x-mcp-header annotation' : `${count(faults.length, 'x-mcp-header annotation')}`} the spec doesn't allow (on ${names(where, 4)}), and Streamable HTTP clients must then leave the whole tool out of their menu. The official SDK client does, with only a console warning, so the agent never sees ${tool.name} and nothing tells the server.${http ? ' toolmenu reads the list off the wire, which is why it is in this menu.' : ' Over stdio clients may ignore the annotation, so it shows here; served over HTTP, it would be gone.'}`,
108
105
  detail: faults.map((f) => `${f.path}${typeof f.header === 'string' && f.header ? ` (x-mcp-header: "${f.header}")` : ''}: ${f.problem}`),
109
- fix: dropped
110
- ? `Fix each annotation listed: on a string, integer or boolean parameter reached through "properties" alone, with a header name of letters, digits and - _ . only, different from the tool's other headers ignoring case. Then list the tools over HTTP with an SDK client and check ${tool.name} is there.`
111
- : 'Make the parameter a string or an integer (a header carries text anyway), or stop mirroring it into a header.',
106
+ fix: `Fix each annotation listed: on a string, integer or boolean parameter reached through "properties" alone, with a header name of letters, digits and - _ . only, different from the tool's other headers ignoring case. Then list the tools over HTTP with an SDK client and check ${tool.name} is there.`,
112
107
  });
113
108
  }
114
109
  return findings;
@@ -0,0 +1,14 @@
1
+ import type { Finding } from './types.js';
2
+ export interface SarifOptions {
3
+ /** snapshot, diff or session: the run's category, so code scanning keeps them apart. */
4
+ command: string;
5
+ /** The menu file results point at, as a path from the working directory. */
6
+ menuPath?: string;
7
+ /** Where paths are made relative to: the repository root (default: found from the working directory). */
8
+ root?: string;
9
+ }
10
+ /** The repository root: the nearest folder up from `from` with a .git, or `from` itself. */
11
+ export declare function repoRoot(from?: string): string;
12
+ /** The line of each tool's "name" in a menu file written by toolmenu (1-based). */
13
+ export declare function toolLines(text: string): Map<string, number>;
14
+ export declare function toSarif(findings: Finding[], options: SarifOptions): string;
package/dist/sarif.js ADDED
@@ -0,0 +1,138 @@
1
+ /*
2
+ * SARIF 2.1.0 output, for GitHub code scanning and other SARIF viewers.
3
+ *
4
+ * toolmenu's findings are about tools in a menu, not lines of source, so each result
5
+ * points at the menu file in the repository (the committed baseline, or the one this
6
+ * command wrote) and, when the finding names a tool, at the line where that tool
7
+ * starts. A tool the file doesn't have (new since the baseline) points at line 1.
8
+ */
9
+ import { createHash } from 'node:crypto';
10
+ import { existsSync, readFileSync } from 'node:fs';
11
+ import { dirname, isAbsolute, relative, resolve, sep } from 'node:path';
12
+ import { pathToFileURL } from 'node:url';
13
+ import { ruleDocs } from './rule-docs.js';
14
+ import { VERSION } from './version.js';
15
+ const LEVEL = { error: 'error', warn: 'warning', info: 'note' };
16
+ const RULES_URL = 'https://github.com/niksa90/toolmenu/blob/main/docs/RULES.md';
17
+ /** The repository root: the nearest folder up from `from` with a .git, or `from` itself. */
18
+ export function repoRoot(from = process.cwd()) {
19
+ let dir = resolve(from);
20
+ for (;;) {
21
+ if (existsSync(resolve(dir, '.git')))
22
+ return dir;
23
+ const up = dirname(dir);
24
+ if (up === dir)
25
+ return resolve(from);
26
+ dir = up;
27
+ }
28
+ }
29
+ /** The line of each tool's "name" in a menu file written by toolmenu (1-based). */
30
+ export function toolLines(text) {
31
+ const lines = new Map();
32
+ const all = text.split(/\r?\n/);
33
+ const start = all.findIndex((l) => /^\s*"tools":\s*\[/.test(l));
34
+ if (start === -1)
35
+ return lines;
36
+ // A tool's own "name" is the first key of its object, one level inside the array.
37
+ for (let i = start + 1; i < all.length; i++) {
38
+ const m = /^ {6}"name":\s*("(?:[^"\\]|\\.)*")/.exec(all[i]);
39
+ if (m) {
40
+ const name = JSON.parse(m[1]);
41
+ if (!lines.has(name))
42
+ lines.set(name, i + 1);
43
+ }
44
+ if (/^ {2}\]/.test(all[i]))
45
+ break;
46
+ }
47
+ return lines;
48
+ }
49
+ /** The tools a finding is about: its tool, or each tool of a change found in several. */
50
+ function toolsOf(f) {
51
+ const several = f.tools;
52
+ if (Array.isArray(several))
53
+ return several.filter((t) => typeof t === 'string');
54
+ return f.tool ? [f.tool] : [];
55
+ }
56
+ /**
57
+ * A stable identity for a result across runs: rule, tool, and which of that rule's
58
+ * findings on that tool it is (one rule can find two things about one tool). Not the
59
+ * message: it carries counts that change between runs.
60
+ */
61
+ function fingerprint(rule, tool, nth) {
62
+ return createHash('sha256').update(`${rule}\u0000${tool ?? ''}\u0000${nth}`).digest('hex').slice(0, 32);
63
+ }
64
+ export function toSarif(findings, options) {
65
+ const root = options.root ?? repoRoot();
66
+ let artifact;
67
+ let lines = new Map();
68
+ if (options.menuPath) {
69
+ const abs = resolve(options.menuPath);
70
+ const rel = relative(root, abs);
71
+ // Inside the repository: relative to its root. Outside (or another drive): a file URL.
72
+ artifact = rel && rel !== '..' && !rel.startsWith('..' + sep) && !isAbsolute(rel) ? { uri: rel.split(sep).join('/'), uriBaseId: '%SRCROOT%' } : { uri: pathToFileURL(abs).href };
73
+ try {
74
+ lines = toolLines(readFileSync(abs, 'utf8'));
75
+ }
76
+ catch {
77
+ // Not written (--no-write) or unreadable: results point at the file's first line.
78
+ }
79
+ }
80
+ const docs = ruleDocs();
81
+ const ruleIds = [...new Set(findings.map((f) => f.rule))].sort();
82
+ const seen = new Map();
83
+ const results = findings.flatMap((f) => {
84
+ const tools = toolsOf(f);
85
+ // One result per tool, so each alert sits on its own tool's line.
86
+ return (tools.length ? tools : [undefined]).map((tool) => {
87
+ const key = `${f.rule}\u0000${tool ?? ''}`;
88
+ const nth = seen.get(key) ?? 0;
89
+ seen.set(key, nth + 1);
90
+ const text = [f.message, ...(f.detail ?? []), ...(f.fix ? [`→ Next: ${f.fix}`] : [])].join('\n');
91
+ return {
92
+ ruleId: f.rule,
93
+ ruleIndex: ruleIds.indexOf(f.rule),
94
+ level: LEVEL[f.severity],
95
+ message: { text: f.confidence === 'unsure' ? `${text}\n(unsure: a heuristic, from names and words)` : text },
96
+ ...(artifact ? { locations: [{ physicalLocation: { artifactLocation: artifact, region: { startLine: (tool && lines.get(tool)) || 1 } } }] } : {}),
97
+ partialFingerprints: { 'toolmenuFinding/v1': fingerprint(f.rule, tool, nth) },
98
+ properties: { ...(tool ? { tool } : {}), ...(f.step !== undefined ? { step: f.step } : {}), ...(f.confidence ? { confidence: f.confidence } : {}) },
99
+ };
100
+ });
101
+ });
102
+ const log = {
103
+ $schema: 'https://json.schemastore.org/sarif-2.1.0.json',
104
+ version: '2.1.0',
105
+ runs: [
106
+ {
107
+ tool: {
108
+ driver: {
109
+ name: 'toolmenu',
110
+ version: VERSION,
111
+ semanticVersion: VERSION,
112
+ informationUri: 'https://github.com/niksa90/toolmenu',
113
+ rules: ruleIds.map((id) => {
114
+ const doc = docs[id];
115
+ // RULES.md gives a default, sometimes with conditions ("warn, error if no call got through"): its first word.
116
+ const documented = /^(error|warn|info)\b/.exec(doc?.severity ?? '')?.[1];
117
+ const severity = documented ?? findings.find((f) => f.rule === id)?.severity ?? 'warn';
118
+ return {
119
+ id,
120
+ name: id.replace(/[^A-Za-z0-9]+(.)?/g, (_, c) => (c ? c.toUpperCase() : '')),
121
+ shortDescription: { text: id },
122
+ ...(doc ? { fullDescription: { text: doc.text } } : {}),
123
+ helpUri: RULES_URL,
124
+ help: { text: `toolmenu explain ${id}` },
125
+ defaultConfiguration: { level: LEVEL[severity] },
126
+ properties: { tags: ['mcp', doc?.command ?? options.command] },
127
+ };
128
+ }),
129
+ },
130
+ },
131
+ automationDetails: { id: `toolmenu/${options.command}/` },
132
+ originalUriBaseIds: { '%SRCROOT%': { uri: pathToFileURL(root + sep).href } },
133
+ results,
134
+ },
135
+ ],
136
+ };
137
+ return JSON.stringify(log, null, 2);
138
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolmenu",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "Lint your MCP server's tool menu for changes that confuse agents or break caches.",
5
5
  "author": "Nikša Perović (https://niksa.me)",
6
6
  "main": "dist/index.js",
@@ -20,7 +20,8 @@
20
20
  "linter",
21
21
  "agents",
22
22
  "prompt-caching",
23
- "cli"
23
+ "cli",
24
+ "mcp-server"
24
25
  ],
25
26
  "license": "MIT",
26
27
  "bugs": {
@@ -28,17 +29,17 @@
28
29
  },
29
30
  "homepage": "https://github.com/niksa90/toolmenu#readme",
30
31
  "dependencies": {
31
- "@modelcontextprotocol/client": "^2.1.0",
32
+ "@modelcontextprotocol/client": "^2.4.0",
33
+ "@modelcontextprotocol/server": "^2.4.0",
32
34
  "ajv": "^8.20.0",
33
35
  "ajv-formats": "^3.0.1",
34
36
  "js-tiktoken": "^1.0.21",
35
- "yaml": "^2.9.1"
37
+ "yaml": "^2.9.1",
38
+ "zod": "^4.6.7"
36
39
  },
37
40
  "devDependencies": {
38
- "@modelcontextprotocol/server": "^2.1.0",
39
41
  "@types/node": "^22.20.4",
40
- "typescript": "^7.0.2",
41
- "zod": "^4.6.5"
42
+ "typescript": "^7.0.2"
42
43
  },
43
44
  "type": "module",
44
45
  "bin": {