@modelcontextprotocol/server 2.0.0-alpha.4 → 2.0.0-beta.2

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 (42) hide show
  1. package/README.md +2 -2
  2. package/dist/ajvProvider-D2kRT_qB.d.cts +1030 -0
  3. package/dist/ajvProvider-D2kRT_qB.d.cts.map +1 -0
  4. package/dist/ajvProvider-DhTNkgm1.cjs +7059 -0
  5. package/dist/ajvProvider-DhTNkgm1.cjs.map +1 -0
  6. package/dist/cfWorkerProvider-Djgwc46-.cjs +976 -0
  7. package/dist/cfWorkerProvider-Djgwc46-.cjs.map +1 -0
  8. package/dist/cfWorkerProvider-RncldJmy.d.cts +59 -0
  9. package/dist/cfWorkerProvider-RncldJmy.d.cts.map +1 -0
  10. package/dist/chunk-Bnu9O96Y.cjs +60 -0
  11. package/dist/createMcpHandler-Du3hjXvf.d.mts.map +1 -1
  12. package/dist/createMcpHandler-DyxapqGO.d.cts +11190 -0
  13. package/dist/createMcpHandler-DyxapqGO.d.cts.map +1 -0
  14. package/dist/index.cjs +1657 -0
  15. package/dist/index.cjs.map +1 -0
  16. package/dist/index.d.cts +1745 -0
  17. package/dist/index.d.cts.map +1 -0
  18. package/dist/index.mjs +3 -2
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/{mcp-JttQJlI9.mjs → mcp-C2tFGfLG.mjs} +18 -5
  21. package/dist/mcp-C2tFGfLG.mjs.map +1 -0
  22. package/dist/mcp-DVEehpM2.cjs +10545 -0
  23. package/dist/mcp-DVEehpM2.cjs.map +1 -0
  24. package/dist/shimsNode.cjs +12 -0
  25. package/dist/shimsNode.d.cts +3 -0
  26. package/dist/shimsWorkerd.cjs +23 -0
  27. package/dist/shimsWorkerd.cjs.map +1 -0
  28. package/dist/shimsWorkerd.d.cts +11 -0
  29. package/dist/shimsWorkerd.d.cts.map +1 -0
  30. package/dist/stdio.cjs +563 -0
  31. package/dist/stdio.cjs.map +1 -0
  32. package/dist/stdio.d.cts +107 -0
  33. package/dist/stdio.d.cts.map +1 -0
  34. package/dist/stdio.mjs +1 -1
  35. package/dist/types-Pc2fJzyM.d.cts +1099 -0
  36. package/dist/types-Pc2fJzyM.d.cts.map +1 -0
  37. package/dist/validators/ajv.cjs +10 -0
  38. package/dist/validators/ajv.d.cts +2 -0
  39. package/dist/validators/cfWorker.cjs +3 -0
  40. package/dist/validators/cfWorker.d.cts +2 -0
  41. package/package.json +69 -20
  42. package/dist/mcp-JttQJlI9.mjs.map +0 -1
@@ -5918,7 +5918,9 @@ const INBOUND_VALIDATION_LADDER = [
5918
5918
  * the ladder (or a pre-handler protocol gate) produced. Errors produced by
5919
5919
  * request handlers — whatever their code — stay in-band on HTTP 200, and are
5920
5920
  * never mapped to an HTTP status by this table; in particular `-32603` and
5921
- * domain-specific codes never become a blanket 500.
5921
+ * domain-specific codes never become a blanket 500. The single exception is
5922
+ * `MissingRequiredClientCapability` (-32021) — see
5923
+ * {@linkcode httpStatusForErrorCode}.
5922
5924
  *
5923
5925
  * `-32602` (invalid params) deliberately has NO entry: the only invalid-params
5924
5926
  * rejection that maps to HTTP 400 is the classifier's own envelope rung
@@ -5936,11 +5938,22 @@ const LADDER_ERROR_HTTP_STATUS = {
5936
5938
  /**
5937
5939
  * The HTTP status to answer a JSON-RPC error with, keyed on the error's
5938
5940
  * origin. `in-band` errors (anything produced by a request handler) are
5939
- * always HTTP 200 — the JSON-RPC error response is the payload, not an HTTP
5940
- * failure. `ladder` errors map through {@linkcode LADDER_ERROR_HTTP_STATUS}.
5941
+ * HTTP 200 — the JSON-RPC error response is the payload, not an HTTP
5942
+ * failure with ONE exception: `MissingRequiredClientCapability` (-32021),
5943
+ * whose 400 the spec mandates on the error itself with no origin condition,
5944
+ * and which the SDK genuinely produces after dispatch (the `input_required`
5945
+ * capability gate). A handler relaying some downstream peer's `-32020`/`-32022`
5946
+ * is NOT that peer's spec error and stays in-band like every other handler
5947
+ * code. `ladder` errors map through {@linkcode LADDER_ERROR_HTTP_STATUS}.
5948
+ *
5949
+ * The per-request transport intentionally does NOT delegate to this function:
5950
+ * its `?? 400` ladder fallback is only correct for entry-gate codes known to
5951
+ * the table, and would wrongly map dispatch-window errors outside it (a
5952
+ * window `-32602` must stay in-band on 200). The transport indexes the table
5953
+ * directly; keep the two in agreement when editing either.
5941
5954
  */
5942
5955
  function httpStatusForErrorCode(code, origin) {
5943
- if (origin === "in-band") return 200;
5956
+ if (origin === "in-band") return code === ProtocolErrorCode.MissingRequiredClientCapability ? 400 : 200;
5944
5957
  return LADDER_ERROR_HTTP_STATUS[code] ?? 400;
5945
5958
  }
5946
5959
  function rejection(rung, cell, httpStatus, error, settled) {
@@ -9995,4 +10008,4 @@ function unwrapOptionalSchema(schema) {
9995
10008
 
9996
10009
  //#endregion
9997
10010
  export { validateEnvelopeMeta as $, classifyInboundRequest as A, SdkErrorCode as At, isInitializedNotification as B, isSpecType as C, TRACEPARENT_META_KEY as Ct, inputResponse as D, checkResourceAllowed as Dt, inputRequired as E, requiredClientCapabilitiesForRequest as Et, validateMcpParamHeaders as F, isCompletable as Ft, isJSONRPCResponse as G, isJSONRPCErrorResponse as H, assertCompleteRequestPrompt as I, parseJSONRPCMessage as J, isJSONRPCResultResponse as K, assertCompleteRequestResourceTemplate as L, modernOnlyStrictRejection as M, OAuthError as Mt, validateStandardRequestHeaders as N, OAuthErrorCode as Nt, LADDER_ERROR_HTTP_STATUS as O, resourceUrlFromServerUrl as Ot, scanXMcpHeaderDeclarations as P, completable as Pt, requestMetaOf as Q, isCallToolResult as R, setNegotiatedProtocolVersion as S, SUPPORTED_PROTOCOL_VERSIONS as St, acceptedContent as T, missingClientCapabilities as Tt, isJSONRPCNotification as U, isInputRequiredResult as V, isJSONRPCRequest as W, envelopeClaimVersion as X, JSONRPCMessageSchema as Y, hasEnvelopeClaim as Z, STDIO_DEFAULT_MAX_BUFFER_SIZE as _, METHOD_NOT_FOUND as _t, seedClientIdentityFromEnvelope as a, ProtocolErrorCode as at, getDisplayName as b, RELATED_TASK_META_KEY as bt, StdioListenRouter as c, CLIENT_CAPABILITIES_META_KEY as ct, createServerNotifier as d, INTERNAL_ERROR as dt, MissingRequiredClientCapabilityError as et, fromJsonSchema as f, INVALID_PARAMS as ft, ReadBuffer as g, LOG_LEVEL_META_KEY as gt, createFetchWithInit as h, LATEST_PROTOCOL_VERSION as ht, installModernOnlyHandlers as i, UrlElicitationRequiredError as it, httpStatusForErrorCode as j, SdkHttpError as jt, carriesValidModernEnvelopeClaim as k, SdkError as kt, createListenRouter as l, CLIENT_INFO_META_KEY as lt, UriTemplate as m, JSONRPC_VERSION as mt, ResourceTemplate as n, ResourceNotFoundError as nt, DEFAULT_LISTEN_KEEPALIVE_MS as o, SUPPORTED_MODERN_PROTOCOL_VERSIONS as ot, InMemoryTransport as p, INVALID_REQUEST as pt, isTaskAugmentedRequestParams as q, Server as r, UnsupportedProtocolVersionError as rt, DEFAULT_MAX_SUBSCRIPTIONS as s, BAGGAGE_META_KEY as st, McpServer as t, ProtocolError as tt, InMemoryServerEventBus as u, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as ut, deserializeMessage as v, PARSE_ERROR as vt, specTypeSchemas as w, TRACESTATE_META_KEY as wt, DEFAULT_REQUEST_TIMEOUT_MSEC as x, SUBSCRIPTION_ID_META_KEY as xt, serializeMessage as y, PROTOCOL_VERSION_META_KEY as yt, isInitializeRequest as z };
9998
- //# sourceMappingURL=mcp-JttQJlI9.mjs.map
10011
+ //# sourceMappingURL=mcp-C2tFGfLG.mjs.map