@vantageos/mcp-doctor 0.19.0 → 0.20.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/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to `@vantageos/mcp-doctor` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/).
5
5
  Unreleased changes live as one fragment per pull request in `changelog.d/`, folded in here at release time.
6
6
 
7
+ ## 0.20.0 — 2026-11-10
8
+
9
+ ### Added
10
+ - **C-40 scores tool documentation per tool and per criterion, on what the server serves.** It implements ElPi-Corp #331 (trunk v2.16, read at its merge `941156e5`). Every served tool gets one verdict on each of eight criteria: title; description; the four behaviour hints as booleans; every input field described; no input description restating its schema (an enum list, a bound, the pattern, an opening "Optional", a default value in prose); an `…Id` / `…Ids` / `…Cursor` / `…By` field naming its source, an example or its convention; an output schema; every output property described and every field listed as returned present in it. The verdict carries a per-criterion tally and one line per failing tool and criterion. On the state Manufact reviewed (vantage-peers `427e74c`) it flags 18 of the 27 input fields Manufact named, plus 22 of the same form, and exactly Manufact's 44 tools with no output schema; on the fixed live server it flags none of those input fields. It was proved on four servers it did not write (server-everything 2.2.1, server-memory 2.1.0, server-filesystem 2.2.0, vantage-peers): one injected violation per form, each landed, red and restored. The introspector now also records `idempotentHint` and `openWorldHint`. **Behaviour change:** on an MCP server tree, C-40's static run is could-not-judge, because documentation is read on the served tools/list. A publish gate must declare it in `mcp-doctor.owed.json` or read it with `--mode=both`. Documented in `analysis/manufact-rules.md` (EN, FR). Also, the upstream-request analysis (S-13, S-38, S-39) now scans each file's calls once per run instead of once per followed function name, and derives its requesting-function closure once per tree: verdicts unchanged, and mcp-doctor's own tree scans in about 7 s instead of about 30 s, which had pushed the real-repo case of `tests/skipped-dirs-report.test.ts` past its 60 s timeout under full-suite load. (README: #what-it-checks-mcp-2026-07-28)
11
+ - **Five detectors close the Manufact quality score gap: C-37, C-38, S-49, S-50, A-13.** They implement ElPi-Corp #325 (`7e5513ef`). S-49 reads the served server metadata. S-50 reads the server card and the setup page at the MCP URL. C-37 reads a listing proof for each directory host. C-38 reads Claude Code's 2 KB budget on descriptions and instructions. A-13 reads `openai/toolInvocation` on App tools. Each was proved red on Manufact's failed checks for vantage-peers (its 2026-11-08 report and the served answer, committed under `fixtures/manufact-vantage-peers-2026-11-08/`). The introspector now also records the `initialize` instructions, the tools' `_meta`, and the credential-free S-50 reads. **Behaviour change:** on an MCP server, S-49's static run is could-not-judge, because instructions and capabilities are served. A publish gate must declare it in `mcp-doctor.owed.json` or read it with `--mode=both`. The rules are documented in `analysis/manufact-rules.md` (EN, FR), linked from the README. (README: #what-it-checks-mcp-2026-07-28)
12
+
13
+ ### Changed
14
+ - **C-10 checks an `indexed-*` claim against the data layer's source, and the R-4 reader moves into the kit.** C10 reads a Convex data layer through `scanR4FilterPaths`, now exported at `@vantageos/mcp-doctor/source` (moved unchanged from backend-doctor, one copy). It is red when a filter path scans while the tool claims an indexed mechanism, as in vantage-peers `6c6ff5f2` (39 paths). It is could-not-judge, never present, when no data-layer source confirms the claim. Behaviour change: such a row now needs an owed declaration under `--gate`. `typescript` becomes a runtime dependency. (README: #c-10-reads-the-data-layer-v212)
15
+ - **C19 accepts a when-to-use clause and refuses the widening clause.** C-19 required "use this whenever … even if they don't say …", which invites a call beyond the user's request and is what C-39 refuses, so no served description could pass both. Following mcp-standard v2.17 (ElPi-Corp #339), the trigger is a when-to-use clause in one of the forms the standard names, and the widening clause is non-conforming, named. On the VantagePeers list served on 2026-11-09 (92 tools), the trigger half reds 3 tools instead of 92. (README: #c19-reads-a-when-to-use-clause-never-a-widening-clause)
16
+ - **A `--url` scan refuses an internal target.** Before any request, the target's host is resolved (A and AAAA) and the scan is refused, naming the address and its block, when an address falls in a block of the IANA special-purpose registries that is not globally reachable — loopback, private, link-local (including the cloud metadata address 169.254.169.254), unique-local (including fd00:ec2::254), carrier-grade NAT, documentation, benchmarking, local-use NAT64 (64:ff9b:1::/48), Teredo and the others — or in multicast. The refused blocks are generated from the two registries pinned in the repository (`scripts/iana-special.mjs`, `--check` refuses a stale table); the most specific block holding the address decides, and a block whose reachability the registry does not state is refused. An IPv4-mapped, NAT64 (64:ff9b::/96) or 6to4 (2002::/16) address is judged by the IPv4 address it carries, and a host that does not resolve is refused. The owner of a local or internal server passes `--allow-private-target`. The same check runs in `introspectEndpoint` and `runEventsReady` for programmatic callers. Every request already stays on the target's origin and never follows a redirect. Declared limit: the resolution is read once at scan start (DNS rebinding afterwards is not re-checked). **Behaviour change:** scanning `http://localhost` or `127.0.0.1` now needs the flag. (README: #options)
17
+ - **A `--url` scan is read-only: no `tools/call` without `--allow-tool-calls`.** Until now a remote scan called the tools the target itself declared `readOnlyHint: true` (the S-2 safe call, C-11's cursor probe), and the events probe sent its `--events-trigger` call: a hint written by the server about itself decided whether a live server was called. Now no `tools/call` reaches a live server unless its owner passes `--allow-tool-calls`; the probes that need a call are could-not-judge, naming the flag, and `--events-trigger` without it is refused (exit 1). `--allow-tool-calls` without `--url` is a usage error. **Behaviour change** for anyone scanning their own server who relied on those calls: add the flag. (README: #options)
18
+
19
+ ### Fixed
20
+ - **C-10 follow-up: the foreign probe and the evidence catch up with v2.12.** `scripts/c9-c10-c12-foreign-bite-probe.sh` expects could-not-judge for C10 on its foreign tool, which has no data layer, and asserts the reason. #137 had left that probe red on main. The real-material poles are committed as tests with their origin: vantage-peers `6c6ff5f2` is red, and the version reduced from `cf745752` is green. The README states that attribution is per tree, not per tool (Eta's corrections on #137). (README: #c-10-reads-the-data-layer-v212)
21
+ - **The foreign-probe runner pins its sibling repositories.** When it clones them, it checks out vantage-mcp-boilerplate `a772895e` and vantage-peers `a22a021c` and exports `BP_REF` / `VP_REF` to those commits, so a sibling's main moving cannot change a verdict between two runs. Each run prints the commit read, and a pin the remote does not hold exits 2. A caller-supplied repository or ref still wins (Eta on #133). (README: #c-10-reads-the-data-layer-v212)
22
+ - **A served tool list larger than a pipe buffer is read whole.** The introspector wrote its result to stdout and exited in the same tick; stdout is a pipe, so only about the first 146 KB arrived and the doctor read the rest as "non-JSON output". Every served rule then came back could-not-judge: on VantagePeers (92 tools), 22 of 22. The introspector now exits once the write has drained, writes its result once, and stops cleanly when the server cannot be spawned. On VantagePeers the same run now reads all 92 tools: 7 present, 5 non-conforming, 10 could-not-judge. (README: #options)
23
+
7
24
  ## 0.19.0 — 2026-11-07
8
25
 
9
26
  ### Added
package/README.md CHANGED
@@ -69,6 +69,10 @@ usage: mcp-doctor <source-tree-path> [--mode=static|dynamic|both] [--backend=<co
69
69
  --bearer-env VAR send the token held in environment variable VAR as 'Authorization: Bearer'
70
70
  (the token never appears on a command line or in output)
71
71
  --header "Name: value" an extra request header (repeatable); values are never printed
72
+ --allow-private-target with --url: the owner's consent to scan a host that resolves to an address
73
+ that is not globally reachable (IANA registries); without it such a target is refused
74
+ --allow-tool-calls with --url: the server owner's consent to tools/call; without it the scan is
75
+ read-only and every check that needs a live call says could-not-judge
72
76
  --source DIR with --url: the server's source tree, for D8 eval counts and the C-25 expected
73
77
  commit (git rev-parse HEAD there)
74
78
  --expected-commit SHA with --url: the full commit id the server must serve (C-25)
@@ -294,8 +298,25 @@ const cov = ruleCoverage(ids, checkedRuleIds(REGISTRY), Object.keys(NOT_CHECKABL
294
298
 
295
299
  `State` and `DetectorResult` are also exported as types.
296
300
 
301
+ ### Source reader (`@vantageos/mcp-doctor/source`)
302
+
303
+ The source-tree reader the doctors share is served at the subpath `@vantageos/mcp-doctor/source`: the TypeScript
304
+ AST helpers (`parseFile`, `registrations`, `indexFunctions`, `walk`, ...), the scan primitives (`Site`, `Scan`,
305
+ `emptyScan`, `isJudgeable`), the caller-taint helpers (`declaredNames`, `readsTainted`) and the R-4 filter-path scan
306
+ `scanR4FilterPaths(files)`. It moved here unchanged from backend-doctor (R-4 source half, backend-doctor PR #99), so
307
+ mcp-doctor's C-10 and backend-doctor's R-4 read a data layer with one copy of the same code. `typescript` is now a
308
+ runtime dependency of this package, because the reader parses the source at run time.
309
+
310
+ ```ts
311
+ import { scanR4FilterPaths } from "@vantageos/mcp-doctor/source";
312
+
313
+ const scan = scanR4FilterPaths(tree.files); // { conform, violate, cnj, reads }
314
+ ```
315
+
297
316
  ## What it checks (MCP 2026-07-28)
298
317
 
318
+ C-37, C-38, S-49, S-50, A-13 (Manufact score): [analysis/manufact-rules.md](analysis/manufact-rules.md) (EN, FR).
319
+
299
320
  Each detector maps one standard item and is proven **bipolar** on real material: a genuine defect
300
321
  (MUST_FLAG) and a genuine conformant site (MUST_PASS).
301
322
 
@@ -326,7 +347,7 @@ Registered detectors that no description table above or below documents, in regi
326
347
  | **C7** artifact-verifiable | C-7 | `README.md` / `README.fr.md`: one-command install naming a registry, version pin, two obtain channels, provenance or checksum | present / non-conforming / could-not-judge |
327
348
  | **C8** authority-declared | C-8 | each registered tool's `authRead` / `authWrite` pair in the closed 5-tier set (a folded `auth` refused) | absent (no tool) / present / non-conforming / could-not-judge |
328
349
  | **C9** verb-declared | C-9 | each registered tool's `annotations.verb` in the closed set (`rpc` refused) | absent (no tool) / present / non-conforming / could-not-judge |
329
- | **C10** mechanism-declared | C-10 | each list/search tool's `annotations.searchMechanism` in the closed set (`unindexed-scan` refused) | absent (no list/search tool) / present / non-conforming / could-not-judge |
350
+ | **C10** mechanism-declared | C-10 | each list/search tool's `annotations.searchMechanism` in the closed set (`unindexed-scan` refused); an `indexed-*` claim checked against the data layer's source on every filter path (see [C-10 reads the data layer](#c-10-reads-the-data-layer-v212)) | absent (no list/search tool) / present / non-conforming / could-not-judge |
330
351
  | **C11** pagination-declared-applied | C-11 | each list/search tool's cursor, default and finite max in its annotations or `inputSchema` | absent (no paginable tool) / present / non-conforming / could-not-judge |
331
352
  | **C12** no-duplicates | C-12 | the (verb, table, mechanism) triplet of every tool declaring verb and table | absent (no tool) / present / non-conforming / could-not-judge |
332
353
  | **C13** context-ceiling | C-13 | each tool's `tokensEstimeContexte` against the declared (global, perTool) context ceiling | absent (no tool) / present / non-conforming / could-not-judge |
@@ -810,6 +831,14 @@ the browser-origin allow-list of `/mcp`, and S-22 no longer reads it as one. The
810
831
  locales JSON (`<module dir>/locales/<locale>.json`) when `t` is imported from a relative module that names those
811
832
  files. D10 accepts the French text only from the `fr` locale. Any other form is could-not-judge, naming why.
812
833
 
834
+ #### C19 reads a when-to-use clause, never a widening clause
835
+
836
+ A served description passes the trigger half of C-19 when it says when the tool applies, in a form mcp-standard
837
+ v2.17 names: `WHEN:`, `Use when`, `Use it/this/this tool when`, `Use for`, `QUAND :`, `À utiliser quand/lorsque`,
838
+ `Utiliser quand/lorsque`. The skill clause "use this whenever … even if they don't say …" (FR "même s'il ne le dit
839
+ pas", either apostrophe), in any wording of that clause (a use verb shortly followed by "whenever", "even if … do not say/mention/ask", "même si … ne le dit pas"), is non-conforming and named: it invites a call beyond the user's request, which C-39
840
+ refuses, so no description could pass both rules before.
841
+
813
842
  #### D16 credits a version served from mcp-server.json
814
843
 
815
844
  `/health` serving `manifest.version`, with `manifest` from @vantageos/mcp-boilerplate's `loadServerManifest`, reads
@@ -848,6 +877,23 @@ argument; `z.preprocess(fn, inner)` is judged by `inner`. S-42, also written at
848
877
 
849
878
  **Limit, declared.** An outbound call is recognised through `fetch`, `axios`, `got`, `ky`, `node:http(s)`, `undici` and the other HTTP-client modules named in `HTTP_CLIENT_MODULE` (`src/detectors/upstreamKit.ts`). A server that reaches its upstream only through a vendor SDK outside that list, under a name the scan does not know, reads `absent` on S36..S41: the doctor does not see the call. A tool registered from a definitions array, or a handler passed by reference, is could-not-judge naming the registration call.
850
879
 
880
+ ### C-10 reads the data layer (v2.12)
881
+
882
+ C-10 (mcp-standard v2.12, ElPi-Corp `ad7e4a11` / PR #324) treats a declared `indexed-*` mechanism as a claim that
883
+ the source must confirm. When the tree holds a Convex data layer (files under `convex/`), C10 reads every public
884
+ query door and the functions it reaches through `scanR4FilterPaths`. A read filtered in memory, on a caller
885
+ argument, over a field its index range does not bound is a scanning path, and C10 is non-conforming, quoting the
886
+ first three sites. A file that does not parse, or a path whose index range cannot be read, is could-not-judge.
887
+
888
+ **Behaviour change.** A list or search that claims an `indexed-*` mechanism with no data-layer source in the tree is
889
+ now **could-not-judge**, never present: no implementation confirms the declaration. Under `--gate`, that row is
890
+ refused until the server declares it in `mcp-doctor.owed.json` with its reason. `upstream-delegated` claims no
891
+ index and is unaffected; whether its predicate travels upstream is S-38's.
892
+
893
+ **Limits, declared.** Only a Convex data layer is read. **Attribution is per tree, not per tool:** a list whose own
894
+ path is indexed still reads red when any public query of the same tree scans, because the scan is not tied to one
895
+ tool (fail-closed). The verdict names the doors, so the reader sees which list scans. C10 applies the v2.12 text under the global pin `1c66e11c`.
896
+
851
897
  **C-10** accepts `upstream-delegated(<upstream>)`. It is red when the name is empty, a URL, or not a declared
852
898
  upstream. The standard does not fix how an upstream is declared, so the doctor reads an `upstreams` key, in a
853
899
  JSON manifest or in a TypeScript list or object. If no declaration is found, C-10 is could-not-judge.
@@ -866,6 +912,9 @@ bound or a typed error can now turn red on S-38 or S-39, where 0.8.x said nothin
866
912
  argument of each tool that takes one (`isError: true`, `structuredContent.error.code` = `invalid_cursor`).
867
913
  A tool is called only when it declares `readOnlyHint: true` and its `inputSchema.required` is well-formed and
868
914
  names nothing but `cursor`; any other tool is not called, and C-11 names why (could-not-judge for that tool).
915
+ With `--url` no tool is called at all unless the server's owner passes `--allow-tool-calls`: a `readOnlyHint` is the
916
+ target's own claim about itself, a hint and not a guarantee, so a public scan stays read-only; the probes that need a
917
+ call (S-2, C-11's tool half, the `--events-trigger` of the events probe) say so, naming the flag.
869
918
  **C-9** accepts `prepare` (a read verb). **C-13** reads the ceiling from the server manifest's
870
919
  `contextCeiling` as well as from a source constant. **S-22** resolves an `allowedOrigins` element held by a
871
920
  same-file const. **DLocalIdentity** does not count a hash over local file content. **D3 / D4** attribute a