deadbyte-mcp 0.15.16 → 0.15.18

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.
Files changed (110) hide show
  1. package/MANIFEST.SHA256 +99 -96
  2. package/PROVENANCE.json +1 -1
  3. package/README.txt +6 -6
  4. package/RELEASE.json +1 -1
  5. package/SBOM.cdx.json +7 -33
  6. package/TEST-MATRIX.json +10 -25
  7. package/node_modules/@modelcontextprotocol/client/dist/{index-CHhhk6PQ.d.cts → index-BCtJi0p5.d.mts} +38 -6
  8. package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +1 -0
  9. package/node_modules/@modelcontextprotocol/client/dist/{index-D4xIIEF6.d.mts → index-CEk3qkZM.d.cts} +41 -3
  10. package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +1 -0
  11. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +375 -60
  12. package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -1
  13. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +227 -11
  14. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
  15. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +227 -11
  16. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
  17. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +369 -61
  18. package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -1
  19. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
  20. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
  21. package/node_modules/@modelcontextprotocol/client/dist/{src-NAgB4Mp8.cjs → src-D0qEN74R.cjs} +111 -38
  22. package/node_modules/@modelcontextprotocol/client/dist/src-D0qEN74R.cjs.map +1 -0
  23. package/node_modules/@modelcontextprotocol/client/dist/{src-D_zzAWoS.mjs → src-DDAAhLnO.mjs} +106 -33
  24. package/node_modules/@modelcontextprotocol/client/dist/src-DDAAhLnO.mjs.map +1 -0
  25. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +8 -2
  26. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs.map +1 -1
  27. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +1 -1
  28. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -1
  29. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +1 -1
  30. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -1
  31. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +8 -2
  32. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs.map +1 -1
  33. package/node_modules/@modelcontextprotocol/client/package.json +4 -4
  34. package/node_modules/@modelcontextprotocol/core/dist/{auth-BWdKR39I.d.mts → auth--n_Yzytt.d.cts} +6 -1
  35. package/node_modules/@modelcontextprotocol/core/dist/{auth-BWdKR39I.d.mts.map → auth--n_Yzytt.d.cts.map} +1 -1
  36. package/node_modules/@modelcontextprotocol/core/dist/{auth-CfDMXiII.cjs → auth-4-zilcqg.cjs} +3 -2
  37. package/node_modules/@modelcontextprotocol/core/dist/{auth-CfDMXiII.cjs.map → auth-4-zilcqg.cjs.map} +1 -1
  38. package/node_modules/@modelcontextprotocol/core/dist/{auth-CUe6YdwF.mjs → auth-CGP0BDVq.mjs} +3 -2
  39. package/node_modules/@modelcontextprotocol/core/dist/{auth-CUe6YdwF.mjs.map → auth-CGP0BDVq.mjs.map} +1 -1
  40. package/node_modules/@modelcontextprotocol/core/dist/{auth-hYtaIUZm.d.cts → auth-YUQV3RRv.d.mts} +6 -1
  41. package/node_modules/@modelcontextprotocol/core/dist/{auth-hYtaIUZm.d.cts.map → auth-YUQV3RRv.d.mts.map} +1 -1
  42. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
  43. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +1 -1
  44. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +1 -1
  45. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
  46. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
  47. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +1 -1
  48. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +1 -1
  49. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
  50. package/node_modules/@modelcontextprotocol/core/package.json +1 -1
  51. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-dBHMsxwf.d.cts → createMcpHandler-BLVe3qmU.d.cts} +110 -7
  52. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-BLVe3qmU.d.cts.map +1 -0
  53. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-CLhGwQTn.d.mts → createMcpHandler-Bt6U_Fqb.d.mts} +110 -7
  54. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-Bt6U_Fqb.d.mts.map +1 -0
  55. package/node_modules/@modelcontextprotocol/server/dist/index.cjs +144 -248
  56. package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
  57. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +38 -3
  58. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
  59. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +38 -3
  60. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
  61. package/node_modules/@modelcontextprotocol/server/dist/index.mjs +136 -243
  62. package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
  63. package/node_modules/@modelcontextprotocol/server/dist/{mcp-D7GmuPnv.cjs → mcp-DUcCQSTW.cjs} +426 -21
  64. package/node_modules/@modelcontextprotocol/server/dist/mcp-DUcCQSTW.cjs.map +1 -0
  65. package/node_modules/@modelcontextprotocol/server/dist/{mcp-DXXb3Vv3.mjs → mcp-Dw2OlZ1f.mjs} +367 -22
  66. package/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs.map +1 -0
  67. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
  68. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
  69. package/node_modules/@modelcontextprotocol/server/dist/{src-STyD_Vvf.cjs → src-CgFsfg3E.cjs} +114 -36
  70. package/node_modules/@modelcontextprotocol/server/dist/src-CgFsfg3E.cjs.map +1 -0
  71. package/node_modules/@modelcontextprotocol/server/dist/{src-CX2iR2pK.mjs → src-D-y6h4N7.mjs} +114 -36
  72. package/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs.map +1 -0
  73. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +30 -3
  74. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs.map +1 -1
  75. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +9 -1
  76. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts.map +1 -1
  77. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +9 -1
  78. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts.map +1 -1
  79. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +30 -3
  80. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs.map +1 -1
  81. package/node_modules/@modelcontextprotocol/server/package.json +3 -3
  82. package/package.json +91 -93
  83. package/scripts/commander-hardening-gate-r47.mjs +1 -0
  84. package/scripts/full-regression-r47.mjs +1 -1
  85. package/scripts/init-host-policy.ps1 +2 -1
  86. package/src/coding-plane.mjs +24 -0
  87. package/src/commander-core-bridge.mjs +26 -30
  88. package/src/commander-extended-bridge-r47.mjs +17 -0
  89. package/src/commander-extended-runtime.mjs +2 -1
  90. package/src/commander-wire-adapter-r47.mjs +341 -0
  91. package/src/machine-fs.mjs +6 -6
  92. package/src/mcp-server.mjs +13 -87
  93. package/src/tunnel-stdio-compat.mjs +3 -3
  94. package/src/version.mjs +1 -1
  95. package/test/commander-core-bridge-r47.test.mjs +1 -1
  96. package/test/commander-protocol-r47.test.mjs +17 -2
  97. package/test/commander-wire-contract-r47.test.mjs +143 -0
  98. package/test/machine-fs-runtime.test.mjs +19 -1
  99. package/test/r47-release-contract.test.mjs +3 -3
  100. package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts.map +0 -1
  101. package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts.map +0 -1
  102. package/node_modules/@modelcontextprotocol/client/dist/src-D_zzAWoS.mjs.map +0 -1
  103. package/node_modules/@modelcontextprotocol/client/dist/src-NAgB4Mp8.cjs.map +0 -1
  104. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-CLhGwQTn.d.mts.map +0 -1
  105. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-dBHMsxwf.d.cts.map +0 -1
  106. package/node_modules/@modelcontextprotocol/server/dist/mcp-D7GmuPnv.cjs.map +0 -1
  107. package/node_modules/@modelcontextprotocol/server/dist/mcp-DXXb3Vv3.mjs.map +0 -1
  108. package/node_modules/@modelcontextprotocol/server/dist/src-CX2iR2pK.mjs.map +0 -1
  109. package/node_modules/@modelcontextprotocol/server/dist/src-STyD_Vvf.cjs.map +0 -1
  110. package/node_modules/which/CHANGELOG.md +0 -166
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-STyD_Vvf.cjs');
1
+ const require_src = require('./src-CgFsfg3E.cjs');
2
2
  const require_cfWorkerProvider = require('./cfWorkerProvider-BwbPzsdI.cjs');
3
3
 
4
4
  //#region src/shimsWorkerd.ts
@@ -1,4 +1,4 @@
1
- import { n as preloadSchemas } from "./src-CX2iR2pK.mjs";
1
+ import { n as preloadSchemas } from "./src-D-y6h4N7.mjs";
2
2
  import { t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-p3WaZPqB.mjs";
3
3
 
4
4
  //#region src/shimsWorkerd.ts
@@ -177,6 +177,16 @@ let OAuthErrorCode = /* @__PURE__ */ function(OAuthErrorCode$1) {
177
177
  * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)
178
178
  */
179
179
  OAuthErrorCode$1["InvalidTarget"] = "invalid_target";
180
+ /**
181
+ * The DPoP proof accompanying the request is invalid, or does not match the key the grant
182
+ * (e.g. a refresh token) is bound to. (RFC 9449 §5 / §7.1)
183
+ */
184
+ OAuthErrorCode$1["InvalidDpopProof"] = "invalid_dpop_proof";
185
+ /**
186
+ * The server requires a server-supplied nonce in the DPoP proof; retry with the `DPoP-Nonce`
187
+ * it returned. (RFC 9449 §8 / §9)
188
+ */
189
+ OAuthErrorCode$1["UseDpopNonce"] = "use_dpop_nonce";
180
190
  return OAuthErrorCode$1;
181
191
  }({});
182
192
  /**
@@ -360,8 +370,18 @@ var SdkError = class extends Error {
360
370
  if (typeof this !== "function") throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");
361
371
  return brandedHasInstance(this, value);
362
372
  }
363
- constructor(code, message, data) {
364
- super(message);
373
+ /**
374
+ * @param code - Stable string code identifying the failure ({@linkcode SdkErrorCode}).
375
+ * @param message - Human-readable description.
376
+ * @param data - Optional structured payload (for example the HTTP status carried by
377
+ * {@linkcode SdkHttpError}). Opaque to the SDK: a `cause` key inside `data` is not
378
+ * promoted to `Error.cause`.
379
+ * @param options - Standard `ErrorOptions`, forwarded to `Error`. Pass the underlying
380
+ * failure as `{ cause }` so it is reachable through the `Error.cause` chain that
381
+ * loggers and error trackers walk.
382
+ */
383
+ constructor(code, message, data, options) {
384
+ super(message, options);
365
385
  this.code = code;
366
386
  this.data = data;
367
387
  this.name = "SdkError";
@@ -388,8 +408,11 @@ var SdkHttpError = class extends SdkError {
388
408
  static {
389
409
  Object.defineProperty(this, "mcpBrand", { value: "mcp.SdkHttpError" });
390
410
  }
391
- constructor(code, message, data) {
392
- super(code, message, data);
411
+ /**
412
+ * @param options - Standard `ErrorOptions`, forwarded to `Error` (see {@linkcode SdkError}).
413
+ */
414
+ constructor(code, message, data, options) {
415
+ super(code, message, data, options);
393
416
  this.name = "SdkHttpError";
394
417
  }
395
418
  get status() {
@@ -4771,9 +4794,15 @@ function paramHeaderMismatchRejection(cell, header, body) {
4771
4794
  * named revision belongs to (a malformed envelope behind a present claim is
4772
4795
  * a validation error, never a silent fall back to legacy handling).
4773
4796
  * - A request without a claim is legacy-era traffic.
4774
- * - The `MCP-Protocol-Version` header is a cross-check only: it never
4775
- * upgrades or downgrades a body-derived classification, and a disagreement
4776
- * between header and body is an explicit ladder outcome.
4797
+ * - The `MCP-Protocol-Version` header is a cross-check only *for
4798
+ * classification*: it never upgrades or downgrades a body-derived
4799
+ * classification, and a disagreement between header and body is an explicit
4800
+ * ladder outcome. Its absence likewise never changes the era — but the spec
4801
+ * requires the header on every modern *request* POST, so a
4802
+ * modern-classified request that omits it is refused one rung later, by
4803
+ * {@linkcode validateStandardRequestHeaders}, not here. Notification POSTs
4804
+ * are exempt (see the next bullet), and that rung enforces presence on
4805
+ * requests only.
4777
4806
  * - Notifications carry no envelope claim of their own under the current
4778
4807
  * spec, so for notification POSTs without a body claim the modern header is
4779
4808
  * determinative; the `Mcp-Method` header is validated against the body when
@@ -4901,7 +4930,7 @@ const INBOUND_VALIDATION_LADDER = [
4901
4930
  evaluatedAt: "pre-dispatch",
4902
4931
  codes: [HEADER_MISMATCH_ERROR_CODE],
4903
4932
  conformance: ["http-header-validation"],
4904
- rationale: "SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."
4933
+ rationale: "SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."
4905
4934
  },
4906
4935
  {
4907
4936
  rung: "client-capabilities",
@@ -4984,15 +5013,51 @@ function crossCheckMismatch(cell, header, body, rung = "era-classification") {
4984
5013
  } }), true);
4985
5014
  }
4986
5015
  /**
4987
- * The methods whose body carries a `params.name` / `params.uri` value the
4988
- * `Mcp-Name` header must mirror, and which body field supplies it (SEP-2243
4989
- * § Standard Request Headers, `Required For` column).
5016
+ * The methods whose body carries a `params.name` / `params.uri` /
5017
+ * `params.taskId` value the `Mcp-Name` header must mirror, and which body
5018
+ * field supplies it. The core rows come from SEP-2243 § Standard Request
5019
+ * Headers (`Required For` column); the `tasks/*` rows come from SEP-2663's
5020
+ * Streamable HTTP binding ("the client MUST set the `Mcp-Name` header to the
5021
+ * value of `params.taskId`" for `tasks/get` / `tasks/update` /
5022
+ * `tasks/cancel`, so intermediaries can route every request for a task to the
5023
+ * instance holding its state). Shared by the client transport (header
5024
+ * emission) and the server ladder (validation) so both sides derive from one
5025
+ * table.
4990
5026
  */
4991
5027
  const MCP_NAME_HEADER_SOURCE = {
4992
5028
  "tools/call": "name",
4993
5029
  "prompts/get": "name",
4994
- "resources/read": "uri"
5030
+ "resources/read": "uri",
5031
+ "tasks/get": "taskId",
5032
+ "tasks/update": "taskId",
5033
+ "tasks/cancel": "taskId"
4995
5034
  };
5035
+ /**
5036
+ * Resolve the `Mcp-Name` source for one request against
5037
+ * {@linkcode MCP_NAME_HEADER_SOURCE}: which body field the header mirrors for
5038
+ * `method`, and the string value that field carries in `params`.
5039
+ *
5040
+ * Returns `undefined` when `method` is off-table (no `Mcp-Name` is emitted or
5041
+ * required). Otherwise `value` is the field's string value, or `undefined`
5042
+ * when `params` is not a plain object or the field is absent / not a string —
5043
+ * the client emits no header then, and the server leaves that body to the
5044
+ * rungs further down the ladder.
5045
+ *
5046
+ * `method` is peer-supplied on the server and caller-supplied on the client,
5047
+ * so the table lookup is `Object.hasOwn`-guarded against `Object.prototype`
5048
+ * collisions (`constructor`, `toString`, …). Shared by the client transport
5049
+ * (emission) and {@linkcode validateStandardRequestHeaders} (validation) so
5050
+ * the extraction — not just the table — cannot drift between the two sides.
5051
+ */
5052
+ function mcpNameSource(method, params) {
5053
+ const field = Object.hasOwn(MCP_NAME_HEADER_SOURCE, method) ? MCP_NAME_HEADER_SOURCE[method] : void 0;
5054
+ if (field === void 0) return;
5055
+ const raw = isPlainObject$2(params) ? params[field] : void 0;
5056
+ return {
5057
+ field,
5058
+ value: typeof raw === "string" ? raw : void 0
5059
+ };
5060
+ }
4996
5061
  /** Strip RFC 9110 optional whitespace (SP / HTAB) around a field value in linear time. */
4997
5062
  function stripHttpOws(value) {
4998
5063
  let start = 0;
@@ -5020,13 +5085,19 @@ function stripHttpOws(value) {
5020
5085
  * `era-classification` rung for the `MCP-Protocol-Version` and
5021
5086
  * `Mcp-Method` *mismatch* cells) when:
5022
5087
  *
5088
+ * - the required `MCP-Protocol-Version` header is absent (SEP-2243 requires it
5089
+ * on every modern *request* POST, and lists it first among the required
5090
+ * standard headers — so a request missing it *and* `Mcp-Method` is answered
5091
+ * by this cell);
5023
5092
  * - the required `Mcp-Method` header is absent;
5024
5093
  * - the required `Mcp-Name` header is absent on a `tools/call`,
5025
- * `prompts/get`, or `resources/read` request whose body carries the
5026
- * `params.name` / `params.uri` value the header mirrors;
5094
+ * `prompts/get`, `resources/read`, or (per SEP-2663's Streamable HTTP
5095
+ * binding) `tasks/get` / `tasks/update` / `tasks/cancel` request whose
5096
+ * body carries the `params.name` / `params.uri` / `params.taskId` value
5097
+ * the header mirrors;
5027
5098
  * - the `Mcp-Name` header carries an invalid `=?base64?…?=` sentinel; or
5028
5099
  * - the (decoded) `Mcp-Name` value disagrees with the body's
5029
- * `params.name` / `params.uri`.
5100
+ * `params.name` / `params.uri` / `params.taskId`.
5030
5101
  *
5031
5102
  * Returns `undefined` (pass) for notifications (the spec table reads
5032
5103
  * "All requests"), for methods that have no `Mcp-Name` source, and when the
@@ -5037,16 +5108,22 @@ function stripHttpOws(value) {
5037
5108
  * call to the classifier (no headers passed) keeps routing a modern request
5038
5109
  * unchanged: the classifier remains a pure body-primary router, and this
5039
5110
  * function is the presence/`Mcp-Name` half of the standard-header rung the
5040
- * entry layers on top.
5111
+ * entry layers on top. That separation is what lets the missing
5112
+ * `MCP-Protocol-Version` cell live here without disturbing the body-primary
5113
+ * rule — classification still resolves from the body (a proxy stripping the
5114
+ * header must not change the era), and only this rung refuses to serve it.
5041
5115
  */
5042
5116
  function validateStandardRequestHeaders(request, route) {
5043
5117
  if (route.messageKind !== "request") return;
5044
5118
  const method = route.message.method;
5119
+ if (request.protocolVersionHeader === void 0) {
5120
+ const claimed = route.classification.revision;
5121
+ return crossCheckMismatch("version-header-missing", "(missing)", claimed === void 0 ? "the body carries a modern per-request envelope but the required MCP-Protocol-Version header is absent" : `the body envelope names protocol version ${claimed} but the required MCP-Protocol-Version header is absent`, "standard-header-validation");
5122
+ }
5045
5123
  if (request.mcpMethodHeader === void 0) return crossCheckMismatch("method-header-missing", "(missing)", `the body names method ${method} but the required Mcp-Method header is absent`, "standard-header-validation");
5046
- const sourceField = Object.hasOwn(MCP_NAME_HEADER_SOURCE, method) ? MCP_NAME_HEADER_SOURCE[method] : void 0;
5047
- if (sourceField === void 0) return;
5048
- const sourceValue = route.message.params?.[sourceField];
5049
- const bodyValue = typeof sourceValue === "string" ? sourceValue : void 0;
5124
+ const source = mcpNameSource(method, route.message.params);
5125
+ if (source === void 0) return;
5126
+ const { field: sourceField, value: bodyValue } = source;
5050
5127
  if (request.mcpNameHeader === void 0) {
5051
5128
  if (bodyValue === void 0) return;
5052
5129
  return crossCheckMismatch("name-header-missing", "(missing)", `the body carries params.${sourceField}="${bodyValue}" but the required Mcp-Name header is absent`, "standard-header-validation");
@@ -6248,7 +6325,7 @@ var Protocol = class {
6248
6325
  return this._requestHandlers.get(method);
6249
6326
  }
6250
6327
  async _oncancel(notification) {
6251
- if (!notification.params.requestId) return;
6328
+ if (notification.params.requestId === void 0) return;
6252
6329
  this._requestHandlerAbortControllers.get(notification.params.requestId)?.abort(notification.params.reason);
6253
6330
  }
6254
6331
  _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) {
@@ -6647,19 +6724,20 @@ var Protocol = class {
6647
6724
  const cancel = (reason) => {
6648
6725
  if (responseReceived) return;
6649
6726
  this._progressHandlers.delete(messageId);
6650
- if (requestAbort === void 0) this._transport?.send(this._envelopeOutbound({
6651
- jsonrpc: "2.0",
6652
- method: "notifications/cancelled",
6653
- params: {
6654
- requestId: messageId,
6655
- reason: String(reason)
6656
- }
6657
- }), {
6658
- relatedRequestId,
6659
- resumptionToken,
6660
- onresumptiontoken
6661
- }).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error}`)));
6662
- else requestAbort.abort();
6727
+ if (requestAbort === void 0) {
6728
+ if (request.method !== "initialize") this._transport?.send(this._envelopeOutbound({
6729
+ jsonrpc: "2.0",
6730
+ method: "notifications/cancelled",
6731
+ params: {
6732
+ requestId: messageId,
6733
+ reason: String(reason)
6734
+ }
6735
+ }), {
6736
+ relatedRequestId,
6737
+ resumptionToken,
6738
+ onresumptiontoken
6739
+ }).catch((error) => this._onerror(/* @__PURE__ */ new Error(`Failed to send cancellation: ${error}`)));
6740
+ } else requestAbort.abort();
6663
6741
  reject(reason instanceof SdkError ? reason : new SdkError(SdkErrorCode.RequestTimeout, String(reason)));
6664
6742
  };
6665
6743
  this._responseHandlers.set(messageId, (response) => {
@@ -6739,7 +6817,7 @@ var Protocol = class {
6739
6817
  jsonrpc: "2.0",
6740
6818
  ...notification
6741
6819
  });
6742
- if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && !options?.relatedRequestId) {
6820
+ if ((this._options?.debouncedNotificationMethods ?? []).includes(notification.method) && !notification.params && options?.relatedRequestId === void 0) {
6743
6821
  if (this._pendingDebouncedNotifications.has(notification.method)) return;
6744
6822
  this._pendingDebouncedNotifications.add(notification.method);
6745
6823
  Promise.resolve().then(() => {
@@ -8101,4 +8179,4 @@ Object.defineProperty(exports, 'withRequestStateValue', {
8101
8179
  return withRequestStateValue;
8102
8180
  }
8103
8181
  });
8104
- //# sourceMappingURL=src-STyD_Vvf.cjs.map
8182
+ //# sourceMappingURL=src-CgFsfg3E.cjs.map