@vantageos/mcp-doctor 0.9.1 → 0.11.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
@@ -3,6 +3,106 @@
3
3
  All notable changes to `@vantageos/mcp-doctor` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/).
5
5
 
6
+ ## 0.11.0 — 2026-10-29
7
+
8
+ Minor, not a patch: six rules that `--url` did not run now run, and rules that were `could-not-judge` or
9
+ `non-conforming` from a source-tree read are settled by what the running server serves or what is installed.
10
+ A new detector contract (`runServed`) is visible to library consumers.
11
+
12
+ ### Added
13
+ - **Served half (`runServed`)**: a detector may judge, from what the running server serves, the part of a rule the
14
+ tree could not decide. The runner reads the tree first; only a `could-not-judge` is settled from the wire, a
15
+ decisive static verdict stands, and a served `could-not-judge` keeps the static account and appends its own
16
+ (`<static reason> | served: <reason>`). Over `--url` (no tree) the served half is the verdict. `--url` now judges
17
+ 13 rules (was 7): S5 (g)(l), D3, D4, S10, S12, S23 added.
18
+ - **S-23** (`MCP-Protocol-Version`): two requests after initialize, one with the negotiated version (control) and
19
+ one with `1999-01-01`. Present only when the control is 2xx and the unsupported version is `400`; a 2xx on the
20
+ unsupported version is non-conforming; any other pair is `could-not-judge` naming both statuses.
21
+ - **D3 / D4** (S-2 / S-3): `resultType` is read on each served list response and on ONE tool-call response (a tool the
22
+ server itself declares `readOnlyHint: true` with no required argument, called with `{}`; only the keys of the
23
+ result are recorded, never its content; no such tool: no call is invented, and the verdict says so). `ttlMs` and
24
+ `cacheScope` are read on every served list. A field absent in a session negotiated BELOW revision 2026-07-28 (where
25
+ these are wire vocabulary) is `could-not-judge` naming the negotiated revision, not a violation; at or above it,
26
+ absent is non-conforming; a served field of the wrong type is non-conforming at any revision.
27
+ - **S-12**: `nextCursor` on each served list method. A served cursor must be a non-empty string and must be accepted
28
+ when presented back untouched (refused: non-conforming). A page with no `nextCursor` is the terminal page: stated
29
+ as such, with the note that pagination under growth is not exercised (the doctor invents no entries).
30
+ - **S-10**: with no subscription or events capability served (keys derived from the served capability names, a key
31
+ served as `false` excepted) the subscription probe has no object: `absent`, stated, with the capability keys it was
32
+ read from and, over `--url`, the note that the outbound-fetch half (a source-tree read) was not run. A declared
33
+ surface is `could-not-judge` (the probe needs a receiver the doctor does not stand up).
34
+ - **S-5 (g)(l), served**: the authorization-server metadata the PRM names (same origin only: the doctor never fetches
35
+ an origin a server names; no credential is sent to the public metadata URL). `client_id_metadata_document_supported`
36
+ and `authorization_response_iss_parameter_supported` must be the boolean true and the methods an array listing
37
+ `"none"`; a contradicted element is non-conforming, the rest of S-5 (f, h, i, j, k, and `iss` on every response)
38
+ is named as not read.
39
+ - **S-5 (g)(l), installed**: when the tree names the AS metadata route but does not write the document (the library
40
+ does), the declared dependencies are read in `node_modules` (comment-aware). An installed library can PROVE an
41
+ element (reported under `established:`); it can never prove an absence, so an element it does not state is owed
42
+ to the served metadata, never red. No `node_modules`, a declared dependency not installed, a file too large to read:
43
+ each is named.
44
+ - Programmatic: `Detector.runServed`, `ServedFacts`, `RuntimeContext.served`, `readServed`.
45
+
46
+ ### Fixed
47
+ - S-13 failed OPEN on outbound requests that do not go through a literal `fetch(`: a fetch routed through a local
48
+ wrapper (`boundedFetch`), an injected `fetchImpl` / `fetchWithToken`, or handed to an SDK client as its `fetch`
49
+ option read "no outbound request is emitted" -> present, whatever the timeout. The detector now reads the census of
50
+ outbound forms written in `s13OutboundSites.ts` (global fetch, axios / got / ky, http(s) / undici, injected fetch,
51
+ one-level wrappers and their call sites, SDK `fetch` option); every site proves a timeout or is non-conforming
52
+ naming `file:line`; a form it cannot follow (an HTTP client under another name, an alias of the global fetch, a
53
+ wrapper of a wrapper, an unreadable `fetch` option) is could-not-judge naming the site. "No outbound request is
54
+ emitted" is claimed only when every form finds zero sites, and a present verdict lists its sites.
55
+ Any other READ of the global `fetch` binding is also could-not-judge naming `file:line` and the form, never
56
+ dropped: `Reflect.apply(fetch, ..)`, `(0, fetch)(..)`, `fetch.call`, `globalThis["fetch"](..)`, `window.fetch`,
57
+ `self["fetch"]`, `Reflect.get(globalThis, "fetch")`, a destructure off the global object, an alias passed on, the bare
58
+ `globalThis` used as a value. Recognised and not flagged: a read inside a wrapper call, an SDK `fetch` option, an
59
+ injected-parameter default, `typeof fetch`. The census is written in the header of `s13OutboundSites.ts`.
60
+ A skip that says "another step judges it" now holds only when that step recorded the site at that place: a direct
61
+ call spelled `fetch` + newline + `(` or `fetch /* c */ (` (which the direct-call reader does not read) is judged on
62
+ its own options (non-conforming without a timeout, named could-not-judge when unclosed), and the same rule governs
63
+ an SDK `fetch: wrapper(..)` option whose wrapper call is not reached, `Reflect.get(globalThis)` without a key, and a
64
+ nested destructure off `globalThis`. The four hand-offs are listed in the header of `s13OutboundSites.ts`.
65
+ - S-5 (g): `token_endpoint_auth_methods_supported` written with a QUOTED key (`"token_endpoint_auth_methods_supported": [..]`,
66
+ the JSON-shaped literal) was not recognised, so a tree that lists `"none"` was reported non-conforming. The three
67
+ spellings of a property key (bare, double-quoted, single-quoted) are now read. A value that is not an array literal
68
+ (a constant, a spread) is owed to the served metadata instead of red.
69
+ - S-5: a tree that merely names `/.well-known/oauth-authorization-server` (to request it, or to mount a library that
70
+ serves it) was treated as one that writes the document, and reported (g)/(l) non-conforming for flags the library
71
+ states in `node_modules`.
72
+
73
+ ## 0.10.0 — 2026-10-29
74
+
75
+ ### Added
76
+ - **`--url <https url>`: judge a remote streamable-HTTP MCP server the way a customer reaches it.** Dynamic mode
77
+ used to spawn the server over stdio, so an HTTP-only server came back `could-not-judge` on every runtime rule
78
+ ("timeout: server did not answer initialize+tools/list" / "exited before handshake"). `--url` implies dynamic,
79
+ takes no launch target (refused loudly if one is given, or `--mode` other than dynamic), and runs the seven rules
80
+ that read what a running server serves (D8, D16, C11, C19, C21, C25, DServer2). The source-tree rules have no tree
81
+ to read over HTTP and are not run; the run says so on stderr.
82
+ - **One probe path behind a transport.** The introspector's handshake, `tools/list` and invalid-cursor probes are
83
+ unchanged and shared; only the transport differs (stdio child or streamable HTTP: JSON or SSE answers, session id
84
+ and negotiated protocol version carried). No second copy of the rules.
85
+ - **Auth that never prints.** `--bearer-env VAR` reads the token from the named environment variable (never a
86
+ command-line argument); `--header "Name: value"` is repeatable. Header values, the token, URL userinfo and URL
87
+ query values are scrubbed (`[redacted]`) from everything printed, including text a server echoes back.
88
+ - `--source DIR` (the server's source tree: D8 eval counts, D16 package version, C19/C21 ceiling, expected commit
89
+ via `git rev-parse HEAD`) and `--expected-commit SHA` (C25). Without them those rules say "no source tree given"
90
+ (`could-not-judge`), never zero coverage or a pass.
91
+ - Programmatic: `introspectEndpoint`, `endpointSecrets`, `redactSecrets` are exported.
92
+
93
+ ### Fail-closed, with the cause named
94
+ An unreachable host (`unreachable: ECONNREFUSED ...`), a TLS error, HTTP 401/403 (`authentication refused`), a
95
+ redirect (never followed: a credential is not sent to a redirect target), any other non-2xx, a response that is not
96
+ MCP (wrong content-type, a body or SSE event that is not JSON-RPC), and an `initialize` / `tools/list` the server
97
+ answers with a JSON-RPC error are each `could-not-judge` with that cause. The last also applies to stdio: an error
98
+ answer is no longer read as an empty tool list. `http://` is accepted only for a loopback host.
99
+
100
+ ### Proof
101
+ `tests/url-mode.test.ts` (36 tests, in-process HTTP server, the built CLI spawned asynchronously) and
102
+ `scripts/url-mode-mutation-probe.sh`: one mutation per formulation of the transport branch (401, 403, redirect,
103
+ non-2xx, non-MCP body, non-JSON-RPC member, SSE event, TLS, unreachable cause, both scrub layers, query and
104
+ token-in-header collection), each landing grep-asserted, each turning the suite red, restoration proven.
105
+
6
106
  ## 0.9.1 — 2026-10-28
7
107
 
8
108
  Two could-not-judge classes of S-36..S-41 that were false, found by running 0.9.0 on
package/README.md CHANGED
@@ -47,6 +47,7 @@ The binary's own `--help` is the authority; this is what it prints:
47
47
 
48
48
  ```
49
49
  usage: mcp-doctor <source-tree-path> [--mode=static|dynamic|both] [--backend=<convex-dir>] [--json]
50
+ mcp-doctor --url <https url> [--bearer-env VAR] [--header "Name: value"]... [--source DIR] [--expected-commit SHA] [--json]
50
51
 
51
52
  --mode=static read the tree only (default)
52
53
  --mode=dynamic launch the server and judge what it serves
@@ -56,6 +57,16 @@ usage: mcp-doctor <source-tree-path> [--mode=static|dynamic|both] [--backend=<co
56
57
  fails (default 0)
57
58
  --backend=DIR the backend source (a convex/ dir) whose door list S-28 reads;
58
59
  default: the nearest convex/ above the tree
60
+ --url URL judge a REMOTE streamable-HTTP server the way a customer reaches it (implies
61
+ dynamic; no launch target; https, or http on loopback only). Only the rules that
62
+ judge what a running server serves run (incl. S5 (g)(l), D3, D4, S10, S12, S23);
63
+ source-tree rules are not run
64
+ --bearer-env VAR send the token held in environment variable VAR as 'Authorization: Bearer'
65
+ (the token never appears on a command line or in output)
66
+ --header "Name: value" an extra request header (repeatable); values are never printed
67
+ --source DIR with --url: the server's source tree, for D8 eval counts and the C-25 expected
68
+ commit (git rev-parse HEAD there)
69
+ --expected-commit SHA with --url: the full commit id the server must serve (C-25)
59
70
  --json print the report as JSON (results, owedHumanVerdicts, exitCode)
60
71
  --version print the version and exit
61
72
  --help print this and exit
package/dist/doctor.d.ts CHANGED
@@ -181,6 +181,69 @@ interface CursorProbe {
181
181
  surface: "list-method" | "tool-argument";
182
182
  outcome: CursorProbeOutcome;
183
183
  }
184
+ /** One protocol list response as served (S-3 / S-12): what its `result` carries beside the page itself. */
185
+ interface ServedList {
186
+ /** The protocol list method (`tools/list`, `resources/list`, ...). */
187
+ method: string;
188
+ /** `answered`: a JSON-RPC result; `refused`: a JSON-RPC error; `no-answer`: nothing before the deadline. */
189
+ outcome: "answered" | "refused" | "no-answer";
190
+ /** The reason, for `refused` (the error) and `no-answer` (the cause). */
191
+ detail?: string;
192
+ /** Every key of the `result` object (the served wire shape, read, never assumed). */
193
+ resultKeys?: string[];
194
+ resultType?: unknown;
195
+ ttlMs?: unknown;
196
+ cacheScope?: unknown;
197
+ /** The `nextCursor` value as served (undefined when the key is absent). */
198
+ nextCursor?: unknown;
199
+ /** How many entries the page carried (the array named by the method). */
200
+ entries?: number;
201
+ /** When a `nextCursor` was served: the answer to presenting it back untouched. */
202
+ followUp?: {
203
+ outcome: "answered" | "refused" | "no-answer";
204
+ detail?: string;
205
+ entries?: number;
206
+ };
207
+ }
208
+ /** The `MCP-Protocol-Version` header probe (S-23): the status of a request per version sent. */
209
+ type VersionProbe = {
210
+ kind: "statuses";
211
+ supportedVersion: string;
212
+ supported: number;
213
+ unsupported: number;
214
+ } | {
215
+ kind: "not-run";
216
+ reason: string;
217
+ };
218
+ /** The authorization-server metadata as served (S-5 (g)(l)). */
219
+ type ServedAuthServer = {
220
+ kind: "document";
221
+ url: string;
222
+ status: number;
223
+ document: Record<string, unknown>;
224
+ } | {
225
+ kind: "not-run";
226
+ reason: string;
227
+ } | {
228
+ kind: "unavailable";
229
+ url: string;
230
+ reason: string;
231
+ };
232
+ /** What the running server SERVES that a source-tree read can only guess at. */
233
+ interface ServedFacts {
234
+ /** `capabilities` of the `initialize` response, as served. */
235
+ capabilities: Record<string, unknown>;
236
+ /** The protocol revision the server answered `initialize` with (unset when it named none). */
237
+ protocolVersion?: string;
238
+ lists: ServedList[];
239
+ /**
240
+ * The served tool-call response(s) (S-2): one call to a tool the server declares read-only that
241
+ * needs no argument. Empty when no tool qualifies (no call is invented).
242
+ */
243
+ calls: ServedList[];
244
+ versionProbe: VersionProbe;
245
+ authServer: ServedAuthServer;
246
+ }
184
247
  /**
185
248
  * What the RUNNING target server exposes, gathered by launching it and speaking
186
249
  * MCP over stdio (`initialize` -> `initialized` -> `tools/list`). This is the
@@ -199,6 +262,14 @@ interface RuntimeContext {
199
262
  * second argument — the decided `runDynamic(runtime)` signature stays single.
200
263
  */
201
264
  root: string;
265
+ /**
266
+ * True when the server was reached over a URL (`--url`): `root` is then the DISPLAYED endpoint, not a
267
+ * path, and no detector may treat it as a directory. The source tree of the same server, when the
268
+ * caller supplied one, is `sourceRoot`; a detector that reads a static co-artifact reads it through
269
+ * `runtimeSourceRoot` and says so (could-not-judge) when there is none.
270
+ */
271
+ remote?: boolean;
272
+ sourceRoot?: string;
202
273
  tools: RuntimeTool[];
203
274
  launchError?: string;
204
275
  /**
@@ -234,6 +305,12 @@ interface RuntimeContext {
234
305
  * introspector recorded none (C-11 reads that as could-not-judge, never a pass).
235
306
  */
236
307
  cursorProbes?: CursorProbe[];
308
+ /**
309
+ * The served facts a source-tree read cannot see (list-response shape, capabilities, the
310
+ * protocol-version refusal, the authorization-server metadata). Unset when the introspector
311
+ * recorded none: a rule reading it says could-not-judge, naming that, never a pass.
312
+ */
313
+ served?: ServedFacts;
237
314
  }
238
315
  interface Detector {
239
316
  id: string;
@@ -257,6 +334,13 @@ interface Detector {
257
334
  * implements this; detectors without it run static-only in every mode.
258
335
  */
259
336
  runDynamic?(runtime: RuntimeContext): DetectorResult;
337
+ /**
338
+ * Optional SERVED half: judge from what the running server serves the part of the rule a source
339
+ * tree could not decide. It never replaces a decisive static verdict: the runner calls it only
340
+ * when the static run is could-not-judge (or, over `--url`, when there is no tree), passing that
341
+ * static result when there is one. A could-not-judge here keeps the static reason and appends this one.
342
+ */
343
+ runServed?(runtime: RuntimeContext, staticResult?: DetectorResult): DetectorResult;
260
344
  }
261
345
  /**
262
346
  * A minimal handle to a RUNNING MCP session — a live client the consumer has
@@ -329,11 +413,48 @@ interface LiveDetector {
329
413
  */
330
414
  declare function isLiveDetector(d: Detector | LiveDetector): d is LiveDetector;
331
415
 
416
+ /** A remote streamable-HTTP MCP server judged the way a customer reaches it (`--url`). */
417
+ interface HttpEndpoint {
418
+ /** The MCP endpoint. https, or http on a loopback host only (a credential never travels in clear). */
419
+ url: string;
420
+ /** Request headers (credentials included). Values are NEVER printed; see `redactSecrets`. */
421
+ headers: Record<string, string>;
422
+ /**
423
+ * Optional source tree of the same server. A remote URL carries no `evals/` and no git history:
424
+ * with a tree, D8 reads its eval counts and C-25 derives the expected commit from `git rev-parse HEAD`;
425
+ * without one, D8 and C-25 say so (could-not-judge) instead of judging an absent file as zero coverage.
426
+ */
427
+ source?: string;
428
+ /** The full 40-hex commit the server is expected to serve; wins over one derived from `source`. */
429
+ expectedCommit?: string;
430
+ }
431
+ /**
432
+ * Every secret value an `HttpEndpoint` carries: header values (and the token of an `Authorization:
433
+ * Bearer|Basic|Token <token>` value), the URL's userinfo, and every URL query value. Used to scrub
434
+ * anything printed. Values shorter than 6 characters are not scrubbed (replacing a 1-character value
435
+ * would garble every report); they are not credentials worth the name.
436
+ */
437
+ declare function endpointSecrets(ep: HttpEndpoint): string[];
438
+ /** Replace every secret in `text` with `[redacted]`. Longest first, so a token inside a header value goes whole. */
439
+ declare function redactSecrets(text: string, secrets: string[]): string;
440
+ /**
441
+ * Introspect a remote streamable-HTTP MCP server (`--url`): the same probes, the same judges, over
442
+ * the transport a customer uses. NEVER throws; a transport failure (unreachable, TLS, 401/403,
443
+ * redirect, a non-MCP response) is an in-band `launchError` naming the cause, never a pass.
444
+ */
445
+ declare function introspectEndpoint(ep: HttpEndpoint): RuntimeContext;
446
+
332
447
  type RunMode = "static" | "dynamic" | "both";
333
448
  interface RunDoctorOptions {
334
449
  mode?: RunMode;
335
450
  /** The backend source root (`convex/`) a detector reads the backend's door list from (S-28). */
336
451
  backend?: string;
452
+ /**
453
+ * A remote streamable-HTTP server to judge instead of a launched one (`--url`). Only the rules that
454
+ * judge what a RUNNING server serves can run (the source-tree rules have no tree to read): the run
455
+ * is dynamic by construction, and `target` is ignored.
456
+ */
457
+ endpoint?: HttpEndpoint;
337
458
  }
338
459
  /**
339
460
  * Run every detector against the target.
@@ -419,5 +540,5 @@ declare function renderJson(surface: string, results: DetectorResult[], skipped:
419
540
  */
420
541
  declare function computeExitCode(results: DetectorResult[]): number;
421
542
 
422
- export { SubjectUnreadableError, computeExitCode, countOwedHumanVerdicts, isLiveDetector, renderJson, renderOwedVerdicts, renderSkipped, renderTable, runDoctor, runDoctorAsync, runDoctorReport };
423
- export type { LiveDetector, RunDoctorOptions, RunMode, Session };
543
+ export { SubjectUnreadableError, computeExitCode, countOwedHumanVerdicts, endpointSecrets, introspectEndpoint, isLiveDetector, redactSecrets, renderJson, renderOwedVerdicts, renderSkipped, renderTable, runDoctor, runDoctorAsync, runDoctorReport };
544
+ export type { HttpEndpoint, LiveDetector, RunDoctorOptions, RunMode, Session };