@vantageos/mcp-doctor 0.17.0 → 0.19.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,38 @@ 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.19.0 — 2026-11-07
8
+
9
+ ### Added
10
+ - **`not-applicable`: a rule DECLARES its scope, and the engine decides it before running the detector.** A detector may carry an `isApplicable(tree): boolean` predicate; applicability is a property of the TARGET, decided once up front (so one static predicate governs the static, dynamic and served modes). When it returns false the engine pushes a synthetic `not-applicable` row and the detector's `run` is never called — the predicate failing IS the reason, so the row carries no `reason` and no `owedVerdict`. `not-applicable` is DECISIVE: it is not a fifth UNDECIDED state, it is not a could-not-judge (it stays out of that section), the gate treats it as clean (no violation, no undeclared, no stale), and it falls through to exit 0. `--json` gains a `byState` tally with every state as its own bin (every key present, zero stated not inferred). An `owedVerdict` on a `not-applicable` result is refused, as on any non-could-not-judge state. Proof: tests/not-applicable-state.test.ts (gate-before-run with a throwing run, no reason owed, exit 0, owedVerdict refused, out of the could-not-judge section, byState bin, gate clean) and tests/v080-owed-verdict.test.ts (the State union now ends in not-applicable; the owed field stays a field, no undecided state reopened). (README: #states-and-exit-codes)
11
+ - **A public doctor kit: the generic halves of what two downstream doctors each copied.** `deriveRuleIds` (rule ids from a vendored standard by a regex, a named error when the file is unreadable or nothing matches), `ruleCoverage`, `notCheckableResults`, `tallyRules` (one `STATE_RANK` typed over the whole `State` union, `not-applicable` included), `RegistryEntry` / `checkedRuleIds`, and `renderReport` / `writeReport`; a doctor now passes only its own constants. (README: #doctor-kit)
12
+
13
+ ### Changed
14
+ - **"Did not look" is never `absent`: eight sites now say what they measured.** Nothing measured is could-not-judge (exit 2), naming what was not measured: C21 on a static run of an MCP server (the connection load is measured live), D3 and D4 on an MCP server where nothing in the tree shapes a response, C26 when every deployment site is skipped as not npm-managed (C-26 is not npm-only). Four sites now read their rule's scope condition and quote it in the row: DServer14 and S5 (S-5, multi-tenant / multi-client: absent for a non-server or a stdio-only server, judged over HTTP with a tenancy statement, could-not-judge over HTTP with none or with no transport wired), A7 (A-7, an App or a tree that calls tools: absent when neither, an ungated App or call exposed as a site), S48 (S-48, force-installed for a member: absent for a non-server, could-not-judge for a server that signs no member in, because no tree states it). The server notion is one predicate shared by these reads (S-14's surface, SDK-first registration, tool surface, stdio transport). A static run of an MCP server therefore exits 2 until C21 (and S48 where no member signs in) is declared in the owed file for `--gate`. A11, C14, D16, C20, DAppI18n and C27 stay `absent` and are listed open in the README, pending the standard owner's decision on each rule's text. (README: #states-and-exit-codes)
15
+
16
+ ### Fixed
17
+ - **Ten detector sites no longer report "required and missing" as `absent`.** Where a rule applies and its required item is missing, the row is now non-conforming (exit 1) or, where the static read cannot decide, could-not-judge (exit 2), so the violation reaches the exit code and the publish gate: D9 and DExt8 (C-3, no `CHANGELOG.md`), DExt5 (C-1, an FR piece missing beside a manifest, as D10 already read it), D8 (C-5, tools registered and no `evals/evals.json`), D3 and D4 (S-2 / S-3, a hand-rolled builder writing neither field; could-not-judge on `@modelcontextprotocol/server` >= 2, whose served response is the one the rule reads), D6 (A-6, an App serving a `ui://` resource with no GA key), D12 (S-1, an MCP server with no transport signal is could-not-judge; D12 also reads a stdio `transport` declared in `mcp.json` / `mcp-server.json`, the surface the S-1 detector row names), DExt1 (E-1, a `defineExtension` call with no `identifier`, each call judged on its own), and D7 (its "hand-rolled builders" verdict is now decided by the hand-rolled builder reader, never asserted). Each site keeps `absent` where its rule does not govern the tree, proven per site on a plain-library fixture (exit 0). Fourteen `absent` sites still await a ruling and are named in the README. (README: #states-and-exit-codes)
18
+
19
+ ## 0.18.0 — 2026-11-02
20
+
21
+ ### Added
22
+ - **`--url URL --events-ready` probes a live server's MCP events contract (S-29 to S-33, the dynamic halves the static detectors owed).** The probe starts its own HTTPS receiver (self-signed certificate generated in memory at run time) and a loopback SSRF canary, then drives discover, `events/list`, `events/subscribe`, callback verification, signed delivery and `events/unsubscribe`. Ten checks, each present / non-conforming / could-not-judge: capability declared exactly when the methods answer (S-29); unauthenticated subscribe -32012, `http:` callback and malformed secrets -32602, the same subscription in another key order keeps its id (S-31); a signed verification envelope with a fresh challenge first, a non-echoing receiver refused with -32015 and a categorical `data.reason` without its body, no data before verification (S-32); five headers, `webhook-id` = `eventId`, `standardwebhooks` signature over the raw bytes, at most 262144 bytes, a retry with a new timestamp and signature, no replay after 410 / 413 (S-33); loopback callbacks refused and redirects never followed. With no public callback (`--events-callback-base`) or no trigger tool (`--events-trigger`) the checks that need them are could-not-judge, named. Proof: a fixture server conforming on every check and one mutation per check form (19), each red on its own check only. Adds the `standardwebhooks` dependency (MIT). (README: #added-in-0180--events-ready-probe-s-29-to-s-33-dynamic)
23
+ - **`--gate [--owed <file>]`: the publish gate a server's `prepublishOnly` calls.** It decides from the report's rows and a committed `mcp-doctor.owed.json` only: any `non-conforming` row refuses, even when declared (a declaration never waives a violation); any `could-not-judge` row whose id is not declared with its own reason refuses; a declared id that is no longer `could-not-judge`, or that no detector produced, refuses as stale; an unreadable or malformed owed file (bad JSON, a blank or shared reason, a duplicate id, an unknown key) refuses and is never read as empty. Exit 0 passed, 1 refused, 2 the gate could not run. The table gains a `gate:` block and `--json` a `gate` object (`passed`, `exitCode`, `refusals[{id, kind, reason}]`, `declared`). `--gate` with `--url` is refused. Proof: each case red-then-green (tests/publish-gate.test.ts) and a foreign-material probe on modelcontextprotocol/servers @ 76d64c82 (scripts/gate-foreign-bite-probe.sh: pass, undeclared, stale, violation, landing asserted, restore proven). (README: #publish-gate---gate)
24
+ - **DToolRoles checks agent tool roles (mcp-server-standard "Agent tool roles", rule 7).** On a server with an authenticated tier (a calling agent; a public or stdio-only server reads absent, the section does not apply), every registered tool must declare a non-empty `domain` and a `mode` of exactly `read` or `write`, in its `annotations` or its `_meta`. A tool declaring in neither place, declaring different values in the two, or with `mode: read` and no `readOnlyHint: true` (or `write` with `readOnlyHint: true`) is non-conforming, named. `decideToolRole` / `filterGrantedTools` from `@vantageos/cloud-identity` must be called by the `registerTool` wrapper or the `tools/call` handler, and by a `tools/list` handler; a tool registered before the gate is installed is non-conforming, and so is any tool the gate exempts from the decision other than the identity tool (C-33) — the exempt set is followed to its `new Set([...])`, an exemption the reader cannot follow is could-not-judge. A declaration the reader cannot resolve, and a registration in a function that does not install the gate, are could-not-judge, named. When the static half holds, the verdict is could-not-judge naming the owed scoped-identity reads: rule 7 says a run with no role fixture is never a green. The section has no rule id, so the detector declares `noNumberedRule`. Proof: one mutation per form on the vendored vantage-mcp-boilerplate 0.7.0, which is present unmutated. `withCallees` no longer treats `async (` or `function (` as a function name, so it no longer pulls in an unrelated handler body. (README: #added-in-0180--agent-tool-roles-standard-1c66e11c-mcp-server-standard-agent-tool-roles-unnumbered)
25
+
26
+ ### Fixed
27
+ - **C-29 no longer reports an unreadable skill file as missing.** In the folder comparison of a plugin package's skill copy, a file that could not be read was dropped from the listing and so reported "missing" (red) although it is there; a folder that could not be listed made every file under it "missing" too. An unread file is now kept and named could-not-judge, never compared; an unlisted folder suppresses the missing / extra verdicts on its side. A package's `SKILL.md` is called missing only when its absence is seen (the nearest existing folder above it lists); an unlistable skill folder, skills root or package folder is could-not-judge, named, and so is an unlistable served skill folder, which was skipped silently. The README already promised could-not-judge for an unreadable file; this makes it true. (README: #c-29-reports-a-plugin-package-that-does-not-ship-the-served-skills)
28
+ - **C-34 decides the const-bound reader.** A script that names a plugin family file and writes only to ANOTHER fixed path through a `const` (`const out = "report.json"; writeFileSync(out, …)`) was read as an unresolved write (could-not-judge); it is a reader, so the file is red when no other script writes it. A write that stays unresolved (`writeFileSync(pick(), …)`, `join(root, rel)` over a map's keys) keeps the script could-not-judge. A name bound by `const` more than once in a file (`const path = …` in two functions) is no longer resolved to its first binding: it has no single value at the write. (README: #c-34-reports-a-plugin-family-that-is-not-generated-from-one-source)
29
+ - **D2 declares no numbered rule, as the standard says.** mcp-standard §5.2 names D2 (the `mcp-session-id` session signal) alongside D7 as guarding a protocol property without being a numbered rule; D2 still declared `rule: "S-1"`. It now carries `noNumberedRule` citing §5.2. S-1 stays judged by D12. (README: #detectors-without-a-row-in-the-release-tables-back-filled)
30
+ - **Every detector declares the rule it judges.** DExt7 (extension eval coverage) carried no `rule`; it now names `C-5`, where the extension standard sends the eval suite and its "extension absente" case. D7 (protocol-kit adoption) carries `noNumberedRule` instead, citing mcp-standard §5.2, which declares it an implementation vector of S-2/S-3/S-4 rather than a numbered rule. `tests/detector-rule-declared.test.ts` refuses a registered detector with neither, both, or a blank value, naming it. (README: #detectors-without-a-row-in-the-release-tables-back-filled)
31
+ - **DToolRoles reads a compound gate exemption per disjunct.** `exempt.has(name) || name === "list_items"` was read as one unknown condition (could-not-judge) although its second disjunct alone exempts a non-identity tool. Each top-level `||` disjunct is now read on its own: a non-identity name in any readable disjunct is red, named, with an unread disjunct beside it noted; a top-level `&&` (which narrows) is could-not-judge, named. (README: #detectors-without-a-row-in-the-release-tables-back-filled)
32
+ - **A detector named only in a "Changes in" release note no longer counts as documented.** `tests/readme-detector-table.test.ts` now reads the kind of each table from the heading above it: rows under `## What it checks`, `### Detectors added in`, `### Added in` and `### Detectors without a row` describe a detector and cover it; rows under `### Changes in` record a release and do not; a detector row under any other heading fails, naming it. Eight detectors were covered only by a release note (S-35 to S-41, C-36) and now have a description row. (README: #detectors-without-a-row-in-the-release-tables-back-filled)
33
+ - **Every registered detector has a README row, and `npm test` keeps it so.** 42 detectors (D8–D12, C7–C22, C25, C26, A2, A7, S12, the DServer / DExt families, DDebugOptIn, DAppI18n, S42, S44) were registered with no row in any README detector table; each now has one, its rule, what the static run reads and the verdicts taken from its own source. `tests/readme-detector-table.test.ts` derives the registered ids from the registry and fails naming each id without a row, each row naming an id the registry does not hold, and any first-cell form it cannot read (single, `**A**..**B**` range and hyphenated `S-28` forms are read). (README: #detectors-without-a-row-in-the-release-tables-back-filled)
34
+ - **The Public Suffix List generator's refusals are tested.** `scripts/regen-psl-private.ts` refuses to write on a non-2xx answer, a missing VERSION, COMMIT, BEGIN or END marker, END before BEGIN, or a source older than the vendored data; each was proven only by hand. `tests/regen-psl-private.test.ts` runs the real script on a fixture for each, against a data file in a temp dir (`REGEN_PSL_OUT`, new; `REGEN_PSL_SOURCE` points the fetch at a local server for the non-2xx case), asserting exit 2 and the file untouched; the happy path and `--allow-older` prove it writes. `--allow-older` given before the file is now read as a flag, not as the source file. (README: #s-45-reports-a-distributed-server-on-a-platform-host-with-no-streamable-http-route-or-without-a-declared-hosts-verification-path)
35
+ - **The Public Suffix List generator reads the vendored version, never assumes it.** A vendored data file that existed but could not be read, or carried no `PSL_VERSION`, left the version unknown and silently disabled the older-source refusal. Now only a missing file (a first generation) has no version; an unreadable file or one without `PSL_VERSION` exits 2 naming it, unless `--allow-older`. Tested per state of the vendored file. (README: #s-45-reports-a-distributed-server-on-a-platform-host-with-no-streamable-http-route-or-without-a-declared-hosts-verification-path)
36
+ - **DServer14 reads the 401 challenge where the header is set.** Element 1 was a co-occurrence of `WWW-Authenticate`, `resource_metadata=`, `401` and `Bearer` over the whole tree. It stayed present on vantage-peers with the six lines that send the challenge commented out. It is now present only when one live site sets `WWW-Authenticate` to a Bearer `resource_metadata=` challenge with a `401` on its path. The value is read at the site (a literal, or an identifier bound once in the file to a literal). Eight set forms are read: `.header`, `.set`, `.append`, `.setHeader`, `.appendHeader`, a headers-object key, a `[name, v]` tuple, and a subscript assignment. A `Basic` challenge is not Element 1. A header name outside these forms and reads, or an unreadable value with no other challenge, is could-not-judge naming the site. (README: #dserver14-reads-the-401-challenge-where-the-header-is-set)
37
+ - **The report states how many source files and registered tools it read.** A `coverage:` line under `surface:` (and a `coverage` object in `--json`) gives the number of source files the scan read and the number of registered tools the shared tool reader read. It also names unread product-looking files and registration sites whose name could not be read. A tool count that could not be read is printed as `registered tools: NOT READ — <why>`, never as 0. (README: #the-report-states-how-many-source-files-and-registered-tools-it-read)
38
+
7
39
  ## 0.17.0 — 2026-11-02
8
40
 
9
41
  ### Added
package/README.md CHANGED
@@ -28,18 +28,21 @@ npx @vantageos/mcp-doctor ./mcp-server
28
28
 
29
29
  ```
30
30
  surface: ./mcp-server
31
+ coverage: 3 source files read (.ts/.tsx, excluding .d.ts and .test.ts); 12 registered tools read
31
32
  item | file:line | state | verdict
32
33
  -----------------------------------------------------------------------------
33
34
  D2 stateless | - | present | stateless (no mcp-session-id session-keying)
34
- D3 resultType | server.ts:589 | absent | list/read builder returns {content} without resultType -> add via protocol-kit
35
- D4 CacheableResult | server.ts:579,595 | absent | list/read builders lack ttlMs/cacheScope -> add CacheableResult
35
+ D3 resultType | server.ts:589 | non-conforming | list/read builder returns {content} without resultType -> add via protocol-kit
36
+ D4 CacheableResult | server.ts:579,595 | non-conforming | list/read builders lack ttlMs/cacheScope -> add CacheableResult
36
37
  D5 server/discover | - | absent | no server/discover handler -> add via protocol-kit
37
- D6 mcp-apps ui-key | - | absent | no MCP Apps UI key (no _meta ui)
38
- D7 protocol-kit | package.json | absent | hand-rolled builders, protocol-kit not a dependency
38
+ D6 mcp-apps ui-key | - | absent | no MCP Apps UI key and no ui:// resource: the tree is not an App — A-6 n/a
39
+ D7 protocol-kit | package.json | absent | no hand-rolled result builder ... and protocol-kit not a dependency: nothing for the kit to replace — D7 n/a
39
40
  ```
40
41
 
41
42
  The path is the root of the MCP server sources (the folder holding `server.ts` / `transport/` /
42
43
  `package.json`). `node_modules`, `dist`, `build`, `.git` and test folders are skipped automatically.
44
+ The `coverage:` line under `surface:` states what the run read: see
45
+ [the report states how many source files and registered tools it read](#the-report-states-how-many-source-files-and-registered-tools-it-read).
43
46
 
44
47
  ### Options
45
48
 
@@ -47,7 +50,9 @@ The binary's own `--help` is the authority; this is what it prints:
47
50
 
48
51
  ```
49
52
  usage: mcp-doctor <source-tree-path> [--mode=static|dynamic|both] [--backend=<convex-dir>] [--json]
53
+ mcp-doctor <source-tree-path> --gate [--owed <file>] [--mode=...] [--json]
50
54
  mcp-doctor --url <https url> [--bearer-env VAR] [--header "Name: value"]... [--source DIR] [--expected-commit SHA] [--json]
55
+ mcp-doctor --url <https url> [--bearer-env VAR] [--header ...] --events-ready [--events-* ...] [--json]
51
56
 
52
57
  --mode=static read the tree only (default)
53
58
  --mode=dynamic launch the server and judge what it serves
@@ -67,12 +72,31 @@ usage: mcp-doctor <source-tree-path> [--mode=static|dynamic|both] [--backend=<co
67
72
  --source DIR with --url: the server's source tree, for D8 eval counts and the C-25 expected
68
73
  commit (git rev-parse HEAD there)
69
74
  --expected-commit SHA with --url: the full commit id the server must serve (C-25)
75
+ --events-ready with --url: run ONLY the MCP events probe (S-29..S-33): discover, events/list,
76
+ events/subscribe, callback verification, signed delivery, events/unsubscribe,
77
+ against an HTTPS receiver it starts (self-signed, generated at run time)
78
+ --events-callback-base URL a public https URL forwarding to the receiver; without it the
79
+ checks that need the server to POST are could-not-judge
80
+ --events-receiver-port N the receiver's local port (the forwarder's target; default any)
81
+ --events-trigger NAME [--events-trigger-args JSON] the tool whose call causes one event;
82
+ without it the delivery checks are could-not-judge
83
+ --events-name NAME [--events-args JSON] the event subscribed to and its arguments
84
+ (default: the first event listed, {}; two keys or more to probe key order)
85
+ --events-observe-ms N how long deliveries are watched after the trigger (default 5000)
86
+ --gate the publish gate (for prepublishOnly): refuse any non-conforming row, any
87
+ could-not-judge row not declared in the owed file, and any stale declaration
88
+ (a declared id no longer could-not-judge, or no row of that id). Prints a
89
+ gate: block (--json: a gate object). Not combinable with --url / --events-ready
90
+ --owed FILE with --gate: the owed-verdicts file (default <source-tree>/mcp-doctor.owed.json);
91
+ {"owed": [{"id": "<detector id>", "reason": "<why>"}, ...]}
70
92
  --json print the report as JSON (results, owedHumanVerdicts, exitCode)
71
93
  --version print the version and exit
72
94
  --help print this and exit
73
95
 
74
96
  exit: 0 clean, 1 a violation, 2 an abstention with no violation (including a target
75
97
  that names nothing readable: missing, empty, or not a source tree)
98
+ --gate: 0 passed, 1 refused, 2 the gate could not run (unreadable owed file, unreadable
99
+ tree, a detector failure, a usage error); a violation exits 1 whatever else happened
76
100
  ```
77
101
 
78
102
  ## States and exit codes
@@ -82,11 +106,13 @@ exit: 0 clean, 1 a violation, 2 an abstention with no violation (including a tar
82
106
  | `present` | the standard item is satisfied | none |
83
107
  | `absent` | the detector found nothing to judge — see the caveat below | none |
84
108
  | `non-conforming` | the item is present and wrong (this includes a manifest that parses but holds a wrong value) | **exit 1** |
85
- | `could-not-judge` | the detector could not read its input and says so in the row — malformed JSON, a computed or non-literal value, no `package.json` above the root; the run completes and the row names the file | **exit 2**, unless something else is non-conforming |
109
+ | `could-not-judge` | the detector could not read its input and says so in the row — malformed JSON, a computed or non-literal value, no `package.json` above the root, a value only a live session measures, a rule's scope condition the tree does not state; the run completes and the row names what was not read | **exit 2**, unless something else is non-conforming |
110
+ | `not-applicable` | the rule DECLARES itself out of scope for this target (its `isApplicable(tree)` returned false): the engine decides applicability up front, pushes a synthetic row, and the detector's `run` is never called. It is DECISIVE — it carries no reason and no `owedVerdict` (the predicate failing is the reason), and it is NOT a could-not-judge | none |
86
111
 
87
112
  The exit code keeps three outcomes distinct, which is what makes the tool safe in CI:
88
113
 
89
- - **0** — clean.
114
+ - **0** — clean. A `not-applicable` row (0.19.0) falls through here: the rule declared itself out of
115
+ scope for this target, so it is decisive and never raises an exit code.
90
116
  - **1** — at least one violation.
91
117
  - **2** — no violation, but at least one detector abstained. **An abstention is never a pass**: it
92
118
  means part of the tree was not judged, and the row names which part and why.
@@ -111,12 +137,51 @@ A directory holding even one file is a subject and is judged, so a missing READM
111
137
  still a violation (exit 1). Inside a judged tree, a subdirectory that cannot be listed is named under
112
138
  `skipped directories`; it is never dropped in silence.
113
139
 
114
- **One known limit in 0.3.2, stated rather than hidden:**
115
-
116
- - **`absent` currently means two things.** It is used both for "this rule does not apply here" and,
117
- for some detectors, "this is required and missing". The second should move the exit code and
118
- today does not. Until that is split, read an `absent` row against the rule it names rather than
119
- treating it as harmless.
140
+ **`absent` means "this rule does not apply here" — one known limit, stated rather than hidden:**
141
+
142
+ - **Ten sites that read "required and missing" as `absent` now report it.** A rule that applies and
143
+ whose required item is missing moves the exit code: D9 and DExt8 (C-3, no `CHANGELOG.md`), DExt5
144
+ (C-1, an FR piece missing beside a manifest), D8 (C-5, tools registered and no `evals/evals.json`),
145
+ D3 and D4 (S-2 / S-3, a builder writes neither field; could-not-judge where `@modelcontextprotocol/server`
146
+ >= 2 shapes the served response), D6 (A-6, an App — a `ui://` resource is served — with no GA key),
147
+ D12 (S-1, an MCP server with no transport signal: could-not-judge), DExt1 (E-1, a `defineExtension`
148
+ call with no `identifier`), and D7 (a constructor written by hand with no kit). Each keeps `absent`
149
+ only where its rule does not govern the tree.
150
+ - **"Did not look" is never `absent`.** Eight sites that answered `absent` without reading what their
151
+ rule needs now say what they did:
152
+ - **Nothing measured — `could-not-judge`, naming what was not measured.** C21 on a static run of an
153
+ MCP server (the connection load is measured on a live session: `--mode=dynamic|both`); D3 and D4 on
154
+ an MCP server where nothing in the tree shapes a response (no builder, no SDK-first registration,
155
+ no tool surface); C26 when every deployment site is skipped as not npm-managed (the rule is not
156
+ limited to npm, so the lockfile of each was not measured). A tree that is not an MCP server at all
157
+ stays `absent` on C21, D3 and D4, and C26 stays `absent` with no deployment configuration.
158
+ - **The rule's scope condition is read — `absent` only where it is false, quoted in the row.**
159
+ DServer14 and S5 (S-5: « obligatoire pour tout serveur multi-tenant / multi-client »): `absent` for a
160
+ tree that is not an MCP server or a server served over stdio only; judged when the server is served
161
+ over HTTP and partitioned by organisation (a `tenancy: per-organisation` upstream, or an
162
+ organisation claim such as `verifiedOrg` / `orgId` / `tenantId` in code); `could-not-judge` when it
163
+ is served over HTTP and states no tenancy, or wires no transport the tree shows. A7 (A-7: « L'App/hôte
164
+ ... gate tout appel d'outil »): `absent` when the tree is neither an App (a `ui://` resource) nor
165
+ calls a tool; with no confirmation anywhere, an App or a tool call is exposed as a site for a verdict
166
+ (`could-not-judge`), as is a JSON-RPC request whose method is an expression. S48 (S-48: « A server
167
+ force-installed for a member »): `absent` for a tree that is not an MCP server; a server that signs
168
+ no member in is `could-not-judge`, because whether it is force-installed is an administrator's
169
+ choice on the host that no source tree states.
170
+ - **Consequence:** a static run of any MCP server now leaves C21 open, and S48 too when the server
171
+ signs no member in, so it exits 2. The publish gate passes such a server once those rows are
172
+ declared in its owed file (see [Publish gate](#publish-gate---gate)).
173
+ - **Six `absent` sites stay open, pending the standard owner's decision on each rule's text.** They do
174
+ not move the exit code, and none is claimed closed:
175
+ - A11 (A-11) — whether a stdio-only App is "servie à Claude", while the rule's own row names
176
+ could-not-judge when the served URL is unknown;
177
+ - C14 (C-14) — whether a package with no `mcpCatalog` block is out of the rule, which applies "à chaque
178
+ publication stable" and names no n/a outcome;
179
+ - D16 (S-7) — whether a server with neither a `server/discover` handler nor a `/health` route is
180
+ exempt or red ("version ... absente");
181
+ - C20 and DAppI18n (C-20) — whether a missing `i18n/` folder is out of the rule, while C-1 requires two
182
+ languages and the red set does not name a missing folder;
183
+ - C27 (C-27) — whether a deployable sub-package with no `tsconfig*.json` is exempt from the type-check
184
+ in isolation.
120
185
 
121
186
  By design, a detector whose own internal self-check fails stops the run — that is the instrument
122
187
  reporting that it is broken, and silencing it would hide the fault behind a normal-looking table.
@@ -125,21 +190,110 @@ reporting that it is broken, and silencing it would hide the fault behind a norm
125
190
  for every target, because its entrypoint guard never fired under a symlink. A CI job that has been
126
191
  green on 0.2.0 was green because nothing ran. Expect findings on the first run of 0.3.x.
127
192
 
193
+ ## Publish gate (--gate)
194
+
195
+ `--gate` is the check a server's `prepublishOnly` calls, so that a package is never published with a
196
+ violation or with an undecided row nobody answered for:
197
+
198
+ ```json
199
+ "prepublishOnly": "npm run build && mcp-doctor . --gate"
200
+ ```
201
+
202
+ The gate decides from two inputs only: the rows the report prints, and an owed-verdicts file committed in
203
+ the server's repository. It adds no rule of its own and changes no detector. It refuses when:
204
+
205
+ | kind | refused when | what to fix |
206
+ |---|---|---|
207
+ | `violation` | a row is `non-conforming` — always, even when its id is declared in the owed file | the code |
208
+ | `undeclared` | a row is `could-not-judge` and its id is not in the owed file (an owed-human row included) | make the row decidable, or declare it with its reason |
209
+ | `stale` | a declared id has no `could-not-judge` row left: it became present, absent or non-conforming, or the run produced no row with that id | remove or correct the entry |
210
+ | `unreadable-owed` | the owed file cannot be read, is not valid JSON, or breaks the format below | the file; it is never read as an empty file |
211
+
212
+ It passes only with zero violations, every `could-not-judge` row declared, and no stale declaration. A server
213
+ with no `could-not-judge` row needs no file. Exit codes: **0** passed, **1** refused, **2** the gate could not run
214
+ (an unreadable owed file, an unreadable tree, a detector failure, a usage error). A violation exits 1 whatever else
215
+ happened, as a violation takes precedence over an abstention in the report's own exit code.
216
+
217
+ **The owed-verdicts file.** Default path `<source-tree>/mcp-doctor.owed.json` (beside a single-file subject, its
218
+ directory), overridable with `--owed <file>`. A file named with `--owed` that does not exist is refused.
219
+
220
+ ```json
221
+ {
222
+ "owed": [
223
+ { "id": "C35 listing-kit", "reason": "the listing kit is generated at release from the served tools/list" },
224
+ { "id": "D8 eval-suite-coverage", "reason": "tool registration is computed; evals run against the served list in CI" }
225
+ ]
226
+ }
227
+ ```
228
+
229
+ - `id` is the detector id exactly as the report's first column prints it (`--json`: a result's `id`).
230
+ - One entry per id, one id per entry, each with its own non-empty `reason`. A duplicate id, a list of ids, a
231
+ blank or missing reason, a reason copied onto a second id, and any unknown key are refused: the file states
232
+ a reason per row, it is not a waiver list.
233
+ - An entry list rather than an object keyed by id, because a JSON parser keeps the last of two equal keys in
234
+ silence and a duplicate must be seen to be refused.
235
+
236
+ This is not the same thing as the `owedHumanVerdicts` count: that is a detector stating that a person's verdict
237
+ is due on named sites. The owed file is the maintainer's declaration, for every undecided row, of why the package
238
+ may still be published.
239
+
240
+ **Output.** The table is followed by a `gate:` block: `PASSED`, or `REFUSED` with one line per refusal
241
+ (`kind | id | what is wrong and what to fix`). Under `--json` the report gains a `gate` object:
242
+ `{ passed, exitCode, refusals: [{ id, kind, reason }], declared, owedFile, owedFileFound }`, plus `cannotRun`
243
+ (the reason) when the gate could not run. The report's own `exitCode` field keeps its meaning; the process exits
244
+ with `gate.exitCode`.
245
+
246
+ **Mode.** Static by default (a prepublish has the tree, not a running server); `--mode` passes through. `--gate`
247
+ with `--url` or `--events-ready` is refused: a `--url` run does not run the source-tree rules, so its pass would say
248
+ nothing about them.
249
+
128
250
  ## Programmatic use
129
251
 
130
252
  ```ts
131
253
  import { runDoctorReport, renderTable } from "@vantageos/mcp-doctor";
132
254
 
133
- const { results, skipped } = runDoctorReport("./mcp-server");
134
- console.log(renderTable("./mcp-server", results, skipped));
255
+ const { results, skipped, coverage } = runDoctorReport("./mcp-server");
256
+ console.log(renderTable("./mcp-server", results, skipped, coverage));
135
257
  ```
136
258
 
259
+ `coverage` is what the run read (source files, registered tools); `renderTable` prints it as the
260
+ `coverage:` line under `surface:`, and called without it prints a "NOT REPORTED" line in its place.
261
+
137
262
  `skipped` is the list of directories the run actually walked past (`node_modules`, `dist`, test
138
263
  material...), recorded by the walks as they skip them. `renderTable` prints it as the
139
264
  "skipped directories" section, so a report never reads as full coverage of a narrowed scope. Pass it
140
265
  through; called with two arguments, `renderTable` prints a "NOT REPORTED" line in its place.
141
266
  `runDoctor(target)` still returns the results alone.
142
267
 
268
+ ## Doctor kit
269
+
270
+ A doctor built on this engine (a second instrument that judges another standard) used to copy the same
271
+ five modules. They are now public and parameterised: the doctor keeps its own constants (the vendored
272
+ standard's path and pin, the rule-id regex, its detectors, its not-checkable entries, its severity map)
273
+ and imports the rest.
274
+
275
+ | Export | What it does |
276
+ | --- | --- |
277
+ | `deriveRuleIds(path, pattern)` | Rule ids from a vendored standard text (capture group 1, else the whole match), sorted numerically. An unreadable file throws `StandardUnreadableError`; a pattern matching nothing throws `NoRuleIdsDerivedError`. Never an empty list. |
278
+ | `ruleCoverage(ruleIds, checked, notCheckable)` / `coverageSummary` | Every derived rule sits in exactly one bucket; reports `uncovered`, `doubleCovered`, `unknown` and `ok`. |
279
+ | `notCheckableResults(bucket, anchor)` | One could-not-judge result per `{ ruleId: reason }` entry; a blank reason throws. |
280
+ | `tallyRules(results, ruleIds, pattern)` / `tallyLine` / `ruleIdOf` | Rule-level worst-state reduce over `STATE_RANK`. A derived rule with no result throws, naming it; a tallied rule outside the list throws, naming it. `pattern` here reads RESULT ids (for example `R-3 some detector`), not standard lines. |
281
+ | `STATE_RANK` / `StateRank` / `ALL_STATES` | One rank per member of the `State` union (typed `Record<State, number>`: a new state is a compile error). `not-applicable` ranks lowest, so it never outranks `non-conforming` or `could-not-judge`. |
282
+ | `RegistryEntry` / `checkedRuleIds(entries)` | `{ detector, ruleId, standardPin }` and the distinct checked ids derived from the entries. |
283
+ | `renderReport(ctx)` / `writeReport(path, ctx)` | Tally line plus `renderTable`, with doctor-specific header fields passed as `ctx.header`; the exit code is derived with `computeExitCode`. Pure: the caller supplies the date. |
284
+
285
+ ```ts
286
+ import { deriveRuleIds, tallyRules, ruleCoverage, checkedRuleIds } from "@vantageos/mcp-doctor";
287
+
288
+ const RULE = /^\*\*(R-[0-9]+)/; // reads the standard's rule lines, e.g. "**R-3 — ..."
289
+ const RESULT = /^(R-\d+)\b/; // reads result ids, e.g. "R-3 pagination"
290
+ const ids = deriveRuleIds("./fixtures/my-standard.md", RULE);
291
+ const t = tallyRules(results, ids, RESULT);
292
+ const cov = ruleCoverage(ids, checkedRuleIds(REGISTRY), Object.keys(NOT_CHECKABLE));
293
+ ```
294
+
295
+ `State` and `DetectorResult` are also exported as types.
296
+
143
297
  ## What it checks (MCP 2026-07-28)
144
298
 
145
299
  Each detector maps one standard item and is proven **bipolar** on real material: a genuine defect
@@ -148,16 +302,73 @@ Each detector maps one standard item and is proven **bipolar** on real material:
148
302
  | ID | Standard item | Verdict shape |
149
303
  |----|---------------|---------------|
150
304
  | **D2** stateless | `sessionIdGenerator: undefined`, no `Mcp-Session-Id` session-keying, no hand-rolled `initialize` gate | conforming (stateless) / non-conforming (session-keyed) |
151
- | **D3** resultType | `resultType` present on list/read result builders | present / absent |
152
- | **D4** CacheableResult | `ttlMs` / `cacheScope` on the list/read result types | present / absent |
305
+ | **D3** resultType | `resultType` present on list/read result builders | present / non-conforming (a builder, no `resultType` written) / could-not-judge (the builder's response is shaped by `@modelcontextprotocol/server` >= 2, read on the served response) / absent (not an MCP server) / could-not-judge (an MCP server with no builder, no SDK-first registration and no tool surface: unmeasured) |
306
+ | **D4** CacheableResult | `ttlMs` / `cacheScope` on the list/read result types | present / non-conforming (builders, neither field written) / could-not-judge (the builders' response is shaped by `@modelcontextprotocol/server` >= 2, read on the served response) / absent (not an MCP server) / could-not-judge (an MCP server with no builder, no SDK-first registration and no tool surface: unmeasured) |
153
307
  | **D5** server/discover | a `server/discover` handler is registered (absence-based, with a positive control) | present / absent |
154
- | **D6** mcp-apps ui-key | MCP Apps UI key is the GA nested `_meta.ui.resourceUri` — not flat `ui/resourceUri`, not community `io.modelcontextprotocol/ui` | GA-nested / flat-deprecated / community-nonGA / none |
155
- | **D7** protocol-kit | `@vantageos/mcp-protocol-kit` listed in `package.json` **and actually called** (builder invoked, not merely declared) | listed+called / listed-not-called / hand-rolled. Conformant too on `@modelcontextprotocol/server` >= 2 with no hand-rolled result builder (the kit is required only where builders are written by hand) |
308
+ | **D6** mcp-apps ui-key | MCP Apps UI key is the GA nested `_meta.ui.resourceUri` — not flat `ui/resourceUri`, not community `io.modelcontextprotocol/ui` | GA-nested / flat-deprecated / community-nonGA / non-conforming (an App — a `ui://` resource is served — with no GA key) / absent (no key and no `ui://` resource: not an App) |
309
+ | **D7** protocol-kit | `@vantageos/mcp-protocol-kit` listed in `package.json` **and actually called** (builder invoked, not merely declared) | listed+called / listed-not-called / hand-rolled (a constructor of `resultType`, `ttlMs` or `cacheScope` written by hand, read by the same reader on every path). Conformant too on `@modelcontextprotocol/server` >= 2 with no hand-rolled result builder (the kit is required only where builders are written by hand); absent where no kit, no SDK v2 and no hand-rolled builder |
156
310
  | **D15** cache-coherence | Server Rule 15 — every tool-set mutation (RegisteredTool `.enable/.disable/.update/.remove`, `unregisterTool`) is correlated with a `notifications/tools/list_changed` emission | present / absent / non-conforming / could-not-judge |
157
311
  | **D16** version-observable | Server Rule 16 — `server/discover` (or an HTTP `/health` route) exposes a `version` field sourced from `package.json`, reachable pre-auth; an SDK v2 `new McpServer({ name, version })` carrying a `package.json`-derived version counts (pre-auth reach is the dynamic half) | present / absent / non-conforming / could-not-judge |
158
312
  | **DLocalIdentity** no-local-identity | No MCP server defines its own identity primitive: resolving a caller to a tenant or agent (local JWT verify, a populated allow-list attached to a bearer), asserting org membership or role, filtering rows by caller scope (`fromAllowList`, a name allow-list, a row's `orgId` or acting-name field such as `createdBy` / `assignedTo` compared to the caller's, by `===`, `==`, `Object.is` or after `toLowerCase()`), or validating a credential (local `timingSafeEqual`, a digest of a presented value, HMAC; a hash over a static literal, or over local content — file bytes, a directory listing, a digest of them, i.e. a content fingerprint of the built tree — is not a site). A call to a binding imported from `@vantageos/cloud-identity` is not a site. Minting/signing sites (`new SignJWT`, `jwt.sign`, a private-key import) are listed as `MINTING/SIGNING` and not counted; verification and claim reads stay violations whoever issued the token (no issuer carve-out). | present (0, or EXEMPT) / non-conforming (count > ceiling, default 0) / could-not-judge |
159
313
  | **S-28** claim-forwarded | Server complement S-28 (standard `bacc54a`) — a tool forwards the verified claim of its caller (`verifiedOrg` / `verifiedPerson`) to every backend door it calls and refuses when it holds none. Reads each `<client>.query\|mutation\|action` call, the helpers it spreads, the refusal before it, and the backend source's door list (`--backend=<convex-dir>`, else the nearest `convex/` above the tree). A door that is service-account-only or declared `fleet-wide:` needs no claim; no backend found, an unknown door, a computed door name are could-not-judge. | present / non-conforming / could-not-judge / absent (no Convex client imported) |
160
314
 
315
+ ### Detectors without a row in the release tables (back-filled)
316
+
317
+ Registered detectors that no description table above or below documents, in registry order; each row is read from the detector's own source file. The last eight (S-35..S-41, C-36) were introduced in a "Changes in" release note, which records a release and does not cover a detector.
318
+
319
+ | ID | Rule | The static run reads | Verdicts |
320
+ |----|------|----------------------|----------|
321
+ | **D8** eval-suite-coverage | C-5 (the >=3-cases count half) | registered tools against the case count per tool in `evals/evals.json` | absent (no tool) / present / non-conforming (including tools registered and no eval file) / could-not-judge |
322
+ | **D9** semver+changelog | C-3 | `package.json` `version` against strict SemVer, and `CHANGELOG.md` beside it | present / non-conforming (including no `CHANGELOG.md`) / could-not-judge |
323
+ | **D10** bilingual | C-1 | `description_fr` in `package.json` or in source, `README.fr.md`, and its listing in `files[]` | present / non-conforming / could-not-judge |
324
+ | **D11** zod-schemas | C-4 | `z.any()` per line, and tool registrations against `outputSchema` occurrences tree-wide (not per tool) | absent (no tool) / present / non-conforming / could-not-judge |
325
+ | **D12** stdio-transport | S-1 | `StdioServerTransport`, a `package.json` `bin` entry, or a stdio `transport` declared in the server manifest (`mcp.json` / `mcp-server.json`), against an HTTP/Streamable transport | absent (no transport signal and no MCP server surface) / present / non-conforming / could-not-judge (an MCP server with no transport signal, or an unparseable `package.json`) |
326
+ | **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
+ | **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
+ | **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 |
330
+ | **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
+ | **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
+ | **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 |
333
+ | **C14** catalog-registration | C-14 | the `mcpCatalog` block in `package.json` and its required fields | absent (no block) / non-conforming / could-not-judge (complete block; registry resolution owed) |
334
+ | **C15** annotations-untrusted | C-15 | each tool's four behavioral hints and title, read/write enum parameters, and consumer auto-approval off a hint | absent (no tool) / present / non-conforming / could-not-judge |
335
+ | **C16** untrusted-output | C-16 | template interpolation into instruction positions and its trust-boundary marker, and free-body strings in event payloads | absent (no interpolation site) / present / non-conforming |
336
+ | **C17** supply-chain | C-17 | a committed lockfile, and a provenance claim (`publishConfig`, `.github/workflows/*.yml`) or a provenance record | present / non-conforming / could-not-judge |
337
+ | **C18** structure-manifest | C-18 | the root `mcp.json` / `mcp-server.json` or `extension.json`: required fields and version against `package.json` | present / non-conforming / could-not-judge |
338
+ | **C19** served-descriptions | C-19 | an inline source description on each registered tool (presence proxy; the served text is the dynamic run) | absent (no tool) / present / non-conforming / could-not-judge |
339
+ | **C20** locales-derived | C-20 | locale files under `src/i18n/` against hardcoded locale enumerations elsewhere | absent (no `src/i18n/`) / present / non-conforming |
340
+ | **C21** progressive-disclosure | C-21 | nothing: the connection load is measured only with a live session | could-not-judge (static run of an MCP server: not measured) / absent (not an MCP server) |
341
+ | **C22** test-ratio-gate | C-22 | test/coverage ratios cited in `README.md`, `README.fr.md`, `CHANGELOG.md` and their passage identifier | absent (no ratio cited) / non-conforming / could-not-judge |
342
+ | **C25** build-identity | C-25 | the `new McpServer(...)` / `new Server(...)` arguments and a `/health` route: a build-fed identity field beside `version` | absent (no construction) / present / non-conforming / could-not-judge |
343
+ | **C26** subpackage-lockfile | C-26 | deployment configs (`railway.json`, `Dockerfile`, `fly.toml`, ...) and a frozen install of each targeted subpackage in isolation | absent (no deployment config) / present / non-conforming / could-not-judge (also: every site skipped as not npm-managed, its lockfile not measured) |
344
+ | **A2** declared-domains | A-2 | network and frame targets in the UI code against the `_meta.ui.csp` lists, and the single-file bundle | absent (no `ui://` resource) / present / non-conforming / could-not-judge |
345
+ | **A7** consent-before-destructive | A-7 | the gate logic: event-origin approvals, `destructiveHint`-only skips, explicit confirmation requests | absent (not an App and no tool call) / present / non-conforming / could-not-judge (also: an App or a tool call with no confirmation, or a request whose method is an expression) |
346
+ | **S12** list-pagination | S-12 | `nextCursor` in each hand-registered protocol list handler, and code that decodes a cursor | absent (no list method served) / present / non-conforming / could-not-judge |
347
+ | **DServer2** naming | C-2 | tool names (snake_case, 64-character cap) and the `package.json` name (kebab-case) | present / non-conforming / could-not-judge |
348
+ | **DServer6** secret-hygiene | C-6 | log calls referencing secrets, PII or internal detail, and raw error traces sent to the client | present / non-conforming / could-not-judge |
349
+ | **DDebugOptIn** debug-opt-in | C-6 (debug half) | `.debug(...)` calls and the env/config gate around them | absent (no debug output) / present / non-conforming / could-not-judge |
350
+ | **DServer8** ui-fallback | A-1 | each `content[]` emitting a `ui://` resource, and a sibling text/markdown entry | absent (no `ui://` emission) / present / non-conforming / could-not-judge |
351
+ | **DServer14** oauth-resource-server | S-5 | the five-element OAuth 2.1 resource-server chain and the `@vantageos/cloud-identity` dependency and range | absent (no resource-server surface, out of S-5's scope: not an MCP server, or stdio only) / present / non-conforming (also: in scope with no surface) / could-not-judge (also: the scope unread — HTTP with no tenancy statement, or no transport wired) |
352
+ | **DAppI18n** app-i18n | C-20 | `i18n/fr.json` keys against `i18n/en.json` | absent (no `i18n/`) / present / non-conforming / could-not-judge |
353
+ | **DExt1** identifier | E-1 | the reverse-DNS `identifier` in `extension.json` and TS factories, and vendor host-key namespaces against the registry | absent (not an extension: no manifest, no `defineExtension` call, no identifier) / present / non-conforming (including a `defineExtension` call with no `identifier`) / could-not-judge |
354
+ | **DExt2** graceful-degradation | E-2 | `graceful_degradation` in `extension.json` and `gracefulDegradation` in `defineExtension` | absent (no flag found) / present / non-conforming / could-not-judge |
355
+ | **DExt3** single-type | E-3 | the extension `type` in `extension.json` and `defineExtension`: exactly one known category | absent (no type declared) / present / non-conforming / could-not-judge |
356
+ | **DExt4** lifecycle-hooks | E-4 | the manifest `lifecycle` hooks against their implementations (`hooks/` files, factory hooks) | absent (no hook declared) / present / non-conforming / could-not-judge |
357
+ | **DExt5** bilingual | C-1 | `description_fr` and `README.fr.md` beside each `extension.json`, and per-tool `description_fr` | absent (no manifest) / present / non-conforming (an FR piece missing) / could-not-judge |
358
+ | **DExt7** eval-coverage | C-5 | each extension's `evals/evals.json`: >=3 cases including an "extension absente" case | absent (no manifest) / present / non-conforming / could-not-judge |
359
+ | **DExt8** semver+changelog | C-3 | each extension's `package.json` `version` against strict SemVer, and `CHANGELOG.md` beside it | absent (no manifest) / present / non-conforming (including no `CHANGELOG.md`) / could-not-judge |
360
+ | **DExt9** hook-timeout | E-6 | each declared lifecycle hook's timeout guard (manifest `timeouts.<hook>` or in its implementation) | absent (no hook declared) / present / non-conforming / could-not-judge |
361
+ | **S42** write-read-claims | S-42 | the verified claims each write tool forwards to its backend door against those of the read tools on the same table | absent (no backend door call) / present / non-conforming / could-not-judge |
362
+ | **S44** closed-output | S-44 | every object of each tool's output schema closed to added fields (`.strict()`, `additionalProperties: false`, ...) | absent (no tool) / present / non-conforming / could-not-judge |
363
+ | **S35** scope-in-read | S-35 | each `<client>.query\|action(<door>, <args>)` and, in the same block, a narrowing of what it returned (`scopeFilterList`, `scopeFilterGet`, a `.filter` on an organisation / namespace / recipient / owner field or the caller context, a skipping branch in a loop) | absent / present / non-conforming / could-not-judge (door named by an expression) |
364
+ | **S36** upstream-credential | S-36 | the `client_credentials` grant, where the token source is built, its cache and expiry, the 401 path, the tenancy key, secrets near logs, errors and results | absent (no outbound call, no token source) / present / non-conforming / could-not-judge (unread source) |
365
+ | **S37** upstream-settings | S-37 | environment reads against the declared variables, literal upstream addresses, URL variables, secret flags, defaults on required variables | absent (no outbound call, token source, `upstreams` declaration or `defineVariables`) / present / non-conforming / could-not-judge (unread source) |
366
+ | **S38** bounded-upstream-call | S-38 | page walks and their ceiling, page size, cursor wrapping, retry bounds and `Retry-After`, the origin check, redirect options | absent (no upstream call to bound) / present / non-conforming / could-not-judge (unread source) |
367
+ | **S39** upstream-error | S-39 | time budgets, `isError` results and what is interpolated into them, catch sites, empty-success fallbacks | absent (no outbound call) / present / non-conforming / could-not-judge (unread source) |
368
+ | **S40** upstream-rows-narrowed | S-40 | how the person is resolved, the package narrowing, the refusal paths; each tool serving upstream rows is listed as an owed human verdict (C-23) | absent (no tool serves upstream rows) / non-conforming / could-not-judge, with an owed human verdict (C-23) per tool serving upstream rows |
369
+ | **S41** lake-reader | S-41 | the reader interface, the kind of each store call, the page check, the upstream reached only on a lake miss | absent (no data-lake reader) / present / non-conforming / could-not-judge (unread source) |
370
+ | **C36** readme-npm-limit | C-36 | the size of every root `readme*` file a published package ships, against the npm truncation point | absent (not published) / present / non-conforming / could-not-judge (package.json, the package root or a README that cannot be read) |
371
+
161
372
  ### Detectors added in 0.7.0 (standard `b714129a`, ElPi-Corp #243)
162
373
 
163
374
  One detector per rule that #243 added, plus the S-5 elements (f)..(l), each implementing the
@@ -173,7 +384,7 @@ where the tree contradicts the rule, and otherwise `could-not-judge` naming the
173
384
  | **C32** host-key-additive | C-32 | `_meta` objects (followed through spreads and consts): `openai/outputTemplate` needs `ui.resourceUri`, `openai/visibility` needs `ui.visibility` | absent / non-conforming / could-not-judge (served `tools/list` owed) |
174
385
  | **C33** identity-tool | C-33 | on an authenticated server, the identity tool: no argument, `readOnlyHint: true`, an `outputSchema` that declares `id` (inline or a same-tree const) | absent / non-conforming / could-not-judge |
175
386
  | **S29**..**S34** | S-29..S-34 | the `events` capability and the three `events/*` handler literals; descriptors (`name`, bilingual description, non-empty `delivery`, `inputSchema`, `payloadSchema`); the `-32012`/`-32602`/`whsec_`, `-32015`/`verification`, five-header/`standardwebhooks`/262144-byte/410-413 evidence; `events.accessRecheckSeconds > 0` in the server manifest | absent (no events surface) / non-conforming / could-not-judge (dynamic half named) |
176
- | **S5** authz-elements (f)-(l) | S-5 (f)..(l) | PRM `resource` and its path-suffixed route, CIMD + `"none"`, `iss` flag, `/authorize` handler (auto-approval, organisation from a query parameter), jwt-bearer, OIDC discovery | absent / non-conforming / could-not-judge (sites exposed in `owedVerdict`; probes owed) |
387
+ | **S5** authz-elements (f)-(l) | S-5 (f)..(l) | PRM `resource` and its path-suffixed route, CIMD + `"none"`, `iss` flag, `/authorize` handler (auto-approval, organisation from a query parameter), jwt-bearer, OIDC discovery | absent (out of S-5's scope: not an MCP server, or stdio only) / non-conforming / could-not-judge (sites exposed in `owedVerdict`; probes owed; or the S-5 scope unread) |
177
388
  | **E7** middleware-events | E-7 | writes to `delivery`/`arguments`/`id`/`refreshBefore`/`cursor` and replacement of `ctx.output` inside an `events/*` branch of a hook | absent / present / non-conforming |
178
389
  | **E8** official-ext-declared | E-8 | `capabilities.extensions` as an object, each official key's MUST methods registered | absent / present / non-conforming / could-not-judge (unknown official extension) |
179
390
  | **E9** host-invoked-tools | E-9 | `openai/settings.readTool`, `openai/mentions.searchTool`: registered, `readOnlyHint: true`, `outputSchema`, no required input, `"app"` visibility, ResourceLink | absent / present / non-conforming |
@@ -231,10 +442,103 @@ an error message) it counts only as code or as a quoted property key.
231
442
  | **S45** origin-targets | S-45 | `mcp-server.json` `distribution.targets`, the public origin (manifest URL or `PUBLIC_BASE_URL`), the Streamable HTTP route, each declared host's verification path and where its value comes from | absent (no target declared) / present / non-conforming / could-not-judge (a development default alone) |
232
443
  | **S46** registration-redirects | S-46 | CIMD and DCR offered together, each declared host's redirect in the allow-list; served half: the registration and authorize endpoints | absent / present / non-conforming / could-not-judge |
233
444
  | **S47** webhook-delivery | S-47 | events served, the outbound call whose target is the subscriber callback, its Standard Webhooks signature headers, the callback verification | absent (no events) / present / non-conforming / could-not-judge |
234
- | **S48** per-member | S-48 | the request path of a force-installed member: no shared-credential fallback, a 401 challenge for a member without a credential | absent (no person signs in) / present / non-conforming / could-not-judge |
445
+ | **S48** per-member | S-48 | the request path of a force-installed member: no shared-credential fallback, a 401 challenge for a member without a credential | absent (not an MCP server) / present / non-conforming / could-not-judge (also: a server that signs no member in — force-installed is stated in no tree) |
235
446
  | **C34** plugin-families | C-34 | each Agent Plugins, Claude or Cursor plugin file, the script that writes it, and its `--check` drift refusal | absent (no plugin family) / present / non-conforming / could-not-judge |
236
447
  | **C35** listing-kit | C-35 | `listing/listing.json`: description, tools, test prompts and reviewer note against their sources; served half: titles and hints against the served `tools/list` | absent (not listed) / present / non-conforming / could-not-judge |
237
448
 
449
+ ### Added in 0.18.0 — agent tool roles (standard `1c66e11c`, mcp-server-standard "Agent tool roles", unnumbered)
450
+
451
+ The section carries no rule id, so the detector declares `noNumberedRule` and the id has no number. It reads rule 7, the checks the section assigns to mcp-doctor.
452
+
453
+ | ID | Rule | The static run reads | Verdicts |
454
+ |----|------|----------------------|----------|
455
+ | **DToolRoles** tool-roles | "Agent tool roles" rule 7 (unnumbered) | on a tree with an authenticated tier (a calling agent; otherwise the section does not apply): each registered tool's `domain` and `mode` in its `annotations` and its `_meta` (neither, a conflict, a mode other than `read` / `write`, or `read` without `readOnlyHint: true` is red); `decideToolRole` / `filterGrantedTools` from `@vantageos/cloud-identity` called by the `registerTool` wrapper or `tools/call` handler and by a `tools/list` handler, every registration after the gate is installed, and no tool exempt from the gate but the identity tool (C-33) | absent (no tool, or no authenticated tier) / non-conforming / could-not-judge — including when the static half holds, because rule 7 says a run with no role fixture (grants nothing / read-only / full grant) is never a green |
456
+
457
+ ### Added in 0.18.0 — events-ready probe (S-29 to S-33, dynamic)
458
+
459
+ The static S-29..S-33 detectors read what the code must carry and leave the behaviour owed. `--url URL
460
+ --events-ready` runs that behaviour against the live server, the way an events host does: `server/discover`
461
+ (else `initialize`), `events/list`, `events/subscribe`, callback verification, signed delivery,
462
+ `events/unsubscribe`. The probe starts its own HTTPS receiver (a self-signed certificate generated in memory at
463
+ run time; no key is stored) and a loopback SSRF canary. Signatures are checked with `standardwebhooks` on the raw
464
+ bytes received. It prints ten rows and runs nothing else; the exit code follows the usual convention.
465
+
466
+ ```bash
467
+ mcp-doctor --url https://mcp.example.com/mcp --bearer-env MCP_TOKEN --events-ready \
468
+ --events-callback-base https://abc123.tunnel.example --events-receiver-port 8443 \
469
+ --events-trigger create_item --events-trigger-args '{"title":"probe"}' \
470
+ --events-name item.created --events-args '{"project":"alpha","kind":"note"}'
471
+ ```
472
+
473
+ | ID | Rule | What the probe does | Red when |
474
+ |----|------|---------------------|----------|
475
+ | `ER-a` events-declared | S-29 | reads `capabilities.events`, calls the three methods | declared and a method answers -32601, or not declared and a method answers |
476
+ | `ER-b` unauth-subscribe | S-31 | subscribes with none of the caller's headers or URL query | anything but -32012, or the callback is contacted first |
477
+ | `ER-c` subscribe-params | S-31 | an `http:` callback; secrets of 8 bytes and without `whsec_` | not -32602 (a -32015 on the `http:` URL means it was tried) |
478
+ | `ER-d` subscription-id | S-31 | subscribes twice, `arguments` keys in reverse order | the two ids differ |
479
+ | `ER-e` callback-verify | S-32 | reads the first envelope; a receiver that answers 200 without the challenge | envelope unsigned or without challenge/`webhook-id`, a challenge reused, the non-echoing receiver accepted, a -32015 without a categorical `data.reason` or carrying the receiver's body, an event reaching it |
480
+ | `ER-f` no-data-first | S-32 | the order of POSTs on every callback | an event before the verification envelope |
481
+ | `ER-g` signed-delivery | S-33 | every delivery; a receiver that answers 500 once | a header missing, `webhook-id` ≠ `eventId`, a signature that does not verify, a body over 262144 bytes, a retry with the same timestamp or signature or a new `eventId` |
482
+ | `ER-h` no-replay-410-413 | S-33 | receivers answering 410 and 413 | an event delivered twice to either |
483
+ | `ER-i` ssrf-refused | S-32 (callback rules) | callbacks to `127.0.0.1`, `localhost`, `2130706433` on the canary port | accepted, -32015 (a connection was attempted), or the canary is hit |
484
+ | `ER-j` no-redirect | S-32 (callback rules) | a receiver answering 307 to another path | the redirect target receives anything |
485
+
486
+ Could-not-judge, always named, never a pass:
487
+
488
+ - **No public callback** (`--events-callback-base`): a server that refuses a loopback callback cannot reach the
489
+ receiver, so ER-c's secret half, ER-d, ER-e, ER-f, ER-g, ER-h and ER-j are could-not-judge. The base must
490
+ forward to `--events-receiver-port` on the machine running the probe.
491
+ - **No trigger** (`--events-trigger`): the protocol has no method that causes an event, so ER-g, ER-h and the
492
+ "no event after a failed verification" half of ER-e are could-not-judge.
493
+ - **Fewer than two argument keys** (`--events-args`): ER-d has no key order to permute.
494
+ - **No retry within `--events-observe-ms`** (default 5000): the retry half of ER-g. "Never redelivered" (ER-h) is
495
+ judged within that window only.
496
+ - **HTTP 401/403 before JSON-RPC** on the unauthenticated call: what `events/subscribe` itself answers is not
497
+ observable (ER-b).
498
+ - **The conforming receiver refused**: the receiver echoes `{"challenge": "<value>"}` with HTTP 200; a server
499
+ that reads another echo form leaves ER-e could-not-judge, naming the answer.
500
+
501
+ Not probed: `data` against `payloadSchema` (S-33), another principal and restart survival (S-31), descriptors
502
+ (S-30), access recheck (S-34). The SSRF canary listens on the probe's own loopback, so a hit is seen only for a
503
+ server on the same host; for a remote server the answer decides (-32602 passes, -32015 or a result is red).
504
+
505
+ ### Changes in 0.18.0 — the report states what it read; DServer14 reads the challenge where it is set
506
+
507
+ #### The report states how many source files and registered tools it read
508
+
509
+ A `coverage:` line now follows `surface:` in the table, and a `coverage` object is in the `--json` report.
510
+ It gives the number of source files the scan read (the same files every detector reads: `.ts`/`.tsx`, without
511
+ `.d.ts` and `.test.ts`, outside the skipped directories). It also gives the number of registered tools the
512
+ shared tool reader read (the reader D8 and the per-tool rules use). Product-looking files the scan does not read
513
+ (`.js`, `.mjs`...) are counted and named on the same line. So are registration sites whose tool name could not
514
+ be read. When no tool could be read on a tree that serves tools (an SDK-first server with computed names, or a
515
+ tool surface with no located registration), the line says `registered tools: NOT READ — <why>`. It never prints
516
+ 0 as if it counted. `0 registered tools read` appears only when the tree has no tool surface. Under `--url`
517
+ the line says no source tree was read. In JSON, `coverage.tools` is `{ read, unresolvedSites }` or
518
+ `{ unreadable }`.
519
+
520
+ #### DServer14 reads the 401 challenge where the header is set
521
+
522
+ Element 1 (the `401` + `WWW-Authenticate: Bearer … resource_metadata=…` challenge) used to be four tokens found
523
+ anywhere in the tree. It stayed present when every line that sets the header was commented out: the tokens
524
+ were still in an unused constant, in other 401 responses, and in the token endpoint's `Basic` challenge. It is
525
+ now present only when one live site sets the header to a Bearer challenge carrying `resource_metadata=`, with
526
+ a `401` in the same block within a few lines (6 before, 8 after).
527
+
528
+ The value is read at the site: a string or template literal, or an identifier bound once in the same file to
529
+ one (`const wwwAuthHeader = \`Bearer resource_metadata=…\`` then `c.header("WWW-Authenticate", wwwAuthHeader)`).
530
+ The set forms read are `.header(name, v)` (Hono, Express), `.set` / `.append` (Fetch `Headers`, Express),
531
+ `.setHeader` / `.appendHeader` (Node), a `"WWW-Authenticate": v` key in a headers object (Response init,
532
+ `writeHead`, `c.text(body, status, headers)`), a `["WWW-Authenticate", v]` tuple, and `headers["WWW-Authenticate"] = v`.
533
+ A `Basic` or other non-Bearer challenge is not Element 1. Reads (`.get`, a one-argument `.header(name)`, a
534
+ subscript read) and CORS header-name lists are not set sites.
535
+
536
+ The rule is could-not-judge, naming the site, in two cases. One: the header name sits anywhere else, such
537
+ as a constant holding the name or a helper taking it as an argument. Two: no site qualifies and a set
538
+ site's value cannot be read (a call, an imported identifier, several bindings). A challenge delegated to
539
+ `@vantageos/cloud-identity` and forwarded is read as before. The non-conforming verdict lists every
540
+ header-set site read and why it did not count.
541
+
238
542
  ### Changes in 0.17.0 — S-47 (standard `1c66e11c` = mcp-server-standard v2.11, PR #311)
239
543
 
240
544
  #### S-47 reports a server whose events are not delivered by signed webhook
@@ -287,7 +591,9 @@ the `io.modelcontextprotocol/skills` extension and publishes plugin packages (a
287
591
  `.claude-plugin/plugin.json`, `.cursor-plugin/plugin.json`, or an Agent Plugins `plugin.json`), each package must
288
592
  carry `skills/<name>/` for every skill in the tree, the whole folder byte-equal to the served copy: `SKILL.md` and
289
593
  every file beside it (`references/`, `scripts/`, assets). A missing skill, or a file missing, differing or extra in
290
- the copy, is red and named; a file that cannot be read is could-not-judge. A package at the repository root whose `skills/` is the
594
+ the copy, is red and named; a file that cannot be read, or a folder that cannot be listed, on either side is
595
+ could-not-judge, named, and is never counted as missing, extra or different; a `SKILL.md` is called missing only
596
+ when the folder above it can be listed. A package at the repository root whose `skills/` is the
291
597
  served folder satisfies it as is.
292
598
  ### Changes in 0.17.0 — C-34 (standard `1c66e11c` = mcp-standard v2.8, PR #311)
293
599