toolmenu 0.25.0 → 0.25.2

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
@@ -1,12 +1,25 @@
1
- # toolmenu
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/niksa90/toolmenu/main/docs/logo.svg" width="120" height="120" alt="toolmenu logo: a plug with a list of tools, one checked">
3
+ </p>
4
+
5
+ <h1 align="center">toolmenu</h1>
6
+
7
+ <p align="center">
8
+ <b>Checks for MCP servers' tool lists: changes that confuse agents, break prompt caches or break clients, caught before your users hit them.</b>
9
+ </p>
10
+
11
+ <p align="center">
2
12
 
3
13
  [![npm](https://img.shields.io/npm/v/toolmenu)](https://www.npmjs.com/package/toolmenu)
4
- [![ci](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml/badge.svg)](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml)
5
- [![license: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/niksa90/toolmenu/blob/main/LICENSE)
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)
14
+ [![ci](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml/badge.svg)](https://github.com/niksa90/toolmenu/actions/workflows/ci.yml)
15
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/niksa90/toolmenu/blob/main/LICENSE)
16
+ [![MCP: 2026-07-28 and 2025](https://img.shields.io/badge/MCP-2026--07--28%20%C2%B7%202025-6E56CF)](https://modelcontextprotocol.io)
17
+ [![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)
18
+ [![toolmenu MCP server on Glama](https://glama.ai/mcp/servers/niksa90/toolmenu/badges/score.svg)](https://glama.ai/mcp/servers/niksa90/toolmenu)
19
+ [![toolmenu MCP on mcprush](https://mcprush.com/badge/toolmenu-mcp/score.svg)](https://mcprush.com/to/toolmenu-mcp?ref=badge)
20
+ [![Listed on mcpservers.org](https://mcpservers.org/badge.svg)](https://mcpservers.org/servers/niksa90/toolmenu)
8
21
 
9
- **Checks for MCP servers' tool lists: changes that confuse agents, break prompt caches or break clients, caught before your users hit them.**
22
+ </p>
10
23
 
11
24
  Your MCP server's tool list is the menu every agent reads before it does anything.
12
25
  toolmenu checks that menu the way clients and agents will meet it: across calls,
@@ -30,6 +43,7 @@ npx toolmenu init -- node dist/server.js # CI: a baseline, a workflow,
30
43
  | **MCP Apps, Tasks, Server Cards** | It reads `ui://` resources as a host does and checks who may see each tool. It catches tasks sent to clients that can't poll them, and Server Cards that contradict the live server. |
31
44
  | **Your client's view** | `--client claude-code \| claude-api-search \| openai` shows what each client loads, cuts, can find and refuses. |
32
45
  | **What agents misread** | It flags vague `id`s, IDs no tool returns, instructions buried late in descriptions, and writes without annotations or marked read-only. |
46
+ | **Words routing to the wrong tool** | `routes.yml` pins which tool each keyword must (and must not) reach, the way a keyword or BM25 tool search sees the menu. A description edit that lets `get_audit_trail` win "audit" fails the check, with no model and no eval budget. [More](#snapshot-rules) |
33
47
  | **Menus that drift** | It catches defaults built from the clock or a hash order, menus that differ per process, per connection or offline, and listings that depend on who asks. |
34
48
 
35
49
  Every finding says what's wrong, where it is and what toolmenu saw, and ends with a `→ Next:` step.
@@ -189,6 +203,33 @@ Relative paths resolve from the folder `toolmenu mcp` runs in, or a call's `cwd`
189
203
  clients ask before each tool call unless you allow it. toolmenu's own menu passes its
190
204
  checks with no findings, on both protocols and in a session (the test suite checks).
191
205
 
206
+ ## As a library
207
+
208
+ Everything the CLI does is exported from the `toolmenu` package, with types, for test
209
+ suites and scripts of your own:
210
+
211
+ ```js
212
+ import { snapshot, diffMenus, loadMenu, session, loadScenario } from 'toolmenu';
213
+
214
+ // The menu and its findings, as `toolmenu snapshot` gives them.
215
+ const { menu, findings } = await snapshot({ kind: 'stdio', command: 'node', args: ['dist/server.js'] });
216
+ // or { kind: 'http', url: 'https://example.com/mcp', headers: { Authorization: `Bearer ${token}` } }
217
+
218
+ // What changed since the committed baseline, and the version bump it needs.
219
+ const diff = diffMenus(await loadMenu('menu.json'), menu);
220
+ console.log(diff.suggestedBump, diff.tokens);
221
+ if (diff.findings.some((f) => f.severity === 'error')) process.exitCode = 1;
222
+ ```
223
+
224
+ `snapshot`, `diffMenus`, `session` and `history` take the same options as their
225
+ commands (`SnapshotOptions`, `DiffOptions`, `SessionOptions`, `HistoryOptions`) and
226
+ return the findings the reports print: each `Finding` has its `rule`, `severity`,
227
+ `message`, `tool` and the `fix` shown as `→ Next:`. Lower down, `compareMenus(before,
228
+ after)` returns each tool's change (`ToolChange[]`) and `runRules` runs the menu rules
229
+ on a menu you built. The `menu.json` format is the `Menu` type (`toolmenu: 1`);
230
+ a later format will bump that number. Library functions don't print or exit: that's
231
+ the CLI's job.
232
+
192
233
  ## In CI: one PR comment
193
234
 
194
235
  ```yaml
@@ -205,7 +246,7 @@ jobs:
205
246
  - uses: actions/setup-node@v7
206
247
  with: { node-version: 22 }
207
248
  - run: npm ci && npm run build
208
- - uses: niksa90/toolmenu@v0.25.0
249
+ - uses: niksa90/toolmenu@v0.25.2
209
250
  with:
210
251
  command: node dist/server.js
211
252
  baseline: menu.json # your committed snapshot
@@ -253,7 +294,7 @@ permissions:
253
294
  security-events: write # to upload SARIF
254
295
  steps:
255
296
  # … checkout, build, as above
256
- - uses: niksa90/toolmenu@v0.25.0
297
+ - uses: niksa90/toolmenu@v0.25.2
257
298
  with:
258
299
  command: node dist/server.js
259
300
  sarif: toolmenu-sarif
@@ -267,6 +308,32 @@ Outside the Action: `toolmenu snapshot --sarif toolmenu.sarif -- node dist/serve
267
308
  writes the file beside the usual report (`diff` and `session` take `--sarif` too), or
268
309
  `--format sarif` prints it instead.
269
310
 
311
+ ### Other CI systems: JUnit test reports
312
+
313
+ GitLab, Jenkins, Azure DevOps, CircleCI and Buildkite show JUnit XML as test results.
314
+ `--junit <path>` writes the findings of `snapshot`, `diff` or `session` as JUnit beside
315
+ the usual report (`--format junit` prints it instead). New in 0.25.2. Each finding is a test case named
316
+ after its tool, in a class named after its rule (`toolmenu.diff.diff/removed`), so the
317
+ CI system tracks it across runs. Findings at or above `--fail-on` are failures, the rest
318
+ pass with their text, so the test report agrees with the exit code. A clean run is one
319
+ passing case.
320
+
321
+ ```yaml
322
+ # .gitlab-ci.yml
323
+ toolmenu:
324
+ image: node:22
325
+ script:
326
+ - npm ci && npm run build
327
+ # Exit 1 means findings: keep going so both reports are written, then fail.
328
+ - npx toolmenu snapshot --out new-menu.json --junit snapshot.xml -- node dist/server.js || code=$?
329
+ - npx toolmenu diff menu.json new-menu.json --junit diff.xml || code=$?
330
+ - exit ${code:-0}
331
+ artifacts:
332
+ when: always
333
+ reports:
334
+ junit: [snapshot.xml, diff.xml]
335
+ ```
336
+
270
337
  ### A badge for your README
271
338
 
272
339
  ```sh
@@ -645,7 +712,9 @@ toolmenu sees what the server sends. Plenty of agent failures happen elsewhere:
645
712
  --no-write don't write the menu file
646
713
  --routes <path> routes.yml
647
714
  --config <path> config file (default: toolmenu.config.json, if present)
648
- --format <fmt> text (default), json, github (annotations) or markdown
715
+ --format <fmt> text (default), json, github (annotations), markdown, sarif
716
+ (code scanning) or junit (CI test reports)
717
+ --junit <path> snapshot, diff, session: also write the findings as JUnit XML
649
718
  --fail-on <level> error (default), warn or info
650
719
  --header <k: v> HTTP header, repeatable
651
720
  --env <K=V> env var for a stdio server, repeatable (it only gets a
package/dist/apps.js CHANGED
@@ -47,6 +47,8 @@ export function agentMenu(menu) {
47
47
  const tokens = tools.reduce((n, t) => n + t.tokens, 0);
48
48
  return { shown: { ...menu, tools, totalTokens: tokens }, appOnly: { tools: menu.tools.length - tools.length, tokens: menu.totalTokens - tokens } };
49
49
  }
50
+ /** Below this much time left before the deadline, a read isn't started. */
51
+ const MIN_READ_MS = 10;
50
52
  /**
51
53
  * Read each `ui://` resource the menu's tools name (resources/read: a read, not a tool
52
54
  * call), at most `limit` of them. Each is read once, however many tools name it.
@@ -66,7 +68,8 @@ export async function readAppResources(connection, tools, timeoutMs = 30_000, li
66
68
  const readOne = async (i) => {
67
69
  const [uri, names] = queue[i];
68
70
  const left = deadline - Date.now();
69
- if (left <= 0) {
71
+ // A read given a few milliseconds can only time out: past the deadline in all but name.
72
+ if (left < MIN_READ_MS) {
70
73
  out[i] = { uri, tools: names, error: `not read: the reads took longer than ${Math.round((2 * timeoutMs) / 1000)} s in all` };
71
74
  return;
72
75
  }
package/dist/cli.js CHANGED
@@ -24,6 +24,7 @@ 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
26
  import { toSarif } from './sarif.js';
27
+ import { toJunit } from './junit.js';
27
28
  import { badge, badgeMarkdown } from './badge.js';
28
29
  import { VERSION } from './version.js';
29
30
  import { SECRET_ARGS_ENV } from './mcp-env.js';
@@ -81,24 +82,36 @@ export async function main(given) {
81
82
  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`);
82
83
  }
83
84
  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))
85
+ if (!['text', 'json', 'github', 'markdown', 'sarif', 'junit'].includes(asked))
86
+ throw new UsageError(`--format must be text, json, github, markdown, sarif or junit`);
87
+ // SARIF and JUnit are findings files, for code scanning and CI test reports: --format
88
+ // sarif|junit prints one instead of the report, --sarif / --junit <path> writes it beside the report.
89
+ const fileCommands = ['snapshot', 'diff', 'session'];
90
+ if ((asked === 'sarif' || values.sarif !== undefined || values['sarif-menu'] !== undefined) && !fileCommands.includes(sub))
90
91
  throw new UsageError(`SARIF output (--format sarif, --sarif, --sarif-menu) goes with snapshot, diff or session; ${sub} has none.`);
92
+ if ((asked === 'junit' || values.junit !== undefined) && !fileCommands.includes(sub))
93
+ throw new UsageError(`JUnit output (--format junit, --junit) goes with snapshot, diff or session; ${sub} has none.`);
91
94
  if (sub === 'session' && (values.plan || values.init) && (asked === 'sarif' || values.sarif !== undefined))
92
95
  throw new UsageError('SARIF needs findings: --plan and --init run nothing.');
96
+ if (sub === 'session' && (values.plan || values.init) && (asked === 'junit' || values.junit !== undefined))
97
+ throw new UsageError('JUnit needs findings: --plan and --init run nothing.');
93
98
  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. */
99
+ const junitToStdout = asked === 'junit';
100
+ const format = (sarifToStdout || junitToStdout ? 'text' : asked);
101
+ /** Print the report, or the SARIF / JUnit file with --format sarif|junit; write --sarif's and --junit's files too. */
96
102
  const emit = async (report, findings, command, menuPath) => {
97
103
  const menu = values['sarif-menu'] ?? menuPath;
104
+ const sarif = values.sarif !== undefined || sarifToStdout ? toSarif(findings, { command, menuPath: menu }) + '\n' : undefined;
105
+ // session's menuPath is where SARIF points, not what it checked (a live server): no target there.
106
+ const junit = values.junit !== undefined || junitToStdout ? toJunit(findings, { command, failOn, target: command === 'session' ? undefined : menuPath }) + '\n' : undefined;
98
107
  if (values.sarif !== undefined)
99
- await writeFile(values.sarif, toSarif(findings, { command, menuPath: menu }) + '\n');
108
+ await writeFile(values.sarif, sarif);
109
+ if (values.junit !== undefined)
110
+ await writeFile(values.junit, junit);
100
111
  if (sarifToStdout)
101
- process.stdout.write(toSarif(findings, { command, menuPath: menu }) + '\n');
112
+ process.stdout.write(sarif);
113
+ else if (junitToStdout)
114
+ process.stdout.write(junit);
102
115
  else if (report)
103
116
  process.stdout.write(show(report) + '\n');
104
117
  };
package/dist/help.js CHANGED
@@ -12,9 +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), markdown (PR comments)', 'or sarif (code scanning; snapshot, diff and session)']],
15
+ format: ['--format <fmt>', ['text (default), json, github (annotations), markdown (PR comments)', 'sarif (code scanning) or junit (CI test reports); sarif and junit: snapshot,', 'diff and session']],
16
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
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
+ junit: ['--junit <path>', ['also write the findings as JUnit XML to this file, for CI test reports', '(GitLab, Jenkins, Azure DevOps, CircleCI): findings at --fail-on or above fail']],
18
19
  '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)']],
19
20
  json: ['--json', ['same as --format json']],
20
21
  'fail-on': ['--fail-on <level>', ['exit 1 on findings at this level or above: error (default), warn, info']],
@@ -88,7 +89,7 @@ const HELP = {
88
89
  'reports what in the menu confuses agents or breaks prompt caches.',
89
90
  SERVER_NOTE,
90
91
  ],
91
- own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check', 'sarif', 'sarif-menu', 'badge'],
92
+ own: ['out', 'no-write', 'routes', 'catalog', 'as', 'client', 'lists', 'offline-check', 'sarif', 'sarif-menu', 'junit', 'badge'],
92
93
  shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
93
94
  examples: [
94
95
  'toolmenu snapshot -- npx -y @modelcontextprotocol/server-memory',
@@ -100,7 +101,7 @@ const HELP = {
100
101
  summary: 'compare two menu files: breaking changes, token change, semver bump',
101
102
  usage: ['toolmenu diff [options] <old.json> <new.json>'],
102
103
  about: ['Compares two menus written by snapshot (or session --union-out). Starts no server.'],
103
- own: ['release', 'server-version-is-release', 'sarif', 'sarif-menu'],
104
+ own: ['release', 'server-version-is-release', 'sarif', 'sarif-menu', 'junit'],
104
105
  shared: ['config', 'format', 'json', 'fail-on'],
105
106
  examples: ['toolmenu diff menu.json new-menu.json', 'toolmenu diff --release 1.4.0..1.5.0 --format markdown old.json new.json'],
106
107
  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"],
@@ -118,7 +119,7 @@ const HELP = {
118
119
  'prompt cache, a different menu in a fresh process.',
119
120
  SERVER_NOTE,
120
121
  ],
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'],
122
+ 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', 'junit'],
122
123
  shared: ['config', 'format', 'json', 'fail-on', 'header', 'env', 'no-auth', 'protocol', 'timeout', 'processes'],
123
124
  examples: [
124
125
  'toolmenu session --auto -- node dist/index.js',
@@ -0,0 +1,12 @@
1
+ import { type Finding, type Severity } from './types.js';
2
+ export interface JunitOptions {
3
+ /** snapshot, diff or session: the suite's name. */
4
+ command: string;
5
+ /** Findings at or above this level fail (default: error, as --fail-on). */
6
+ failOn?: Severity;
7
+ /** The menu file or server checked, shown as the suite's property. */
8
+ target?: string;
9
+ }
10
+ /** Text that is safe inside an XML attribute or element, control characters dropped. */
11
+ export declare function xml(text: string): string;
12
+ export declare function toJunit(findings: Finding[], options: JunitOptions): string;
package/dist/junit.js ADDED
@@ -0,0 +1,78 @@
1
+ /*
2
+ * JUnit XML output, for CI systems that show test results natively: GitLab merge
3
+ * requests, Jenkins, Azure DevOps, CircleCI, Buildkite and GitHub test-report actions.
4
+ *
5
+ * Each finding is one test case. Findings at or above --fail-on are <failure>s, so the
6
+ * test report agrees with the exit code; findings below it pass, with their text in
7
+ * <system-out>. A run with no findings is one passing case, so the CI system records
8
+ * that the check ran rather than finding an empty report.
9
+ *
10
+ * A case's name is the tool it's about (and which of that rule's findings on that
11
+ * tool), not the message: messages carry counts that change between runs, and CI
12
+ * systems track a test's history by its name.
13
+ */
14
+ import { SEVERITY_RANK } from './types.js';
15
+ import { VERSION } from './version.js';
16
+ import { toolsOf } from './sarif.js';
17
+ /** Text that is safe inside an XML attribute or element, control characters dropped. */
18
+ export function xml(text) {
19
+ return text
20
+ .replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F￾￿]/g, '')
21
+ .replace(/&/g, '&amp;')
22
+ .replace(/</g, '&lt;')
23
+ .replace(/>/g, '&gt;')
24
+ .replace(/"/g, '&quot;');
25
+ }
26
+ function body(f) {
27
+ return [
28
+ f.message,
29
+ ...(f.detail ?? []),
30
+ ...(f.step !== undefined ? [`step: ${f.steps?.length ? f.steps.join(', ') : f.step}`] : []),
31
+ ...(f.fix ? [`→ Next: ${f.fix}`] : []),
32
+ ...(f.confidence === 'unsure' ? ['(unsure: a heuristic, from names and words)'] : []),
33
+ `toolmenu explain ${f.rule}`,
34
+ ].join('\n');
35
+ }
36
+ export function toJunit(findings, options) {
37
+ const failOn = options.failOn ?? 'error';
38
+ const suite = `toolmenu ${options.command}`;
39
+ const seen = new Map();
40
+ const cases = [];
41
+ let failures = 0;
42
+ for (const f of findings) {
43
+ const tools = toolsOf(f);
44
+ // One case per tool, as SARIF has one result per tool.
45
+ for (const tool of tools.length ? tools : [undefined]) {
46
+ const key = `${f.rule}\u0000${tool ?? ''}`;
47
+ const nth = seen.get(key) ?? 0;
48
+ seen.set(key, nth + 1);
49
+ const name = `${tool ?? '(menu)'}${nth ? ` #${nth + 1}` : ''}`;
50
+ const open = ` <testcase classname="${xml(`toolmenu.${options.command}.${f.rule}`)}" name="${xml(name)}" time="0">`;
51
+ if (SEVERITY_RANK[f.severity] >= SEVERITY_RANK[failOn]) {
52
+ failures++;
53
+ cases.push(`${open}\n <failure type="${f.severity}" message="${xml(f.message)}">${xml(body(f))}</failure>\n </testcase>`);
54
+ }
55
+ else {
56
+ cases.push(`${open}\n <system-out>${xml(`${f.severity}: ${body(f)}`)}</system-out>\n </testcase>`);
57
+ }
58
+ }
59
+ }
60
+ if (!cases.length)
61
+ cases.push(` <testcase classname="${xml(`toolmenu.${options.command}`)}" name="no findings" time="0"/>`);
62
+ const properties = [
63
+ ` <property name="toolmenu.version" value="${xml(VERSION)}"/>`,
64
+ ` <property name="fail-on" value="${failOn}"/>`,
65
+ ...(options.target ? [` <property name="target" value="${xml(options.target)}"/>`] : []),
66
+ ];
67
+ return [
68
+ '<?xml version="1.0" encoding="UTF-8"?>',
69
+ `<testsuites name="toolmenu" tests="${cases.length}" failures="${failures}" errors="0" time="0">`,
70
+ ` <testsuite name="${xml(suite)}" tests="${cases.length}" failures="${failures}" errors="0" skipped="0" time="0">`,
71
+ ' <properties>',
72
+ ...properties,
73
+ ' </properties>',
74
+ ...cases,
75
+ ' </testsuite>',
76
+ '</testsuites>',
77
+ ].join('\n');
78
+ }
package/dist/mcp.js CHANGED
@@ -170,6 +170,16 @@ export function serverArgs(a) {
170
170
  return { error: 'env goes with command: an HTTP server is already running. Use headers for credentials.' };
171
171
  if (!/^https?:\/\//.test(a.url))
172
172
  return { error: `url must be an http(s) URL; got "${a.url}". For a stdio server, give command.` };
173
+ let parsed;
174
+ try {
175
+ parsed = new URL(a.url);
176
+ }
177
+ catch {
178
+ return { error: 'url is not a valid URL. Give a Streamable HTTP endpoint such as https://example.com/mcp.' };
179
+ }
180
+ // Arguments are visible to other local users (ps), so credentials can't ride in the URL.
181
+ if (parsed.username || parsed.password)
182
+ return { error: 'Credentials must be passed using headers, not embedded in the URL: drop the user:password@ part and give e.g. {"Authorization": "Basic ..."} in headers.' };
173
183
  return { before: [a.url], secret: Object.entries(a.headers ?? {}).flatMap(([k, v]) => ['--header', `${k}: ${v}`]), after: [] };
174
184
  }
175
185
  if (a.headers && Object.keys(a.headers).length)
package/dist/options.d.ts CHANGED
@@ -5,6 +5,9 @@ export declare const CLI_OPTIONS: {
5
5
  readonly sarif: {
6
6
  readonly type: 'string';
7
7
  };
8
+ readonly junit: {
9
+ readonly type: 'string';
10
+ };
8
11
  readonly badge: {
9
12
  readonly type: 'string';
10
13
  };
package/dist/options.js CHANGED
@@ -5,6 +5,7 @@
5
5
  export const CLI_OPTIONS = {
6
6
  out: { type: 'string' },
7
7
  sarif: { type: 'string' },
8
+ junit: { type: 'string' },
8
9
  badge: { type: 'string' },
9
10
  'sarif-menu': { type: 'string' },
10
11
  'out-dir': { type: 'string' },
package/dist/sarif.d.ts CHANGED
@@ -11,4 +11,6 @@ export interface SarifOptions {
11
11
  export declare function repoRoot(from?: string): string;
12
12
  /** The line of each tool's "name" in a menu file written by toolmenu (1-based). */
13
13
  export declare function toolLines(text: string): Map<string, number>;
14
+ /** The tools a finding is about: its tool, or each tool of a change found in several. JUnit uses it too. */
15
+ export declare function toolsOf(f: Finding): string[];
14
16
  export declare function toSarif(findings: Finding[], options: SarifOptions): string;
package/dist/sarif.js CHANGED
@@ -46,8 +46,8 @@ export function toolLines(text) {
46
46
  }
47
47
  return lines;
48
48
  }
49
- /** The tools a finding is about: its tool, or each tool of a change found in several. */
50
- function toolsOf(f) {
49
+ /** The tools a finding is about: its tool, or each tool of a change found in several. JUnit uses it too. */
50
+ export function toolsOf(f) {
51
51
  const several = f.tools;
52
52
  if (Array.isArray(several))
53
53
  return several.filter((t) => typeof t === 'string');
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "toolmenu",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
+ "mcpName": "io.github.niksa90/toolmenu",
4
5
  "description": "Lint your MCP server's tool menu for changes that confuse agents or break caches.",
5
6
  "author": "Nikša Perović (https://niksa.me)",
6
7
  "main": "dist/index.js",