deadbyte-mcp 0.15.49 → 0.15.50

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 (93) hide show
  1. package/MANIFEST.SHA256 +82 -78
  2. package/PROVENANCE.json +3 -3
  3. package/README.txt +18 -18
  4. package/RELEASE.json +5 -5
  5. package/SBOM.cdx.json +2 -2
  6. package/TEST-MATRIX.json +2 -2
  7. package/docs/R130-SDK-SECURITY-PATCH.md +34 -0
  8. package/node_modules/@modelcontextprotocol/client/README.md +1 -7
  9. package/node_modules/@modelcontextprotocol/client/dist/{index-BCtJi0p5.d.mts → index-B-4n9P0J.d.mts} +5 -1
  10. package/node_modules/@modelcontextprotocol/client/dist/index-B-4n9P0J.d.mts.map +1 -0
  11. package/node_modules/@modelcontextprotocol/client/dist/{index-CEk3qkZM.d.cts → index-J2FaQ-KY.d.cts} +5 -1
  12. package/node_modules/@modelcontextprotocol/client/dist/index-J2FaQ-KY.d.cts.map +1 -0
  13. package/node_modules/@modelcontextprotocol/client/dist/index.cjs +175 -76
  14. package/node_modules/@modelcontextprotocol/client/dist/index.cjs.map +1 -1
  15. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts +214 -35
  16. package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
  17. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts +214 -35
  18. package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
  19. package/node_modules/@modelcontextprotocol/client/dist/index.mjs +175 -76
  20. package/node_modules/@modelcontextprotocol/client/dist/index.mjs.map +1 -1
  21. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
  22. package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
  23. package/node_modules/@modelcontextprotocol/client/dist/{src-D0qEN74R.cjs → src-DpAS0jfg.cjs} +125 -11
  24. package/node_modules/@modelcontextprotocol/client/dist/src-DpAS0jfg.cjs.map +1 -0
  25. package/node_modules/@modelcontextprotocol/client/dist/{src-DDAAhLnO.mjs → src-WCy6ifGf.mjs} +102 -12
  26. package/node_modules/@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs.map +1 -0
  27. package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +1 -1
  28. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts +1 -1
  29. package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts +1 -1
  30. package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +1 -1
  31. package/node_modules/@modelcontextprotocol/client/package.json +5 -5
  32. package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts → auth-Anm-lwWi.d.mts} +9 -8
  33. package/node_modules/@modelcontextprotocol/core/dist/{auth--n_Yzytt.d.cts.map → auth-Anm-lwWi.d.mts.map} +1 -1
  34. package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs → auth-BNDyLTqp.mjs} +5 -3
  35. package/node_modules/@modelcontextprotocol/core/dist/{auth-CGP0BDVq.mjs.map → auth-BNDyLTqp.mjs.map} +1 -1
  36. package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs → auth-D1CeV_Jr.cjs} +5 -3
  37. package/node_modules/@modelcontextprotocol/core/dist/{auth-4-zilcqg.cjs.map → auth-D1CeV_Jr.cjs.map} +1 -1
  38. package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts → auth-V9XJSCfa.d.cts} +9 -8
  39. package/node_modules/@modelcontextprotocol/core/dist/{auth-YUQV3RRv.d.mts.map → auth-V9XJSCfa.d.cts.map} +1 -1
  40. package/node_modules/@modelcontextprotocol/core/dist/index.cjs +1 -1
  41. package/node_modules/@modelcontextprotocol/core/dist/index.d.cts +1 -1
  42. package/node_modules/@modelcontextprotocol/core/dist/index.d.mts +1 -1
  43. package/node_modules/@modelcontextprotocol/core/dist/index.mjs +1 -1
  44. package/node_modules/@modelcontextprotocol/core/dist/internal.cjs +1 -1
  45. package/node_modules/@modelcontextprotocol/core/dist/internal.d.cts +1 -1
  46. package/node_modules/@modelcontextprotocol/core/dist/internal.d.mts +1 -1
  47. package/node_modules/@modelcontextprotocol/core/dist/internal.mjs +1 -1
  48. package/node_modules/@modelcontextprotocol/core/package.json +2 -2
  49. package/node_modules/@modelcontextprotocol/server/README.md +1 -7
  50. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-Bt6U_Fqb.d.mts → createMcpHandler-D4NN8WsG.d.mts} +35 -13
  51. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-D4NN8WsG.d.mts.map +1 -0
  52. package/node_modules/@modelcontextprotocol/server/dist/{createMcpHandler-BLVe3qmU.d.cts → createMcpHandler-DZmmlN8e.d.cts} +35 -13
  53. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-DZmmlN8e.d.cts.map +1 -0
  54. package/node_modules/@modelcontextprotocol/server/dist/index.cjs +32 -5
  55. package/node_modules/@modelcontextprotocol/server/dist/index.cjs.map +1 -1
  56. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts +41 -5
  57. package/node_modules/@modelcontextprotocol/server/dist/index.d.cts.map +1 -1
  58. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts +41 -5
  59. package/node_modules/@modelcontextprotocol/server/dist/index.d.mts.map +1 -1
  60. package/node_modules/@modelcontextprotocol/server/dist/index.mjs +32 -5
  61. package/node_modules/@modelcontextprotocol/server/dist/index.mjs.map +1 -1
  62. package/node_modules/@modelcontextprotocol/server/dist/{mcp-DUcCQSTW.cjs → mcp-BumlNux0.cjs} +73 -23
  63. package/node_modules/@modelcontextprotocol/server/dist/mcp-BumlNux0.cjs.map +1 -0
  64. package/node_modules/@modelcontextprotocol/server/dist/{mcp-Dw2OlZ1f.mjs → mcp-DIH4cS6P.mjs} +73 -23
  65. package/node_modules/@modelcontextprotocol/server/dist/mcp-DIH4cS6P.mjs.map +1 -0
  66. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.cjs +1 -1
  67. package/node_modules/@modelcontextprotocol/server/dist/shimsWorkerd.mjs +1 -1
  68. package/node_modules/@modelcontextprotocol/server/dist/{src-CgFsfg3E.cjs → src-BhnGYybN.cjs} +29 -11
  69. package/node_modules/@modelcontextprotocol/server/dist/src-BhnGYybN.cjs.map +1 -0
  70. package/node_modules/@modelcontextprotocol/server/dist/{src-D-y6h4N7.mjs → src-Cqbh3MYc.mjs} +29 -11
  71. package/node_modules/@modelcontextprotocol/server/dist/src-Cqbh3MYc.mjs.map +1 -0
  72. package/node_modules/@modelcontextprotocol/server/dist/stdio.cjs +2 -2
  73. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.cts +1 -1
  74. package/node_modules/@modelcontextprotocol/server/dist/stdio.d.mts +1 -1
  75. package/node_modules/@modelcontextprotocol/server/dist/stdio.mjs +2 -2
  76. package/node_modules/@modelcontextprotocol/server/package.json +4 -4
  77. package/node_modules/which/CHANGELOG.md +166 -0
  78. package/package.json +3 -3
  79. package/src/version.mjs +1 -1
  80. package/test/r129-sdk-security-baseline.test.mjs +38 -0
  81. package/test/r130-release-security-contract.test.mjs +28 -0
  82. package/test/r59-tool-surface-compat.test.mjs +1 -1
  83. package/test/r74-prepublish-contract.test.mjs +2 -2
  84. package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +0 -1
  85. package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +0 -1
  86. package/node_modules/@modelcontextprotocol/client/dist/src-D0qEN74R.cjs.map +0 -1
  87. package/node_modules/@modelcontextprotocol/client/dist/src-DDAAhLnO.mjs.map +0 -1
  88. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-BLVe3qmU.d.cts.map +0 -1
  89. package/node_modules/@modelcontextprotocol/server/dist/createMcpHandler-Bt6U_Fqb.d.mts.map +0 -1
  90. package/node_modules/@modelcontextprotocol/server/dist/mcp-DUcCQSTW.cjs.map +0 -1
  91. package/node_modules/@modelcontextprotocol/server/dist/mcp-Dw2OlZ1f.mjs.map +0 -1
  92. package/node_modules/@modelcontextprotocol/server/dist/src-CgFsfg3E.cjs.map +0 -1
  93. package/node_modules/@modelcontextprotocol/server/dist/src-D-y6h4N7.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { A as promptArgumentsFromStandardSchema, At as LATEST_PROTOCOL_VERSION, B as scanXMcpHeaderDeclarations, C as REQUEST_STATE_ONLY_LEG_PACING_MS, Ct as CLIENT_CAPABILITIES_META_KEY, E as sleep, H as assertCompleteRequestPrompt, Ht as requiredClientCapabilitiesForInputRequest, It as SERVER_INFO_META_KEY, Kt as SdkError, Lt as SUBSCRIPTION_ID_META_KEY, M as validateStandardSchema, N as parseSchema, T as linkedRoundAbort, U as assertCompleteRequestResourceTemplate, Vt as missingClientCapabilities, Xt as OAuthErrorCode, Yt as OAuthError, _ as mergeCapabilities, _t as normalizeContentlessToolResult, a as UriTemplate, b as withRequestStateValue, bt as legacyProtocolVersions, ct as codecForVersion, dt as ResourceNotFoundError, g as Protocol, gt as attachCacheHintFallback, ht as assertValidCacheHint, j as standardSchemaToJsonSchema, jt as LOG_LEVEL_META_KEY, lt as MissingRequiredClientCapabilityError, mt as ProtocolErrorCode, nt as LoggingLevelSchema, q as isInputRequiredResult, qt as SdkErrorCode, r as normalizeRawShapeSchema, s as validateAndWarnToolName, st as MODERN_WIRE_REVISION, ut as ProtocolError, v as requestStateAccessor, w as inputRequiredRoundsExceededMessage, xt as modernProtocolVersions, yt as isModernProtocolVersion } from "./src-D-y6h4N7.mjs";
1
+ import { A as promptArgumentsFromStandardSchema, At as LATEST_PROTOCOL_VERSION, B as scanXMcpHeaderDeclarations, C as REQUEST_STATE_ONLY_LEG_PACING_MS, Ct as CLIENT_CAPABILITIES_META_KEY, E as sleep, H as assertCompleteRequestPrompt, Ht as requiredClientCapabilitiesForInputRequest, It as SERVER_INFO_META_KEY, Kt as SdkError, Lt as SUBSCRIPTION_ID_META_KEY, M as validateStandardSchema, N as parseSchema, T as linkedRoundAbort, U as assertCompleteRequestResourceTemplate, Vt as missingClientCapabilities, Xt as OAuthErrorCode, Yt as OAuthError, _ as mergeCapabilities, _t as normalizeContentlessToolResult, a as UriTemplate, b as withRequestStateValue, bt as legacyProtocolVersions, ct as codecForVersion, dt as ResourceNotFoundError, g as Protocol, gt as attachCacheHintFallback, ht as assertValidCacheHint, j as standardSchemaToJsonSchema, jt as LOG_LEVEL_META_KEY, lt as MissingRequiredClientCapabilityError, mt as ProtocolErrorCode, nt as LoggingLevelSchema, q as isInputRequiredResult, qt as SdkErrorCode, r as normalizeRawShapeSchema, s as validateAndWarnToolName, st as MODERN_WIRE_REVISION, ut as ProtocolError, v as requestStateAccessor, w as inputRequiredRoundsExceededMessage, xt as modernProtocolVersions, yt as isModernProtocolVersion } from "./src-Cqbh3MYc.mjs";
2
2
  import { DefaultJsonSchemaValidator } from "@modelcontextprotocol/server/_shims";
3
3
 
4
4
  //#region src/server/completable.ts
@@ -285,6 +285,10 @@ function createListenRouter(options) {
285
285
  params: { notifications: honored }
286
286
  }, subscriptionId);
287
287
  writeNotification(ack.method, ack.params);
288
+ if (Object.keys(honored).length === 0) {
289
+ teardown(true);
290
+ return;
291
+ }
288
292
  unsubscribe = bus.subscribe((event) => {
289
293
  if (closed || !listenFilterAccepts(honored, event)) return;
290
294
  const note = stampSubscriptionId(serverEventToNotification(event), subscriptionId);
@@ -349,7 +353,7 @@ var StdioListenRouter = class {
349
353
  _serverCapabilities;
350
354
  /**
351
355
  * The serving instance's identity, stamped onto the graceful-close
352
- * results' `_meta` (the spec's `SubscriptionsListenResultMeta` extends
356
+ * results' `_meta` (the spec's `SubscriptionsListenResultMetaObject` extends
353
357
  * `ResultMetaObject`). Handed over together with the capabilities.
354
358
  */
355
359
  _serverInfo;
@@ -476,6 +480,15 @@ function notificationToServerEvent(method, uri) {
476
480
 
477
481
  //#endregion
478
482
  //#region src/server/middleware/bearerAuth.ts
483
+ function comparableResource(value) {
484
+ const text = String(value);
485
+ const hash = text.indexOf("#");
486
+ return (hash === -1 ? text : text.slice(0, hash)).replace(/\/$/, "");
487
+ }
488
+ function sameResource(reported, expected) {
489
+ if (!reported) return false;
490
+ return comparableResource(reported) === comparableResource(expected);
491
+ }
479
492
  function headerQuotedValue(value) {
480
493
  return value.replaceAll(/[\\"]/g, String.raw`\$&`).replaceAll(/[^\u0020-\u007E]/g, " ");
481
494
  }
@@ -499,7 +512,8 @@ function buildWwwAuthenticateHeader(errorCode, description, requiredScopes, reso
499
512
  * the verified {@link AuthInfo}.
500
513
  *
501
514
  * The runtime-neutral core of Bearer authentication: it parses the header,
502
- * runs the verifier, enforces `requiredScopes`, and rejects tokens without an
515
+ * runs the verifier, compares the token's resource with `expectedResource`,
516
+ * enforces `requiredScopes`, and rejects tokens without an
503
517
  * expiration or past it. On any failure it throws an {@link OAuthError} —
504
518
  * pass that to {@link bearerAuthChallengeResponse} for the matching HTTP
505
519
  * answer, or use {@link requireBearerAuth} to get both steps as one call.
@@ -508,11 +522,12 @@ function buildWwwAuthenticateHeader(errorCode, description, requiredScopes, reso
508
522
  * `@modelcontextprotocol/express` feeds it `req.headers.authorization`.
509
523
  */
510
524
  async function verifyBearerToken(authorizationHeader, options) {
511
- const { verifier, requiredScopes = [] } = options;
525
+ const { verifier, requiredScopes = [], expectedResource } = options;
512
526
  if (!authorizationHeader) throw new OAuthError(OAuthErrorCode.InvalidToken, "Missing Authorization header");
513
527
  const [type, token] = authorizationHeader.split(" ");
514
528
  if (type?.toLowerCase() !== "bearer" || !token) throw new OAuthError(OAuthErrorCode.InvalidToken, "Invalid Authorization header format, expected 'Bearer TOKEN'");
515
529
  const authInfo = await verifier.verifyAccessToken(token);
530
+ if (expectedResource !== void 0 && !sameResource(authInfo.resource, expectedResource)) throw new OAuthError(OAuthErrorCode.InvalidToken, "Token was not issued for this resource");
516
531
  if (requiredScopes.length > 0) {
517
532
  if (!requiredScopes.every((scope) => authInfo.scopes.includes(scope))) throw new OAuthError(OAuthErrorCode.InsufficientScope, "Insufficient scope");
518
533
  }
@@ -580,11 +595,12 @@ function bearerAuthChallengeResponse(error, options) {
580
595
  * ```
581
596
  */
582
597
  function requireBearerAuth(options) {
583
- const { verifier, requiredScopes = [], resourceMetadataUrl } = options;
598
+ const { verifier, requiredScopes = [], resourceMetadataUrl, expectedResource } = options;
584
599
  const resolved = {
585
600
  verifier,
586
601
  requiredScopes,
587
- resourceMetadataUrl
602
+ resourceMetadataUrl,
603
+ expectedResource
588
604
  };
589
605
  return async (request) => {
590
606
  const [authorizationHeader] = (request.headers.get("authorization") ?? "").split(",");
@@ -966,7 +982,7 @@ function installModernOnlyHandlers(server, servedModernVersions) {
966
982
  * Package-internal: the instance's implementation identity, for the serving
967
983
  * entries to stamp onto entry-built results (the `subscriptions/listen`
968
984
  * graceful-close result — built outside the encode seam, but the spec's
969
- * `SubscriptionsListenResultMeta` extends `ResultMetaObject`, so it carries
985
+ * `SubscriptionsListenResultMetaObject` extends `ResultMetaObject`, so it carries
970
986
  * the serverInfo SHOULD like every other result). Not public API.
971
987
  */
972
988
  function serverIdentityOf(server) {
@@ -1037,6 +1053,11 @@ var Server = class extends Protocol {
1037
1053
  if (modernProtocolVersions(this._supportedProtocolVersions).length > 0) this.setRequestHandler("server/discover", () => this._ondiscover());
1038
1054
  if (this._capabilities.logging) this._registerLoggingHandler();
1039
1055
  }
1056
+ /** Attaches to the given transport; rejects while this instance is connected to another one. */
1057
+ async connect(transport) {
1058
+ if (this.transport !== void 0) throw new SdkError(SdkErrorCode.AlreadyConnected, "Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");
1059
+ await super.connect(transport);
1060
+ }
1040
1061
  /**
1041
1062
  * Registers the built-in `logging/setLevel` request handler.
1042
1063
  *
@@ -1598,6 +1619,30 @@ function discoverAdvertisedCapabilities(capabilities) {
1598
1619
 
1599
1620
  //#endregion
1600
1621
  //#region src/server/mcp.ts
1622
+ function toolInputElementCount(value, max) {
1623
+ let count = 0;
1624
+ const stack = [value];
1625
+ while (stack.length > 0) {
1626
+ const node = stack.pop();
1627
+ if (node === null || typeof node !== "object") continue;
1628
+ if (Array.isArray(node)) for (const child of node) {
1629
+ if (++count > max) return count;
1630
+ if (child !== null && typeof child === "object") stack.push(child);
1631
+ }
1632
+ else for (const key in node) {
1633
+ if (!Object.prototype.hasOwnProperty.call(node, key)) continue;
1634
+ if (++count > max) return count;
1635
+ const child = node[key];
1636
+ if (child !== null && typeof child === "object") stack.push(child);
1637
+ }
1638
+ }
1639
+ return count;
1640
+ }
1641
+ function resolveMaxToolInputElements(value) {
1642
+ if (value === void 0 || value === Infinity) return void 0;
1643
+ if (typeof value !== "number" || Number.isNaN(value) || value < 1) throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(value)}`);
1644
+ return value;
1645
+ }
1601
1646
  /**
1602
1647
  * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
1603
1648
  * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
@@ -1616,16 +1661,12 @@ var McpServer = class {
1616
1661
  * The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
1617
1662
  */
1618
1663
  server;
1664
+ _maxToolInputElements;
1619
1665
  _registeredResources = {};
1620
1666
  _registeredResourceTemplates = {};
1621
1667
  _registeredTools = {};
1622
1668
  _registeredPrompts = {};
1623
- /**
1624
- * Per-tool JSON-converted `inputSchema`, memoized so the SEP-2243
1625
- * registration-time scan and the pre-dispatch validation step share one
1626
- * conversion instead of paying it twice per request under the
1627
- * per-request-factory `createMcpHandler` model.
1628
- */
1669
+ /** Per-tool JSON-converted `inputSchema`, filled on first use by `toolInputSchemaJson()`. */
1629
1670
  _toolInputSchemaJson = {};
1630
1671
  /**
1631
1672
  * The JSON-serialized `inputSchema` of a registered tool, or `undefined`
@@ -1650,6 +1691,7 @@ var McpServer = class {
1650
1691
  }
1651
1692
  constructor(serverInfo, options) {
1652
1693
  this.server = new Server(serverInfo, options);
1694
+ this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
1653
1695
  if (options?.capabilities?.tools) this.setToolRequestHandlers();
1654
1696
  if (options?.capabilities?.resources) this.setResourceRequestHandlers();
1655
1697
  if (options?.capabilities?.prompts) this.setPromptRequestHandlers();
@@ -1721,7 +1763,7 @@ var McpServer = class {
1721
1763
  name,
1722
1764
  title: tool.title,
1723
1765
  description: tool.description,
1724
- inputSchema: tool.inputSchema ? standardSchemaToJsonSchema(tool.inputSchema, "input") : EMPTY_OBJECT_JSON_SCHEMA,
1766
+ inputSchema: tool.inputSchema ? convertListedInputSchema(name, tool.inputSchema) : EMPTY_OBJECT_JSON_SCHEMA,
1725
1767
  annotations: tool.annotations,
1726
1768
  icons: tool.icons,
1727
1769
  execution: tool.execution,
@@ -1766,6 +1808,7 @@ var McpServer = class {
1766
1808
  * Validates tool input arguments against the tool's input schema.
1767
1809
  */
1768
1810
  async validateToolInput(tool, args, toolName) {
1811
+ if (this._maxToolInputElements !== void 0 && toolInputElementCount(args, this._maxToolInputElements) > this._maxToolInputElements) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid arguments for tool ${toolName}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);
1769
1812
  if (!tool.inputSchema) return;
1770
1813
  const parseResult = await validateStandardSchema(tool.inputSchema, args ?? {});
1771
1814
  if (!parseResult.success) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${parseResult.error}`);
@@ -2039,19 +2082,19 @@ var McpServer = class {
2039
2082
  }
2040
2083
  _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, icons, execution, scopeChallenge, _meta, handler) {
2041
2084
  validateAndWarnToolName(name);
2042
- if (inputSchema !== void 0) try {
2043
- const json = standardSchemaToJsonSchema(inputSchema, "input");
2044
- this._toolInputSchemaJson[name] = json;
2045
- const scan = scanXMcpHeaderDeclarations(json);
2046
- if (!scan.valid) console.warn(`[mcp-sdk] tool '${name}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${scan.reason}`);
2047
- } catch {}
2048
2085
  let currentHandler = handler;
2086
+ let outputSchemaJson;
2049
2087
  const registeredTool = {
2050
2088
  title,
2051
2089
  description,
2052
2090
  inputSchema,
2053
2091
  outputSchema,
2054
- outputSchemaJson: convertOutputSchemaJson(outputSchema),
2092
+ get outputSchemaJson() {
2093
+ return outputSchemaJson ??= convertOutputSchemaJson(registeredTool.outputSchema);
2094
+ },
2095
+ set outputSchemaJson(value) {
2096
+ outputSchemaJson = value;
2097
+ },
2055
2098
  annotations,
2056
2099
  icons,
2057
2100
  execution,
@@ -2212,6 +2255,13 @@ const EMPTY_OBJECT_JSON_SCHEMA = {
2212
2255
  type: "object",
2213
2256
  properties: {}
2214
2257
  };
2258
+ /** Converts a tool's `inputSchema` for `tools/list` and warns on an invalid SEP-2243 `x-mcp-header` declaration. */
2259
+ function convertListedInputSchema(name, inputSchema) {
2260
+ const json = standardSchemaToJsonSchema(inputSchema, "input");
2261
+ const scan = scanXMcpHeaderDeclarations(json);
2262
+ if (!scan.valid) console.warn(`[mcp-sdk] tool '${name}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${scan.reason}`);
2263
+ return json;
2264
+ }
2215
2265
  /**
2216
2266
  * Convert a registered `outputSchema` to JSON Schema, memoised on {@link RegisteredTool.outputSchemaJson}
2217
2267
  * so `tools/call` passes the SAME advertised schema to the wire codec's `projectCallToolResult` that
@@ -2234,7 +2284,7 @@ function createPromptHandler(name, argsSchema, callback) {
2234
2284
  if (argsSchema) {
2235
2285
  const typedCallback = callback;
2236
2286
  return async (args, ctx) => {
2237
- const parseResult = await validateStandardSchema(argsSchema, args);
2287
+ const parseResult = await validateStandardSchema(argsSchema, args ?? {});
2238
2288
  if (!parseResult.success) throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Invalid arguments for prompt ${name}: ${parseResult.error}`);
2239
2289
  return typedCallback(parseResult.data, ctx);
2240
2290
  };
@@ -2273,4 +2323,4 @@ function unwrapOptionalSchema(schema) {
2273
2323
 
2274
2324
  //#endregion
2275
2325
  export { armSseKeepAlive as C, DEFAULT_SSE_KEEP_ALIVE_MS as S, isCompletable as T, DEFAULT_MAX_SUBSCRIPTIONS as _, seedClientIdentityFromEnvelope as a, InMemoryServerEventBus as b, findScopeChallenge as c, buildOAuthProtectedResourceMetadata as d, getOAuthProtectedResourceMetadataUrl as f, verifyBearerToken as g, requireBearerAuth as h, installModernOnlyHandlers as i, requireScopes as l, bearerAuthChallengeResponse as m, ResourceTemplate as n, serverIdentityOf as o, oauthMetadataResponse as p, Server as r, createScopeChallengeResponse as s, McpServer as t, scopeChallengeResourceMetadataUrl as u, StdioListenRouter as v, completable as w, createServerNotifier as x, createListenRouter as y };
2276
- //# sourceMappingURL=mcp-Dw2OlZ1f.mjs.map
2326
+ //# sourceMappingURL=mcp-DIH4cS6P.mjs.map