@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/dist/doctor.d.ts CHANGED
@@ -1,85 +1,7 @@
1
1
  #!/usr/bin/env node
2
- interface SourceLine {
3
- n: number;
4
- raw: string;
5
- /** true when the line is a comment-only line (JSDoc star, slash-slash, block open/close). */
6
- comment: boolean;
7
- }
8
- interface SourceFile {
9
- path: string;
10
- rel: string;
11
- lines: SourceLine[];
12
- }
13
- /** A directory a walk declined to descend into, recorded AS the walk skipped it. */
14
- interface SkippedDir {
15
- /** Path relative to the walk root, `/`-separated. */
16
- path: string;
17
- /** Why the canonical list excludes this directory name. */
18
- reason: string;
19
- /**
20
- * Set only by a walk that probed the skipped directory for its own candidate
21
- * inputs (C-26: a deploy-config file). Names the first candidate found there,
22
- * relative to the walk root. Unset means "not probed", never "nothing there".
23
- */
24
- candidate?: string;
25
- }
26
- interface Tree {
27
- root: string;
28
- files: SourceFile[];
29
- /**
30
- * `unreadable` is set (with the parse error) when the file exists but is not a
31
- * JSON object; `json` is then `{}` and MUST NOT be read as the file's content.
32
- * Detectors that read this file go through `guardUnreadablePackageJson`.
33
- */
34
- packageJson: {
35
- path: string;
36
- json: Record<string, unknown>;
37
- unreadable?: string;
38
- } | null;
39
- /**
40
- * Directories skipped on THIS run, recorded by the walks as they skip them
41
- * (deduplicated by path). Mutable on purpose: a detector that walks the tree
42
- * itself records into it through `recordSkip`. Never derived from the
43
- * configured list: the report states what was walked past, not what could be.
44
- */
45
- skippedDirs: SkippedDir[];
46
- /**
47
- * The backend source root (a `convex/` directory) a detector may read the
48
- * backend's door list from. Set by the caller (`--backend=<dir>`); when unset a
49
- * detector that needs it looks for the nearest `convex/` above `root` and says
50
- * so when it finds none. Unset means "not supplied", never "no backend".
51
- */
52
- backendRoot?: string;
53
- /**
54
- * Product-looking source the scan did NOT read (`.js` `.mjs` `.cjs` `.jsx` `.mts` `.cts`, relative paths;
55
- * declarations, tests and config files excluded). A rule that says `absent` on the strength of the files
56
- * it read must not say it while this list is non-empty: it says could-not-judge and names them.
57
- */
58
- unscannedSource?: string[];
59
- }
60
- /**
61
- * The target names nothing the doctor can read, so there is no subject to judge. Thrown by
62
- * `loadTree` before any detector runs; the CLI turns it into exit 2 ("could not judge"), never 1:
63
- * a verdict of "violation" about a tree that was never read is a finding manufactured from nothing.
64
- *
65
- * The forms a target can take come from `fs.statSync` and `fs.readdirSync`, and every one of them
66
- * that yields no readable file ends here, named:
67
- * - stat fails (does not exist, permission, a path through a file, a loop);
68
- * - a directory that cannot be listed;
69
- * - a directory with no entries;
70
- * - a directory whose walk reaches no readable file (only empty, skipped, unreadable or
71
- * non-regular entries — a FIFO, socket or device is never read: reading one can block);
72
- * - a regular file that is not `.ts` / `.tsx` (the only single files the scan reads);
73
- * - a `.ts` / `.tsx` file that cannot be read;
74
- * - anything that is neither a directory nor a regular file.
75
- * A directory holding at least one file IS a subject: the detectors judge it, and a missing README
76
- * or lockfile there is a real violation.
77
- */
78
- declare class SubjectUnreadableError extends Error {
79
- readonly target: string;
80
- readonly form: string;
81
- constructor(target: string, form: string);
82
- }
2
+ import { S as SkippedDir } from './scan-Cn2EjRVE.js';
3
+ import { Tree } from './kit/source/index.js';
4
+ export { a as SubjectUnreadableError } from './scan-Cn2EjRVE.js';
83
5
 
84
6
  type State = "present" | "absent" | "non-conforming" | "could-not-judge" | "not-applicable";
85
7
  /**
@@ -135,10 +57,15 @@ interface RuntimeTool {
135
57
  name: string;
136
58
  /** The display title served (`title`, else `annotations.title`); C-35 compares a listing kit to it. */
137
59
  title?: string;
138
- /** The two behaviour hints a directory reads, as served (C-35). Unset when the tool serves no annotations. */
60
+ /**
61
+ * The behaviour hints served as booleans: the two a directory reads (C-35) and the four C-40 (3) scores. A hint
62
+ * served as anything but a boolean is left out. Unset when the tool serves no annotations.
63
+ */
139
64
  annotations?: {
140
65
  readOnlyHint?: boolean;
141
66
  destructiveHint?: boolean;
67
+ idempotentHint?: boolean;
68
+ openWorldHint?: boolean;
142
69
  };
143
70
  /**
144
71
  * The description the server actually SERVES over `tools/list`, post-
@@ -169,6 +96,12 @@ interface RuntimeTool {
169
96
  * when the tool serves none.
170
97
  */
171
98
  outputSchema?: Record<string, unknown>;
99
+ /**
100
+ * The served `_meta` exactly as tools/list returned it (any JSON kind; unset when the tool serves none). A-13 reads
101
+ * the App link and `openai/toolInvocation` from it. Whether the introspector recorded `_meta` at all is
102
+ * `ServedFacts.toolMetaRecorded`: an unset `meta` on a record without that flag is unread, never "none served".
103
+ */
104
+ meta?: unknown;
172
105
  }
173
106
  /**
174
107
  * What one invalid-cursor probe read (C-11). The domain is the JSON-RPC response shapes: an `error`
@@ -279,6 +212,29 @@ type ServedAuthorize = {
279
212
  kind: "probed";
280
213
  clients: ServedAuthorizeClient[];
281
214
  };
215
+ /**
216
+ * One public GET the introspector made for S-50, with NO credential attached, on the MCP endpoint's own origin. The
217
+ * detector classifies it; the probe only records. `status` unset = no answer (then `detail` says why).
218
+ */
219
+ interface ServedGet {
220
+ url: string;
221
+ status?: number;
222
+ contentType?: string;
223
+ /** The body parsed as JSON, when it is a JSON object (a server-card candidate). */
224
+ json?: Record<string, unknown>;
225
+ /** The first 8 000 characters of a textual body (the landing page at the MCP base URL). */
226
+ text?: string;
227
+ detail?: string;
228
+ }
229
+ /** S-50's public reads: the server-card candidates on the endpoint origin and a GET of the MCP base URL. */
230
+ type ServedDiscovery = {
231
+ kind: "not-run";
232
+ reason: string;
233
+ } | {
234
+ kind: "probed";
235
+ cards: ServedGet[];
236
+ landing: ServedGet;
237
+ };
282
238
  /** What the running server SERVES that a source-tree read can only guess at. */
283
239
  interface ServedFacts {
284
240
  /** `capabilities` of the `initialize` response, as served. */
@@ -295,6 +251,19 @@ interface ServedFacts {
295
251
  authServer: ServedAuthServer;
296
252
  /** S-46 served half: sign-ins started as each known CIMD client. Absent on records written before it existed. */
297
253
  authorize?: ServedAuthorize;
254
+ /**
255
+ * The `initialize` result beside `serverInfo` and `capabilities` (S-49, C-38): its keys and its `instructions` value
256
+ * as served (any JSON kind; unset when the key is absent). Absent on records written before it existed, which a rule
257
+ * reading it says (could-not-judge), never "no instructions".
258
+ */
259
+ initialize?: {
260
+ resultKeys: string[];
261
+ instructions?: unknown;
262
+ };
263
+ /** True when the introspector recorded each served tool's `_meta` into `RuntimeTool.meta` (A-13). */
264
+ toolMetaRecorded?: boolean;
265
+ /** S-50: the public server-card and landing-page reads. Absent on records written before it existed. */
266
+ discovery?: ServedDiscovery;
298
267
  }
299
268
  /**
300
269
  * What the RUNNING target server exposes, gathered by launching it and speaking
@@ -371,6 +340,8 @@ interface RuntimeContext {
371
340
  publicAuth?: {
372
341
  authServer: ServedAuthServer;
373
342
  authorize?: ServedAuthorize;
343
+ /** S-50's public reads, made even when the handshake was refused (a 401 is exactly what a visitor gets). */
344
+ discovery?: ServedDiscovery;
374
345
  };
375
346
  }
376
347
  interface Detector {
@@ -599,6 +570,16 @@ interface HttpEndpoint {
599
570
  source?: string;
600
571
  /** The full 40-hex commit the server is expected to serve; wins over one derived from `source`. */
601
572
  expectedCommit?: string;
573
+ /**
574
+ * The owner's consent (`--allow-tool-calls`) to send `tools/call` to this live server. Absent, no
575
+ * tool is called, whatever it declares about itself; the probes that need a call say so.
576
+ */
577
+ allowToolCalls?: boolean;
578
+ /**
579
+ * The owner's consent (`--allow-private-target`) to scan a host that resolves to an address that is
580
+ * not globally reachable (IANA special-purpose registries). Absent, such a target is refused before any request (publicTarget.ts).
581
+ */
582
+ allowPrivateTarget?: boolean;
602
583
  /**
603
584
  * The CIMD clients the S-46 served half signs in as. Default: the known ones (targets.ts `CIMD_CLIENTS`). A
604
585
  * caller (a test) may name others, e.g. a client document served on a loopback host.
@@ -948,5 +929,5 @@ declare function countByState(results: DetectorResult[]): Record<State, number>;
948
929
  */
949
930
  declare function computeExitCode(results: DetectorResult[]): number;
950
931
 
951
- export { ALL_STATES, NoRuleIdsDerivedError, OWED_FILE_NAME, STATE_RANK, StandardUnreadableError, SubjectUnreadableError, checkedRuleIds, computeExitCode, countByState, countOwedHumanVerdicts, coverageSummary, deriveRuleIds, endpointSecrets, evaluateGate, gateExitCode, introspectEndpoint, isLiveDetector, notCheckableResults, readCoverage, readOwedFile, redactSecrets, renderCoverage, renderGate, renderJson, renderOwedVerdicts, renderReport, renderResults, renderSkipped, renderTable, ruleCoverage, ruleIdOf, ruleNumber, runDoctor, runDoctorAsync, runDoctorReport, runEventsReady, sortRuleIds, tallyLine, tallyRules, writeReport };
932
+ export { ALL_STATES, NoRuleIdsDerivedError, OWED_FILE_NAME, STATE_RANK, StandardUnreadableError, checkedRuleIds, computeExitCode, countByState, countOwedHumanVerdicts, coverageSummary, deriveRuleIds, endpointSecrets, evaluateGate, gateExitCode, introspectEndpoint, isLiveDetector, notCheckableResults, readCoverage, readOwedFile, redactSecrets, renderCoverage, renderGate, renderJson, renderOwedVerdicts, renderReport, renderResults, renderSkipped, renderTable, ruleCoverage, ruleIdOf, ruleNumber, runDoctor, runDoctorAsync, runDoctorReport, runEventsReady, sortRuleIds, tallyLine, tallyRules, writeReport };
952
933
  export type { Coverage, CoverageReport, DetectorResult, EventsReadyOptions, GateVerdict, HttpEndpoint, LiveDetector, RegistryEntry, ReportContext, RunDoctorOptions, RunMode, Session, State, StateRank, Tally };