@vantageos/mcp-doctor 0.9.0 → 0.9.1

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,36 @@
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.9.1 — 2026-10-28
7
+
8
+ Two could-not-judge classes of S-36..S-41 that were false, found by running 0.9.0 on
9
+ `@vantageos/mcp-boilerplate` 0.4.0 (main `d34e9f05`). Both vocabularies are derived, and each keeps a
10
+ fail-closed remainder.
11
+
12
+ ### Fixed
13
+ - **A Node core `createServer` is not an outbound call.** `createServer` of `node:http`, `node:https` and
14
+ `node:http2` builds an inbound server; it makes no request, yet S-36..S-41 named it as "an outbound HTTP call
15
+ through a form the scan does not follow". What a call through a Node core networking binding does is now read
16
+ from the module's export: `src/detectors/nodeCoreExports.ts` classifies every export of `http`, `https`,
17
+ `http2`, `net`, `tls` and `dgram` as `outbound` or `not-a-request`. A test derives the export list from the
18
+ running Node (`Object.keys(require("node:<module>"))`) and fails, naming each, when one is unclassified. An
19
+ unclassified member, `request`, `get`, `connect` and every ambiguous one (`Socket`, `WebSocket`,
20
+ `ClientRequest`) stay named.
21
+ - **A forwarding rebind of a registration method is transparent.** `const register = server.registerTool.bind(server);
22
+ server.registerTool = (name, config, cb) => register(name, config, cb)` (the boilerplate's `trackToolRecords`)
23
+ no longer makes every S-36..S-41 could-not-judge "by a route the scan does not read". It is transparent only
24
+ when all of this is proven: one `.bind(server)` original, one assignment of a function literal, that function
25
+ forwards exactly its own parameters, in order, to the original, the original is referenced nowhere else
26
+ in the file, and the tree registers tools by direct calls the scan reads. A `typeof server.registerTool`
27
+ type query is no route. Anything else (a wrapper that does not forward, that alters an argument, whose original
28
+ escapes, the method passed or returned as a value, a computed member) stays named, with the reason it is not
29
+ proven.
30
+ Forwarding the parameters' NAMES is not enough: the wrapper must also leave every parameter untouched. A
31
+ parameter that is re-assigned or re-declared (`callback = ...`, `name += ...`, a destructuring target), mutated
32
+ (`config.x = ...`, `delete config.x`, `Object.assign(config, ...)`), passed to any other call, stored, or
33
+ indexed, or a body that reads `arguments`, keeps the route named, with the touching statement. A member read
34
+ that only copies or tests (`{ ...config.annotations }`, `if (config.annotations)`) is kept.
35
+
6
36
  ## 0.9.0 — 2026-10-25
7
37
 
8
38
  Standard re-pinned to ElPi-Corp `015053b7268125cf441d7555fecfe41f318a06ed` (mcp-standard v2.7, ElPi-Corp
package/dist/doctor.js CHANGED
@@ -4723,6 +4723,110 @@ var c9VerbDeclared = {
4723
4723
  }
4724
4724
  };
4725
4725
 
4726
+ // src/detectors/nodeCoreExports.ts
4727
+ var TABLE = {
4728
+ http: {
4729
+ outbound: ["get", "request", "ClientRequest", "WebSocket"],
4730
+ notRequest: [
4731
+ "_connectionListener",
4732
+ "METHODS",
4733
+ "STATUS_CODES",
4734
+ "Agent",
4735
+ "IncomingMessage",
4736
+ "OutgoingMessage",
4737
+ "Server",
4738
+ "ServerResponse",
4739
+ "createServer",
4740
+ "isValidHeaderName",
4741
+ "isValidHeaderValue",
4742
+ "validateHeaderName",
4743
+ "validateHeaderValue",
4744
+ "setMaxIdleHTTPParsers",
4745
+ "setGlobalProxyFromEnv",
4746
+ "websocketMask",
4747
+ "websocketUnmask",
4748
+ "maxHeaderSize",
4749
+ "globalAgent",
4750
+ "CloseEvent",
4751
+ "MessageEvent"
4752
+ ]
4753
+ },
4754
+ https: {
4755
+ outbound: ["get", "request"],
4756
+ notRequest: ["Agent", "globalAgent", "Server", "createServer"]
4757
+ },
4758
+ http2: {
4759
+ outbound: ["connect"],
4760
+ notRequest: [
4761
+ "constants",
4762
+ "createServer",
4763
+ "createSecureServer",
4764
+ "getDefaultSettings",
4765
+ "getPackedSettings",
4766
+ "getUnpackedSettings",
4767
+ "performServerHandshake",
4768
+ "sensitiveHeaders",
4769
+ "Http2ServerRequest",
4770
+ "Http2ServerResponse"
4771
+ ]
4772
+ },
4773
+ net: {
4774
+ outbound: [
4775
+ "connect",
4776
+ "createConnection",
4777
+ "Socket",
4778
+ "Stream",
4779
+ "_TransferredBoundSocket",
4780
+ "BoundSocket"
4781
+ ],
4782
+ notRequest: [
4783
+ "_createServerHandle",
4784
+ "_normalizeArgs",
4785
+ "BlockList",
4786
+ "SocketAddress",
4787
+ "createServer",
4788
+ "isIP",
4789
+ "isIPv4",
4790
+ "isIPv6",
4791
+ "Server",
4792
+ "getDefaultAutoSelectFamily",
4793
+ "setDefaultAutoSelectFamily",
4794
+ "getDefaultAutoSelectFamilyAttemptTimeout",
4795
+ "setDefaultAutoSelectFamilyAttemptTimeout"
4796
+ ]
4797
+ },
4798
+ tls: {
4799
+ outbound: ["connect", "TLSSocket"],
4800
+ notRequest: [
4801
+ "CLIENT_RENEG_LIMIT",
4802
+ "CLIENT_RENEG_WINDOW",
4803
+ "DEFAULT_CIPHERS",
4804
+ "DEFAULT_ECDH_CURVE",
4805
+ "DEFAULT_MIN_VERSION",
4806
+ "DEFAULT_MAX_VERSION",
4807
+ "getCiphers",
4808
+ "getCertificateCompressionAlgorithms",
4809
+ "rootCertificates",
4810
+ "getCACertificates",
4811
+ "setDefaultCACertificates",
4812
+ "convertALPNProtocols",
4813
+ "checkServerIdentity",
4814
+ "createSecureContext",
4815
+ "SecureContext",
4816
+ "Server",
4817
+ "createServer"
4818
+ ]
4819
+ },
4820
+ dgram: { outbound: ["createSocket", "Socket"], notRequest: [] }
4821
+ };
4822
+ function classifyNodeExport(module, exportName) {
4823
+ const t = TABLE[module.replace(/^node:/, "")];
4824
+ if (!t) return void 0;
4825
+ if (t.outbound.includes(exportName)) return "outbound";
4826
+ if (t.notRequest.includes(exportName)) return "not-a-request";
4827
+ return void 0;
4828
+ }
4829
+
4726
4830
  // src/detectors/upstreamKit.ts
4727
4831
  var cache = /* @__PURE__ */ new WeakMap();
4728
4832
  function srcs(tree) {
@@ -5041,7 +5145,20 @@ function unresolvedOutbound(tree) {
5041
5145
  if (via && !bindings.has(h[1])) bindings.set(h[1], `\`${h[1]}\` (an instance of ${via})`);
5042
5146
  }
5043
5147
  }
5148
+ const core = /* @__PURE__ */ new Map();
5149
+ for (const b of importBindings(s)) {
5150
+ if (/^node:(?:https?|http2)$|^(?:https?|http2)$/.test(b.module))
5151
+ core.set(b.local, { module: b.module, imported: b.imported });
5152
+ }
5044
5153
  for (const c of byFile.get(s) ?? []) {
5154
+ const parts = c.callee.split(".");
5155
+ const cb = core.get(parts[0]);
5156
+ if (cb !== void 0) {
5157
+ const member = cb.imported === "default" || cb.imported === "*" ? parts[1] : cb.imported;
5158
+ const direct = cb.imported === "default" || cb.imported === "*" ? parts.length === 2 : parts.length === 1;
5159
+ if (direct && member !== void 0 && classifyNodeExport(cb.module, member) === "not-a-request")
5160
+ continue;
5161
+ }
5045
5162
  if (GLOBAL_FETCH.test(c.callee)) {
5046
5163
  add(c, "the global fetch read off its holder");
5047
5164
  continue;
@@ -5055,6 +5172,177 @@ function unresolvedOutbound(tree) {
5055
5172
  }
5056
5173
  return out;
5057
5174
  }
5175
+ function splitList(m, from, to) {
5176
+ const out = [];
5177
+ let depth = 0;
5178
+ let start = from;
5179
+ for (let i = from; i < to; i++) {
5180
+ const ch = m[i];
5181
+ if (ch === "=" && m[i + 1] === ">") i++;
5182
+ else if ("([{<".includes(ch)) depth++;
5183
+ else if (")]}>".includes(ch)) depth--;
5184
+ else if (ch === "," && depth === 0) {
5185
+ out.push(m.slice(start, i).trim());
5186
+ start = i + 1;
5187
+ }
5188
+ }
5189
+ if (m.slice(start, to).trim() !== "") out.push(m.slice(start, to).trim());
5190
+ return out;
5191
+ }
5192
+ function wrapperProof(s, server, mine) {
5193
+ if (mine.some((h) => h.computed)) return "a computed member access";
5194
+ const m = s.shape;
5195
+ let alias;
5196
+ let nBind = 0;
5197
+ let assign;
5198
+ let nAssign = 0;
5199
+ for (const h of mine) {
5200
+ const after = m.slice(h.at + h.len);
5201
+ const before = m.slice(0, h.at);
5202
+ const bind = new RegExp(String.raw`^\s*\.\s*bind\s*\(\s*${esc(server)}\s*\)`).exec(after);
5203
+ const decl = /(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*(?::[^=;]+)?=\s*$/.exec(before);
5204
+ if (bind && decl) {
5205
+ nBind++;
5206
+ alias = decl[1];
5207
+ } else if (/^\s*=(?![=>])/.test(after)) {
5208
+ nAssign++;
5209
+ assign = h;
5210
+ } else
5211
+ return "the method is read in a form other than its rebind (passed, stored or returned as a value)";
5212
+ }
5213
+ if (nBind !== 1 || alias === void 0)
5214
+ return "no single `const X = server.M.bind(server)` original";
5215
+ if (nAssign !== 1 || assign === void 0)
5216
+ return "no single assignment `server.M = <function>` of the rebind";
5217
+ const rhsAt = assign.at + assign.len + (/^\s*=/.exec(m.slice(assign.at + assign.len))?.[0].length ?? 0);
5218
+ const head = /^[\s(]*(?:async\s+)?(?:function\b\s*[\w$]*\s*)?\(/.exec(m.slice(rhsAt));
5219
+ if (!head) return "the assigned value is not a function literal";
5220
+ const pOpen = rhsAt + head[0].length - 1;
5221
+ const pClose = matchClose(m, pOpen);
5222
+ if (pClose < 0) return "the parameter list is unbalanced";
5223
+ const params = splitList(m, pOpen + 1, pClose);
5224
+ const names = [];
5225
+ for (const p of params) {
5226
+ const id = /^(\.\.\.)?\s*([A-Za-z_$][\w$]*)/.exec(p);
5227
+ if (!id) return "a destructured parameter";
5228
+ if (/=>/.test(p)) return "a function type in the parameter list";
5229
+ names.push(`${id[1] ?? ""}${id[2]}`);
5230
+ }
5231
+ const tail = m.slice(pClose + 1);
5232
+ const arrow = /^\s*(?::[^=>{]*)?=>\s*/.exec(tail);
5233
+ const fnBody = arrow ? void 0 : /^\s*(?::[^{]*)?\{/.exec(tail);
5234
+ let bStart;
5235
+ let bEnd;
5236
+ if (arrow) {
5237
+ bStart = pClose + 1 + arrow[0].length;
5238
+ if (m[bStart] === "{") {
5239
+ bEnd = matchClose(m, bStart);
5240
+ } else {
5241
+ bEnd = bStart;
5242
+ let d = 0;
5243
+ while (bEnd < m.length) {
5244
+ const ch = m[bEnd];
5245
+ if ("([{".includes(ch)) d++;
5246
+ else if (")]}".includes(ch)) {
5247
+ if (d === 0) break;
5248
+ d--;
5249
+ } else if (d === 0 && (ch === ";" || ch === "\n")) break;
5250
+ bEnd++;
5251
+ }
5252
+ }
5253
+ } else if (fnBody) {
5254
+ bStart = pClose + 1 + fnBody[0].length - 1;
5255
+ bEnd = matchClose(m, bStart);
5256
+ } else return "the function literal has no readable body";
5257
+ if (bEnd < 0) return "the function body is unbalanced";
5258
+ const idRe = new RegExp(String.raw`(?<![\w$.])${esc(alias)}(?![\w$])`, "g");
5259
+ const all = [...m.matchAll(idRe)].map((x) => x.index ?? 0);
5260
+ const inBody = all.filter((i) => i > bStart && i < bEnd);
5261
+ if (inBody.length !== 1 || all.length !== 2)
5262
+ return `the original \`${alias}\` is referenced ${all.length - 1} time(s) after its binding (once, in the wrapper, is the proof)`;
5263
+ const at = inBody[0];
5264
+ let argsOpen = -1;
5265
+ if (/^\s*\(/.test(m.slice(at + alias.length, at + alias.length + 4))) {
5266
+ argsOpen = at + alias.length + m.slice(at + alias.length).indexOf("(");
5267
+ } else {
5268
+ const o = m.lastIndexOf("(", at);
5269
+ if (o >= 0 && m.slice(o + 1, at).trim() === "") {
5270
+ const c = matchClose(m, o);
5271
+ if (c > 0 && /^\s+as\b/.test(m.slice(at + alias.length, c))) {
5272
+ const nx = /^\s*\(/.exec(m.slice(c + 1));
5273
+ if (nx) argsOpen = c + nx[0].length;
5274
+ }
5275
+ }
5276
+ }
5277
+ if (argsOpen < 0) return `the original \`${alias}\` is not called in the wrapper`;
5278
+ const argsClose = matchClose(m, argsOpen);
5279
+ if (argsClose < 0) return "the forwarding call is unbalanced";
5280
+ const args = splitList(m, argsOpen + 1, argsClose);
5281
+ if (args.length !== names.length || args.some((a, i) => a !== names[i]))
5282
+ return `the wrapper does not forward exactly its own parameters (${names.join(", ")}) to \`${alias}\``;
5283
+ return untouchedParams(s, params, names, bStart, bEnd, argsOpen, argsClose);
5284
+ }
5285
+ var PRIMITIVE_TYPE = /^(?:(?:string|number|boolean|bigint|symbol|null|undefined|"[^"]*"|'[^']*'|\d+)\s*\|?\s*)+$/;
5286
+ function enclosingOpens(m, at, lo) {
5287
+ const out = [];
5288
+ let depth = 0;
5289
+ for (let i = at - 1; i >= lo; i--) {
5290
+ const ch = m[i];
5291
+ if (")]}".includes(ch)) depth++;
5292
+ else if ("([{".includes(ch)) {
5293
+ if (depth === 0) out.push(i);
5294
+ else depth--;
5295
+ }
5296
+ }
5297
+ return out;
5298
+ }
5299
+ function untouchedParams(s, params, names, bStart, bEnd, fwdOpen, fwdClose) {
5300
+ const m = s.shape;
5301
+ const stmt = (i) => {
5302
+ let a = i;
5303
+ while (a > bStart && !";{}\n".includes(m[a - 1])) a--;
5304
+ let b = i;
5305
+ while (b < bEnd && !";\n".includes(m[b])) b++;
5306
+ return `${anchorAt(s, i)} \`${m.slice(a, b).trim().replace(/\s+/g, " ").slice(0, 80)}\``;
5307
+ };
5308
+ const argsUse = /(?<![\w$.])arguments(?![\w$])/g.exec(m.slice(bStart, bEnd));
5309
+ if (argsUse)
5310
+ return `the wrapper reads \`arguments\`, which aliases its parameters: ${stmt(bStart + argsUse.index)}`;
5311
+ for (let k = 0; k < names.length; k++) {
5312
+ const id = names[k].replace(/^\.\.\./, "");
5313
+ const decl = params[k].replace(/^\.\.\.\s*/, "");
5314
+ const typed = /^[A-Za-z_$][\w$]*\s*\??\s*:\s*([^=]*?)\s*(?:=(?![=>]).*)?$/s.exec(decl);
5315
+ const primitive = typed !== void 0 && typed !== null && PRIMITIVE_TYPE.test(typed[1]);
5316
+ const re = new RegExp(String.raw`(?<![\w$.])${esc(id)}(?![\w$])`, "g");
5317
+ for (const o of m.slice(bStart, bEnd).matchAll(re)) {
5318
+ const i = bStart + (o.index ?? 0);
5319
+ if (i >= fwdOpen && i <= fwdClose) continue;
5320
+ const e = i + id.length;
5321
+ const before = m.slice(bStart, i);
5322
+ const after = m.slice(e, bEnd);
5323
+ const touch = `the wrapper's parameter \`${id}\` is not proven untouched before it is forwarded: ${stmt(i)}`;
5324
+ if (/^\s*(?:=(?![=>])|[-+*/%&|^]=|\*\*=|<<=|>>>?=|&&=|\|\|=|\?\?=|\+\+|--)/.test(after) || /(?:\+\+|--)\s*$/.test(before) || /\b(?:const|let|var|function|class)\s*$/.test(before))
5325
+ return touch;
5326
+ for (const open of enclosingOpens(m, i, bStart)) {
5327
+ const pre = m.slice(bStart, open).trimEnd();
5328
+ if (open > bStart && /[\w$)\]]$/.test(pre) && m[open] !== "{") continue;
5329
+ const close = matchClose(m, open);
5330
+ if (close > 0 && /^\s*=(?![=>])/.test(m.slice(close + 1, bEnd))) return touch;
5331
+ }
5332
+ if (primitive) continue;
5333
+ const chain = /^(?:\s*!?\s*\??\.\s*[A-Za-z_$][\w$]*)+/.exec(after);
5334
+ if (!chain) return touch;
5335
+ const rest = after.slice(chain[0].length);
5336
+ if (/^\s*(?:\(|\?\.\(|\[|\?\.\[|=(?![=>])|[-+*/%&|^]=|\*\*=|<<=|>>>?=|&&=|\|\|=|\?\?=|\+\+|--)/.test(
5337
+ rest
5338
+ ))
5339
+ return touch;
5340
+ const ok = /(?:\.\.\.\s*\(*|\btypeof\s+\(*|!\s*\(*|[!=]==?\s*\(*|\b(?:if|while)\s*\(\s*)$/;
5341
+ if (!ok.test(before.trimEnd())) return touch;
5342
+ }
5343
+ }
5344
+ return void 0;
5345
+ }
5058
5346
  function toolRegistrations(tree) {
5059
5347
  const regs = [];
5060
5348
  const unread = [];
@@ -5110,6 +5398,7 @@ function toolRegistrations(tree) {
5110
5398
  ))
5111
5399
  servers.add(h[1]);
5112
5400
  for (const name of servers) {
5401
+ const hits = [];
5113
5402
  for (const h of s.shape.matchAll(
5114
5403
  new RegExp(
5115
5404
  String.raw`(?<![\w$])${esc(name)}\s*(?:\.\s*(tool|registerTool|registerToolTask)\b(?!\s*(?:<[^<>()]*>)?\s*\()|\[)`,
@@ -5123,13 +5412,27 @@ function toolRegistrations(tree) {
5123
5412
  const called = close >= 0 && /^\s*\(/.test(s.shape.slice(close + 1, close + 4));
5124
5413
  if (!called && !/tool/i.test(key)) continue;
5125
5414
  }
5126
- const anchor = anchorAt(s, at);
5415
+ hits.push({ at, len: h[0].length, method: h[1], computed: h[0].endsWith("[") });
5416
+ }
5417
+ const live = hits.filter((h) => h.computed || !/\btypeof\s*$/.test(s.shape.slice(0, h.at)));
5418
+ const transparent = /* @__PURE__ */ new Set();
5419
+ const why = /* @__PURE__ */ new Map();
5420
+ for (const method of new Set(live.map((h) => h.method).filter((m) => !!m))) {
5421
+ const mine = live.filter((h) => h.method === method);
5422
+ const proof = regs.length === 0 ? "no tool is registered by a direct call anywhere in the tree" : wrapperProof(s, name, mine);
5423
+ if (proof === void 0) transparent.add(method);
5424
+ else why.set(method, proof);
5425
+ }
5426
+ for (const h of live) {
5427
+ if (h.method !== void 0 && transparent.has(h.method)) continue;
5428
+ const anchor = anchorAt(s, h.at);
5429
+ const reason = h.method === void 0 ? "" : why.get(h.method);
5127
5430
  unread.push({
5128
5431
  anchor,
5129
- reason: `${anchor} \`${s.code.slice(at, at + h[0].length + 12).replace(/\s+/g, "").slice(
5432
+ reason: `${anchor} \`${s.code.slice(h.at, h.at + h.len + 12).replace(/\s+/g, "").slice(
5130
5433
  0,
5131
5434
  40
5132
- )}\` reaches a tool-registration method of \`${name}\` by a route the scan does not read (not a direct call): the tools it registers are unread`
5435
+ )}\` reaches a tool-registration method of \`${name}\` by a route the scan does not read (not a direct call): the tools it registers are unread${reason ? ` (a rebind of it is transparent only when it forwards every argument to the original and registrations are made by direct calls; here: ${reason})` : ""}`
5133
5436
  });
5134
5437
  }
5135
5438
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantageos/mcp-doctor",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Static MCP conformance checker: audits an MCP server source tree against the MCP 2026-07-28 standard and emits a conformance-diff table (file:line | present | absent | non-conforming | verdict).",
5
5
  "type": "module",
6
6
  "main": "./dist/doctor.js",