@modelcontextprotocol/server 2.0.0-alpha.3 → 2.0.0-alpha.4

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 (41) hide show
  1. package/README.md +5 -2
  2. package/dist/{ajvProvider-Birb50r-.mjs → ajvProvider-BQMcjynJ.mjs} +952 -154
  3. package/dist/ajvProvider-BQMcjynJ.mjs.map +1 -0
  4. package/dist/{ajvProvider-DZ_siXcF.d.mts → ajvProvider-Dzgk80kq.d.mts} +58 -11
  5. package/dist/ajvProvider-Dzgk80kq.d.mts.map +1 -0
  6. package/dist/{cfWorkerProvider-BrJKpSFH.mjs → cfWorkerProvider-BDC2rVl3.mjs} +21 -5
  7. package/dist/cfWorkerProvider-BDC2rVl3.mjs.map +1 -0
  8. package/dist/{cfWorkerProvider-DUhk5Ewx.d.mts → cfWorkerProvider-DmvjVsvQ.d.mts} +13 -6
  9. package/dist/cfWorkerProvider-DmvjVsvQ.d.mts.map +1 -0
  10. package/dist/{transport-DMKhEchd.d.mts → createMcpHandler-Du3hjXvf.d.mts} +5283 -1559
  11. package/dist/createMcpHandler-Du3hjXvf.d.mts.map +1 -0
  12. package/dist/index.d.mts +167 -2015
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs +1238 -1281
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/mcp-JttQJlI9.mjs +9998 -0
  17. package/dist/mcp-JttQJlI9.mjs.map +1 -0
  18. package/dist/shimsNode.d.mts +1 -1
  19. package/dist/shimsNode.mjs +1 -1
  20. package/dist/shimsWorkerd.d.mts +1 -1
  21. package/dist/shimsWorkerd.mjs +1 -1
  22. package/dist/stdio.d.mts +61 -3
  23. package/dist/stdio.d.mts.map +1 -1
  24. package/dist/stdio.mjs +457 -2
  25. package/dist/stdio.mjs.map +1 -1
  26. package/dist/types-DBYdVs-n.d.mts +1099 -0
  27. package/dist/types-DBYdVs-n.d.mts.map +1 -0
  28. package/dist/validators/ajv.d.mts +1 -1
  29. package/dist/validators/ajv.mjs +1 -1
  30. package/dist/validators/cfWorker.d.mts +1 -1
  31. package/dist/validators/cfWorker.mjs +1 -1
  32. package/package.json +3 -6
  33. package/dist/ajvProvider-Birb50r-.mjs.map +0 -1
  34. package/dist/ajvProvider-DZ_siXcF.d.mts.map +0 -1
  35. package/dist/cfWorkerProvider-BrJKpSFH.mjs.map +0 -1
  36. package/dist/cfWorkerProvider-DUhk5Ewx.d.mts.map +0 -1
  37. package/dist/src-Pa1iAvsj.mjs +0 -3386
  38. package/dist/src-Pa1iAvsj.mjs.map +0 -1
  39. package/dist/transport-DMKhEchd.d.mts.map +0 -1
  40. package/dist/types-R2RTIcjk.d.mts +0 -66
  41. package/dist/types-R2RTIcjk.d.mts.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,1435 +1,8 @@
1
- import { $ as GetTaskPayloadResult, $n as TaskAugmentedRequestParams, $t as PaginatedRequestParams, A as CreateMessageRequestParams, An as ResourceTemplateReference, Ar as LATEST_PROTOCOL_VERSION, At as ListResourcesRequest, B as ElicitRequestFormParams, Bn as SamplingMessage, Bt as LoggingMessageNotificationParams, C as CompleteRequest, Cn as RequestParams, Cr as CLIENT_CAPABILITIES_META_KEY, Ct as ListChangedCallback, D as CompleteResult, Dn as ResourceLink, Dr as INVALID_PARAMS, Dt as ListPromptsResult, E as CompleteRequestResourceTemplate, En as ResourceContents, Er as INTERNAL_ERROR, Et as ListPromptsRequest, F as CreateTaskResult, Fn as ResultTypeMap, Fr as RELATED_TASK_META_KEY, Ft as ListTasksResult, G as ElicitationCompleteNotificationParams, Gn as ServerResult, Gt as ModelPreferences, H as ElicitRequestURLParams, Hn as ServerCapabilities, Ht as MetaObject, I as Cursor, In as Role, Ir as SUPPORTED_PROTOCOL_VERSIONS, It as ListToolsRequest, J as EnumSchema, Jn as SingleSelectEnumSchema, Jt as NotificationMethod, K as EmbeddedResource, Kn as SetLevelRequest, Kt as MultiSelectEnumSchema, L as DiscoverRequest, Ln as Root, Lr as TRACEPARENT_META_KEY, Lt as ListToolsResult, M as CreateMessageRequestParamsWithTools, Mn as ResourceUpdatedNotification, Mr as METHOD_NOT_FOUND, Mt as ListRootsRequest, N as CreateMessageResult, Nn as ResourceUpdatedNotificationParams, Nr as PARSE_ERROR, Nt as ListRootsResult, O as ContentBlock, On as ResourceListChangedNotification, Or as INVALID_REQUEST, Ot as ListResourceTemplatesRequest, P as CreateMessageResultWithTools, Pn as Result$1, Pr as PROTOCOL_VERSION_META_KEY, Pt as ListTasksRequest, Q as GetTaskPayloadRequest, Qn as Task, Qt as PaginatedRequest, R as DiscoverResult, Rn as RootsListChangedNotification, Rr as TRACESTATE_META_KEY, Rt as LoggingLevel, S as CompatibilityCallToolResult, Sn as RequestMethod, Sr as BAGGAGE_META_KEY, St as LegacyTitledEnumSchema, T as CompleteRequestPrompt, Tn as Resource, Tr as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, Tt as ListChangedOptions, U as ElicitResult, Un as ServerNotification, Ut as MethodNotFoundError, V as ElicitRequestParams, Vn as SamplingMessageContentBlock, Vt as MessageExtraInfo, W as ElicitationCompleteNotification, Wn as ServerRequest, Wt as ModelHint, X as GetPromptRequestParams, Xn as SubscribeRequest, Xt as NotificationTypeMap, Y as GetPromptRequest, Yn as StringSchema, Yt as NotificationParams, Z as GetPromptResult, Zn as SubscribeRequestParams, Zt as NumberSchema, _ as CancelledNotificationParams, _n as Request$1, _r as UnsubscribeRequestParams, _t as JSONRPCNotification, a as Annotations, an as ProgressNotification, ar as TextContent, at as Implementation, b as ClientRequest, bn as RequestMetaEnvelope, br as UntitledSingleSelectEnumSchema, bt as JSONRPCResultResponse, c as BaseMetadata, cn as Prompt, cr as TitledSingleSelectEnumSchema, ct as InitializeResult, d as CallToolRequest, dn as PromptMessage, dr as ToolChoice, dt as InvalidParamsError, en as PaginatedResult, er as TaskCreationParams, et as GetTaskRequest, f as CallToolRequestParams, fn as PromptReference, fr as ToolExecution, ft as InvalidRequestError, g as CancelledNotification, gn as RelatedTaskMetadata, gr as UnsubscribeRequest, gt as JSONRPCMessage, h as CancelTaskResult, hn as ReadResourceResult, hr as ToolUseContent, ht as JSONRPCErrorResponse, i as createFetchWithInit, in as Progress, ir as TaskStatusNotificationParams, it as ImageContent, j as CreateMessageRequestParamsBase, jn as ResourceTemplateType, jr as LOG_LEVEL_META_KEY, jt as ListResourcesResult, k as CreateMessageRequest, kn as ResourceRequestParams, kr as JSONRPC_VERSION, kt as ListResourceTemplatesResult, l as BlobResourceContents, ln as PromptArgument, lr as Tool, lt as InitializedNotification, m as CancelTaskRequest, mn as ReadResourceRequestParams, mr as ToolResultContent, mt as JSONObject, n as Transport, nn as PingRequest, nr as TaskStatus, nt as Icon, o as AudioContent, on as ProgressNotificationParams, or as TextResourceContents, ot as InitializeRequest, p as CallToolResult, pn as ReadResourceRequest, pr as ToolListChangedNotification, pt as JSONArray, q as EmptyResult, qn as SetLevelRequestParams, qt as Notification, r as TransportSendOptions, rn as PrimitiveSchemaDefinition, rr as TaskStatusNotification, rt as Icons, s as AuthInfo, sn as ProgressToken, sr as TitledMultiSelectEnumSchema, st as InitializeRequestParams, t as FetchLike, tn as ParseError, tr as TaskMetadata, tt as GetTaskResult, u as BooleanSchema, un as PromptListChangedNotification, ur as ToolAnnotations, ut as InternalError, v as ClientCapabilities, vn as RequestId, vr as UnsupportedProtocolVersionErrorData, vt as JSONRPCRequest, w as CompleteRequestParams, wn as RequestTypeMap, wr as CLIENT_INFO_META_KEY, wt as ListChangedHandlers, x as ClientResult, xn as RequestMetaObject, xr as schemas_d_exports, xt as JSONValue, y as ClientNotification, yn as RequestMeta, yr as UntitledMultiSelectEnumSchema, yt as JSONRPCResponse, z as ElicitRequest, zn as SamplingContent, zt as LoggingMessageNotification } from "./transport-DMKhEchd.mjs";
2
- import { t as AjvJsonSchemaValidator } from "./ajvProvider-DZ_siXcF.mjs";
3
- import { i as jsonSchemaValidator, n as JsonSchemaValidator, r as JsonSchemaValidatorResult, t as JsonSchemaType } from "./types-R2RTIcjk.mjs";
4
- import { n as CfWorkerSchemaDraft, t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-DUhk5Ewx.mjs";
5
- import * as z from "zod/v4";
1
+ import { $ as RequestOptions, $a as OAuthClientMetadata, $i as Task, $n as InputRequiredResult, $r as ProgressNotification, $t as CallToolResult, A as ResourceMetadata, Aa as LATEST_PROTOCOL_VERSION, Ai as Role, An as ElicitationCompleteNotification, Ar as LoggingLevel, At as InputResponseView, B as deserializeMessage, Ba as checkResourceAllowed, Bi as SetLevelRequest, Bn as GetTaskRequest, Br as MultiSelectEnumSchema, Bt as InboundLegacyRoute, C as PromptCallback, Ca as CLIENT_CAPABILITIES_META_KEY, Ci as ResourceRequestParams, Cn as DiscoverRequest, Cr as ListResourcesResult, Ct as MissingRequiredClientCapabilityError, D as RegisteredResource, Da as INVALID_PARAMS, Di as ResourceUpdatedNotificationParams, Dn as ElicitRequestParams, Dr as ListTasksResult, Dt as UrlElicitationRequiredError, E as RegisteredPrompt, Ea as INTERNAL_ERROR, Ei as ResourceUpdatedNotification, En as ElicitRequestFormParams, Er as ListTasksRequest, Et as UnsupportedProtocolVersionError, F as InMemoryTransport, Fa as RELATED_TASK_META_KEY, Fi as SamplingMessageContentBlock, Fn as GetPromptRequest, Fr as MetaObject, Ft as StandardSchemaV1Sync, G as getDisplayName, Ga as SdkHttpErrorData, Gi as SubscribeRequestParams, Gn as ImageContent, Gr as NumberSchema, Gt as Annotations, H as CacheHint, Ha as SdkError, Hi as SingleSelectEnumSchema, Hn as HandlerResultTypeMap, Hr as NotificationMethod, Ht as InboundModernRoute, I as UriTemplate, Ia as SUBSCRIPTION_ID_META_KEY, Ii as ServerCapabilities, In as GetPromptRequestParams, Ir as MethodNotFoundError, It as StandardSchemaWithJSON, J as DEFAULT_REQUEST_TIMEOUT_MSEC, Ja as AuthorizationServerMetadata, Ji as SubscriptionsAcknowledgedNotificationParams, Jn as InitializeRequestParams, Jr as PaginatedResult, Jt as BaseMetadata, K as BaseContext, Ka as OAuthError, Ki as SubscriptionFilter, Kn as Implementation, Kr as PaginatedRequest, Kt as AudioContent, L as Variables, La as SUPPORTED_PROTOCOL_VERSIONS, Li as ServerNotification, Ln as GetPromptResult, Lr as MissingRequiredClientCapabilityErrorData, Lt as InboundClassificationOutcome, M as ToolCallback, Ma as METHOD_NOT_FOUND, Mi as RootsListChangedNotification, Mn as EmbeddedResource, Mr as LoggingMessageNotificationParams, Mt as inputRequired, N as Server, Na as PARSE_ERROR, Ni as SamplingContent, Nn as EmptyResult, Nr as MessageClassification, Nt as inputResponse, O as RegisteredResourceTemplate, Oa as INVALID_REQUEST, Oi as Result, On as ElicitRequestURLParams, Or as ListToolsRequest, Ot as ProtocolErrorCode, P as ServerOptions, Pa as PROTOCOL_VERSION_META_KEY, Pi as SamplingMessage, Pn as EnumSchema, Pr as MessageExtraInfo, Pt as StandardSchemaV1, Q as RequestHandlerSchemas, Qa as OAuthClientInformationMixed, Qi as SubscriptionsListenResultMeta, Qn as InputRequests, Qr as Progress, Qt as CallToolRequestParams, R as ReadBuffer, Ra as TRACEPARENT_META_KEY, Ri as ServerRequest, Rn as GetTaskPayloadRequest, Rr as ModelHint, Rt as InboundHttpRequest, S as McpServer, Sa as BAGGAGE_META_KEY, Si as ResourceListChangedNotification, Sn as Cursor, Sr as ListResourcesRequest, St as parseJSONRPCMessage, T as ReadResourceTemplateCallback, Ta as DEFAULT_NEGOTIATED_PROTOCOL_VERSION, Ti as ResourceTemplateType, Tn as ElicitRequest, Tr as ListRootsResult, Tt as ResourceNotFoundError, U as CacheScope, Ua as SdkErrorCode, Ui as StringSchema, Un as Icon, Ur as NotificationParams, Ut as InboundValidationRung, V as serializeMessage, Va as resourceUrlFromServerUrl, Vi as SetLevelRequestParams, Vn as GetTaskResult, Vr as Notification, Vt as InboundLegacyRouteReason, W as ProtocolEra, Wa as SdkHttpError, Wi as SubscribeRequest, Wn as Icons, Wr as NotificationTypeMap, Wt as classifyInboundRequest, X as ProgressCallback, Xa as OAuthClientInformation, Xi as SubscriptionsListenRequestParams, Xn as InitializedNotification, Xr as PingRequest, Xt as BooleanSchema, Y as NotificationOptions, Ya as IdJagTokenExchangeResponse, Yi as SubscriptionsListenRequest, Yn as InitializeResult, Yr as ParseError, Yt as BlobResourceContents, Z as ProtocolOptions, Za as OAuthClientInformationFull, Zi as SubscriptionsListenResult, Zn as InputRequest, Zr as PrimitiveSchemaDefinition, Zt as CallToolRequest, _ as PerRequestResponseMode, _a as UnsubscribeRequest, _i as RequestParams, _n as CreateMessageRequestParamsBase, _r as ListChangedOptions, _t as isJSONRPCNotification, a as McpRequestContext, aa as TaskStatusNotificationParams, ai as PromptMessage, an as ClientNotification, ao as OAuthTokens, ar as JSONArray, at as createFetchWithInit, b as CompleteResourceTemplateCallback, ba as UntitledMultiSelectEnumSchema, bi as ResourceContents, bn as CreateMessageResultWithTools, br as ListResourceTemplatesRequest, bt as isJSONRPCResultResponse, c as isLegacyRequest, ca as TitledMultiSelectEnumSchema, ci as ReadResourceRequestParams, cn as CompatibilityCallToolResult, co as StoredOAuthClientInformation, cr as JSONRPCMessage, ct as isSpecType, d as ServerEvent, da as ToolAnnotations, di as Request$1, dn as CompleteRequestPrompt, dr as JSONRPCResponse, dt as assertCompleteRequestResourceTemplate, ea as TaskAugmentedRequestParams, ei as ProgressNotificationParams, en as CancelTaskRequest, eo as OAuthClientRegistrationError, er as InputResponse, et as RequestStateAccessor, f as ServerEventBus, fa as ToolChoice, fi as RequestId, fn as CompleteRequestResourceTemplate, fr as JSONRPCResultResponse, ft as isCallToolResult, g as PerRequestMessageExtra, ga as ToolUseContent, gi as RequestMethod, gn as CreateMessageRequestParams, gr as ListChangedHandlers, gt as isJSONRPCErrorResponse, h as PerRequestHTTPServerTransportOptions, ha as ToolResultContent, hi as RequestMetaObject, hn as CreateMessageRequest, hr as ListChangedCallback, ht as isInputRequiredResult, i as McpHttpHandler, ia as TaskStatusNotification, ii as PromptListChangedNotification, in as ClientCapabilities, io as OAuthTokenRevocationRequest, ir as InvalidRequestError, it as TransportSendOptions, j as ResourceTemplate, ja as LOG_LEVEL_META_KEY, ji as Root, jn as ElicitationCompleteNotificationParams, jr as LoggingMessageNotification, jt as acceptedContent, k as RegisteredTool, ka as JSONRPC_VERSION, ki as ResultTypeMap, kn as ElicitResult, kr as ListToolsResult, kt as InputRequiredSpec, l as legacyStatelessFallback, la as TitledSingleSelectEnumSchema, li as ReadResourceResult, ln as CompleteRequest, lo as StoredOAuthTokens, lr as JSONRPCNotification, lt as specTypeSchemas, m as PerRequestHTTPServerTransport, ma as ToolListChangedNotification, mi as RequestMetaEnvelope, mn as ContentBlock, mr as LegacyTitledEnumSchema, mt as isInitializedNotification, n as LegacyHttpHandler, na as TaskMetadata, ni as Prompt, nn as CancelledNotification, no as OAuthMetadata, nr as InternalError, nt as FetchLike, o as McpServerFactory, oa as TextContent, oi as PromptReference, on as ClientRequest, oo as OpenIdProviderDiscoveryMetadata, or as JSONObject, ot as SpecTypeName, p as ServerNotifier, pa as ToolExecution, pi as RequestMeta, pn as CompleteResult, pr as JSONValue, pt as isInitializeRequest, q as ClientContext, qa as OAuthErrorCode, qi as SubscriptionsAcknowledgedNotification, qn as InitializeRequest, qr as PaginatedRequestParams, qt as AuthInfo, r as McpHandlerRequestOptions, ra as TaskStatus, ri as PromptArgument, rn as CancelledNotificationParams, ro as OAuthProtectedResourceMetadata, rr as InvalidParamsError, rt as Transport, s as createMcpHandler, sa as TextResourceContents, si as ReadResourceRequest, sn as ClientResult, so as OpenIdProviderMetadata, sr as JSONRPCErrorResponse, st as SpecTypes, t as CreateMcpHandlerOptions, ta as TaskCreationParams, ti as ProgressToken, tn as CancelTaskResult, to as OAuthErrorResponse, tr as InputResponses, tt as ServerContext, u as InMemoryServerEventBus, ua as Tool, ui as RelatedTaskMetadata, un as CompleteRequestParams, ur as JSONRPCRequest, ut as assertCompleteRequestPrompt, v as AnyToolHandler, va as UnsubscribeRequestParams, vi as RequestTypeMap, vn as CreateMessageRequestParamsWithTools, vr as ListPromptsRequest, vt as isJSONRPCRequest, w as ReadResourceCallback, wa as CLIENT_INFO_META_KEY, wi as ResourceTemplateReference, wn as DiscoverResult, wr as ListRootsRequest, wt as ProtocolError, x as ListResourcesCallback, xa as UntitledSingleSelectEnumSchema, xi as ResourceLink, xn as CreateTaskResult, xr as ListResourceTemplatesResult, xt as isTaskAugmentedRequestParams, y as BaseToolCallback, ya as UnsupportedProtocolVersionErrorData, yi as Resource, yn as CreateMessageResult, yr as ListPromptsResult, yt as isJSONRPCResponse, z as STDIO_DEFAULT_MAX_BUFFER_SIZE, za as TRACESTATE_META_KEY, zi as ServerResult, zn as GetTaskPayloadResult, zr as ModelPreferences, zt as InboundLadderRejection } from "./createMcpHandler-Du3hjXvf.mjs";
2
+ import { t as AjvJsonSchemaValidator } from "./ajvProvider-Dzgk80kq.mjs";
3
+ import { i as jsonSchemaValidator, n as JsonSchemaValidator, r as JsonSchemaValidatorResult, t as JsonSchemaType } from "./types-DBYdVs-n.mjs";
4
+ import { n as CfWorkerSchemaDraft, t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-DmvjVsvQ.mjs";
6
5
 
7
- //#region ../core-internal/src/shared/auth.d.ts
8
-
9
- /**
10
- * RFC 9728 OAuth Protected Resource Metadata
11
- */
12
- declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{
13
- resource: z.ZodString;
14
- authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
15
- jwks_uri: z.ZodOptional<z.ZodString>;
16
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
- bearer_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
- resource_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
- resource_name: z.ZodOptional<z.ZodString>;
20
- resource_documentation: z.ZodOptional<z.ZodString>;
21
- resource_policy_uri: z.ZodOptional<z.ZodString>;
22
- resource_tos_uri: z.ZodOptional<z.ZodString>;
23
- tls_client_certificate_bound_access_tokens: z.ZodOptional<z.ZodBoolean>;
24
- authorization_details_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
- dpop_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
- dpop_bound_access_tokens_required: z.ZodOptional<z.ZodBoolean>;
27
- }, z.core.$loose>;
28
- /**
29
- * RFC 8414 OAuth 2.0 Authorization Server Metadata
30
- */
31
- declare const OAuthMetadataSchema: z.ZodObject<{
32
- issuer: z.ZodString;
33
- authorization_endpoint: z.ZodURL;
34
- token_endpoint: z.ZodURL;
35
- registration_endpoint: z.ZodOptional<z.ZodURL>;
36
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
- response_types_supported: z.ZodArray<z.ZodString>;
38
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
- service_documentation: z.ZodOptional<z.ZodURL>;
43
- revocation_endpoint: z.ZodOptional<z.ZodURL>;
44
- revocation_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
- revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
- introspection_endpoint: z.ZodOptional<z.ZodString>;
47
- introspection_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
- introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
51
- }, z.core.$loose>;
52
- /**
53
- * OpenID Connect Discovery 1.0 Provider Metadata
54
- *
55
- * @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
56
- */
57
- declare const OpenIdProviderMetadataSchema: z.ZodObject<{
58
- issuer: z.ZodString;
59
- authorization_endpoint: z.ZodURL;
60
- token_endpoint: z.ZodURL;
61
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
62
- jwks_uri: z.ZodURL;
63
- registration_endpoint: z.ZodOptional<z.ZodURL>;
64
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- response_types_supported: z.ZodArray<z.ZodString>;
66
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
- subject_types_supported: z.ZodArray<z.ZodString>;
70
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
71
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
- service_documentation: z.ZodOptional<z.ZodString>;
85
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
87
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
88
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
89
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
90
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
91
- op_policy_uri: z.ZodOptional<z.ZodURL>;
92
- op_tos_uri: z.ZodOptional<z.ZodURL>;
93
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
94
- }, z.core.$loose>;
95
- /**
96
- * OpenID Connect Discovery metadata that may include OAuth 2.0 fields
97
- * This schema represents the real-world scenario where OIDC providers
98
- * return a mix of OpenID Connect and OAuth 2.0 metadata fields
99
- */
100
- declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
101
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
102
- issuer: z.ZodString;
103
- authorization_endpoint: z.ZodURL;
104
- token_endpoint: z.ZodURL;
105
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
106
- jwks_uri: z.ZodURL;
107
- registration_endpoint: z.ZodOptional<z.ZodURL>;
108
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
- response_types_supported: z.ZodArray<z.ZodString>;
110
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
112
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
- subject_types_supported: z.ZodArray<z.ZodString>;
114
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
115
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
- service_documentation: z.ZodOptional<z.ZodString>;
129
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
130
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
132
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
133
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
134
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
135
- op_policy_uri: z.ZodOptional<z.ZodURL>;
136
- op_tos_uri: z.ZodOptional<z.ZodURL>;
137
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
138
- }, z.core.$strip>;
139
- /**
140
- * OAuth 2.1 token response
141
- */
142
- declare const OAuthTokensSchema: z.ZodObject<{
143
- access_token: z.ZodString;
144
- id_token: z.ZodOptional<z.ZodString>;
145
- token_type: z.ZodString;
146
- expires_in: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
147
- scope: z.ZodOptional<z.ZodString>;
148
- refresh_token: z.ZodOptional<z.ZodString>;
149
- }, z.core.$strip>;
150
- /**
151
- * RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens.
152
- *
153
- * `token_type` is intentionally optional: per RFC 8693 §2.2.1 it is informational when
154
- * the issued token is not an access token, and per RFC 6749 §5.1 it is case-insensitive,
155
- * so strict checking rejects conformant IdPs.
156
- */
157
- declare const IdJagTokenExchangeResponseSchema: z.ZodObject<{
158
- issued_token_type: z.ZodLiteral<"urn:ietf:params:oauth:token-type:id-jag">;
159
- access_token: z.ZodString;
160
- token_type: z.ZodOptional<z.ZodString>;
161
- expires_in: z.ZodOptional<z.ZodNumber>;
162
- scope: z.ZodOptional<z.ZodString>;
163
- }, z.core.$strip>;
164
- type IdJagTokenExchangeResponse = z.infer<typeof IdJagTokenExchangeResponseSchema>;
165
- /**
166
- * OAuth 2.1 error response
167
- */
168
- declare const OAuthErrorResponseSchema: z.ZodObject<{
169
- error: z.ZodString;
170
- error_description: z.ZodOptional<z.ZodString>;
171
- error_uri: z.ZodOptional<z.ZodString>;
172
- }, z.core.$strip>;
173
- /**
174
- * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
175
- */
176
- declare const OAuthClientMetadataSchema: z.ZodObject<{
177
- redirect_uris: z.ZodArray<z.ZodURL>;
178
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
179
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
180
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
- client_name: z.ZodOptional<z.ZodString>;
182
- client_uri: z.ZodOptional<z.ZodURL>;
183
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
184
- scope: z.ZodOptional<z.ZodString>;
185
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
186
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
187
- policy_uri: z.ZodOptional<z.ZodString>;
188
- jwks_uri: z.ZodOptional<z.ZodURL>;
189
- jwks: z.ZodOptional<z.ZodAny>;
190
- software_id: z.ZodOptional<z.ZodString>;
191
- software_version: z.ZodOptional<z.ZodString>;
192
- software_statement: z.ZodOptional<z.ZodString>;
193
- }, z.core.$strip>;
194
- /**
195
- * RFC 7591 OAuth 2.0 Dynamic Client Registration client information
196
- */
197
- declare const OAuthClientInformationSchema: z.ZodObject<{
198
- client_id: z.ZodString;
199
- client_secret: z.ZodOptional<z.ZodString>;
200
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
201
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
202
- }, z.core.$strip>;
203
- /**
204
- * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
205
- */
206
- declare const OAuthClientInformationFullSchema: z.ZodObject<{
207
- redirect_uris: z.ZodArray<z.ZodURL>;
208
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
209
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
210
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
211
- client_name: z.ZodOptional<z.ZodString>;
212
- client_uri: z.ZodOptional<z.ZodURL>;
213
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
214
- scope: z.ZodOptional<z.ZodString>;
215
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
216
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
217
- policy_uri: z.ZodOptional<z.ZodString>;
218
- jwks_uri: z.ZodOptional<z.ZodURL>;
219
- jwks: z.ZodOptional<z.ZodAny>;
220
- software_id: z.ZodOptional<z.ZodString>;
221
- software_version: z.ZodOptional<z.ZodString>;
222
- software_statement: z.ZodOptional<z.ZodString>;
223
- client_id: z.ZodString;
224
- client_secret: z.ZodOptional<z.ZodString>;
225
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
226
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
227
- }, z.core.$strip>;
228
- /**
229
- * RFC 7591 OAuth 2.0 Dynamic Client Registration error response
230
- */
231
- declare const OAuthClientRegistrationErrorSchema: z.ZodObject<{
232
- error: z.ZodString;
233
- error_description: z.ZodOptional<z.ZodString>;
234
- }, z.core.$strip>;
235
- /**
236
- * RFC 7009 OAuth 2.0 Token Revocation request
237
- */
238
- declare const OAuthTokenRevocationRequestSchema: z.ZodObject<{
239
- token: z.ZodString;
240
- token_type_hint: z.ZodOptional<z.ZodString>;
241
- }, z.core.$strip>;
242
- type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
243
- type OpenIdProviderMetadata = z.infer<typeof OpenIdProviderMetadataSchema>;
244
- type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
245
- type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
246
- type OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>;
247
- type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
248
- type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
249
- type OAuthClientInformationFull = z.infer<typeof OAuthClientInformationFullSchema>;
250
- type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull;
251
- type OAuthClientRegistrationError = z.infer<typeof OAuthClientRegistrationErrorSchema>;
252
- type OAuthTokenRevocationRequest = z.infer<typeof OAuthTokenRevocationRequestSchema>;
253
- type OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>;
254
- type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
255
- //#endregion
256
- //#region ../core-internal/src/auth/errors.d.ts
257
- /**
258
- * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749}
259
- * and extensions.
260
- */
261
- declare enum OAuthErrorCode {
262
- /**
263
- * The request is missing a required parameter, includes an invalid parameter value,
264
- * includes a parameter more than once, or is otherwise malformed.
265
- */
266
- InvalidRequest = "invalid_request",
267
- /**
268
- * Client authentication failed (e.g., unknown client, no client authentication included,
269
- * or unsupported authentication method).
270
- */
271
- InvalidClient = "invalid_client",
272
- /**
273
- * The provided authorization grant or refresh token is invalid, expired, revoked,
274
- * does not match the redirection URI used in the authorization request, or was issued to another client.
275
- */
276
- InvalidGrant = "invalid_grant",
277
- /**
278
- * The authenticated client is not authorized to use this authorization grant type.
279
- */
280
- UnauthorizedClient = "unauthorized_client",
281
- /**
282
- * The authorization grant type is not supported by the authorization server.
283
- */
284
- UnsupportedGrantType = "unsupported_grant_type",
285
- /**
286
- * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.
287
- */
288
- InvalidScope = "invalid_scope",
289
- /**
290
- * The resource owner or authorization server denied the request.
291
- */
292
- AccessDenied = "access_denied",
293
- /**
294
- * The authorization server encountered an unexpected condition that prevented it from fulfilling the request.
295
- */
296
- ServerError = "server_error",
297
- /**
298
- * The authorization server is currently unable to handle the request due to temporary overloading or maintenance.
299
- */
300
- TemporarilyUnavailable = "temporarily_unavailable",
301
- /**
302
- * The authorization server does not support obtaining an authorization code using this method.
303
- */
304
- UnsupportedResponseType = "unsupported_response_type",
305
- /**
306
- * The authorization server does not support the requested token type.
307
- */
308
- UnsupportedTokenType = "unsupported_token_type",
309
- /**
310
- * The access token provided is expired, revoked, malformed, or invalid for other reasons.
311
- */
312
- InvalidToken = "invalid_token",
313
- /**
314
- * The HTTP method used is not allowed for this endpoint. (Custom, non-standard error)
315
- */
316
- MethodNotAllowed = "method_not_allowed",
317
- /**
318
- * Rate limit exceeded. (Custom, non-standard error based on RFC 6585)
319
- */
320
- TooManyRequests = "too_many_requests",
321
- /**
322
- * The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591)
323
- */
324
- InvalidClientMetadata = "invalid_client_metadata",
325
- /**
326
- * The request requires higher privileges than provided by the access token.
327
- */
328
- InsufficientScope = "insufficient_scope",
329
- /**
330
- * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)
331
- */
332
- InvalidTarget = "invalid_target",
333
- }
334
- /**
335
- * OAuth error class for all OAuth-related errors.
336
- */
337
- declare class OAuthError extends Error {
338
- readonly code: OAuthErrorCode | string;
339
- readonly errorUri?: string | undefined;
340
- constructor(code: OAuthErrorCode | string, message: string, errorUri?: string | undefined);
341
- /**
342
- * Converts the error to a standard OAuth error response object.
343
- */
344
- toResponseObject(): OAuthErrorResponse;
345
- /**
346
- * Creates an {@linkcode OAuthError} from an OAuth error response.
347
- */
348
- static fromResponse(response: OAuthErrorResponse): OAuthError;
349
- }
350
- //#endregion
351
- //#region ../core-internal/src/errors/sdkErrors.d.ts
352
- /**
353
- * Error codes for SDK errors (local errors that never cross the wire).
354
- * Unlike {@linkcode ProtocolErrorCode} which uses numeric JSON-RPC codes, `SdkErrorCode` uses
355
- * descriptive string values for better developer experience.
356
- *
357
- * These errors are thrown locally by the SDK and are never serialized as
358
- * JSON-RPC error responses.
359
- */
360
- declare enum SdkErrorCode {
361
- /** Transport is not connected */
362
- NotConnected = "NOT_CONNECTED",
363
- /** Transport is already connected */
364
- AlreadyConnected = "ALREADY_CONNECTED",
365
- /** Protocol is not initialized */
366
- NotInitialized = "NOT_INITIALIZED",
367
- /** Required capability is not supported by the remote side */
368
- CapabilityNotSupported = "CAPABILITY_NOT_SUPPORTED",
369
- /** Request timed out waiting for response */
370
- RequestTimeout = "REQUEST_TIMEOUT",
371
- /** Connection was closed */
372
- ConnectionClosed = "CONNECTION_CLOSED",
373
- /** Failed to send message */
374
- SendFailed = "SEND_FAILED",
375
- /** Response result failed local schema validation */
376
- InvalidResult = "INVALID_RESULT",
377
- ClientHttpNotImplemented = "CLIENT_HTTP_NOT_IMPLEMENTED",
378
- ClientHttpAuthentication = "CLIENT_HTTP_AUTHENTICATION",
379
- ClientHttpForbidden = "CLIENT_HTTP_FORBIDDEN",
380
- ClientHttpUnexpectedContent = "CLIENT_HTTP_UNEXPECTED_CONTENT",
381
- ClientHttpFailedToOpenStream = "CLIENT_HTTP_FAILED_TO_OPEN_STREAM",
382
- ClientHttpFailedToTerminateSession = "CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",
383
- }
384
- /**
385
- * SDK errors are local errors that never cross the wire.
386
- * They are distinct from {@linkcode ProtocolError} which represents JSON-RPC protocol errors
387
- * that are serialized and sent as error responses.
388
- *
389
- * @example
390
- * ```ts source="./sdkErrors.examples.ts#SdkError_basicUsage"
391
- * try {
392
- * // Throwing an SDK error
393
- * throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected');
394
- * } catch (error) {
395
- * // Checking error type by code
396
- * if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) {
397
- * // Handle timeout
398
- * }
399
- * }
400
- * ```
401
- */
402
- declare class SdkError extends Error {
403
- readonly code: SdkErrorCode;
404
- readonly data?: unknown | undefined;
405
- constructor(code: SdkErrorCode, message: string, data?: unknown | undefined);
406
- }
407
- /**
408
- * Typed shape for HTTP error data carried by {@linkcode SdkHttpError}.
409
- */
410
- interface SdkHttpErrorData {
411
- status: number;
412
- statusText?: string;
413
- [key: string]: unknown;
414
- }
415
- /**
416
- * An {@linkcode SdkError} subclass for HTTP transport failures.
417
- *
418
- * Thrown by the streamable HTTP transport when the server responds with a
419
- * non-OK status code. Narrows {@linkcode SdkError.data | data} to
420
- * {@linkcode SdkHttpErrorData} so consumers can inspect the HTTP status
421
- * without unsafe casting.
422
- *
423
- * @example
424
- * ```ts source="./sdkErrors.examples.ts#SdkHttpError_basicUsage"
425
- * if (error instanceof SdkHttpError) {
426
- * console.log(error.status); // number
427
- * console.log(error.statusText); // string | undefined
428
- * }
429
- * ```
430
- */
431
- declare class SdkHttpError extends SdkError {
432
- readonly data: SdkHttpErrorData;
433
- constructor(code: SdkErrorCode, message: string, data: SdkHttpErrorData);
434
- get status(): number;
435
- get statusText(): string | undefined;
436
- }
437
- //#endregion
438
- //#region ../core-internal/src/shared/authUtils.d.ts
439
- /**
440
- * Utilities for handling OAuth resource URIs.
441
- */
442
- /**
443
- * Converts a server URL to a resource URL by removing the fragment.
444
- * {@link https://datatracker.ietf.org/doc/html/rfc8707#section-2 | RFC 8707 section 2}
445
- * states that resource URIs "MUST NOT include a fragment component".
446
- * Keeps everything else unchanged (scheme, domain, port, path, query).
447
- */
448
- declare function resourceUrlFromServerUrl(url: URL | string): URL;
449
- /**
450
- * Checks if a requested resource URL matches a configured resource URL.
451
- * A requested resource matches if it has the same scheme, domain, port,
452
- * and its path starts with the configured resource's path.
453
- *
454
- * @param options - The options object
455
- * @param options.requestedResource - The resource URL being requested
456
- * @param options.configuredResource - The resource URL that has been configured
457
- * @returns true if the requested resource matches the configured resource, false otherwise
458
- */
459
- declare function checkResourceAllowed({
460
- requestedResource,
461
- configuredResource
462
- }: {
463
- requestedResource: URL | string;
464
- configuredResource: URL | string;
465
- }): boolean;
466
- //#endregion
467
- //#region ../core-internal/src/types/enums.d.ts
468
- /**
469
- * Error codes for protocol errors that cross the wire as JSON-RPC error responses.
470
- * These follow the JSON-RPC specification and MCP-specific extensions.
471
- */
472
- declare enum ProtocolErrorCode {
473
- ParseError = -32700,
474
- InvalidRequest = -32600,
475
- MethodNotFound = -32601,
476
- InvalidParams = -32602,
477
- InternalError = -32603,
478
- ResourceNotFound = -32002,
479
- /**
480
- * Processing the request requires a capability the client did not declare
481
- * in the request's `clientCapabilities` (protocol revision 2026-07-28).
482
- */
483
- MissingRequiredClientCapability = -32003,
484
- /**
485
- * The request's protocol version is unknown to the server or unsupported
486
- * by it (protocol revision 2026-07-28).
487
- */
488
- UnsupportedProtocolVersion = -32004,
489
- UrlElicitationRequired = -32042,
490
- }
491
- //#endregion
492
- //#region ../core-internal/src/types/errors.d.ts
493
- /**
494
- * Protocol errors are JSON-RPC errors that cross the wire as error responses.
495
- * They use numeric error codes from the {@linkcode ProtocolErrorCode} enum.
496
- */
497
- declare class ProtocolError extends Error {
498
- readonly code: number;
499
- readonly data?: unknown | undefined;
500
- constructor(code: number, message: string, data?: unknown | undefined);
501
- /**
502
- * Factory method to create the appropriate error type based on the error code and data
503
- */
504
- static fromError(code: number, message: string, data?: unknown): ProtocolError;
505
- }
506
- /**
507
- * Specialized error type when a tool requires a URL mode elicitation.
508
- * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.
509
- */
510
- declare class UrlElicitationRequiredError extends ProtocolError {
511
- constructor(elicitations: ElicitRequestURLParams[], message?: string);
512
- get elicitations(): ElicitRequestURLParams[];
513
- }
514
- /**
515
- * Error type for the `-32004` UnsupportedProtocolVersion protocol error (protocol
516
- * revision 2026-07-28): the request's protocol version is unknown to the server or
517
- * unsupported by it.
518
- *
519
- * The error data lists the protocol versions the receiver supports (`supported`),
520
- * so the sender can choose a mutually supported version and retry, and echoes the
521
- * version that was requested (`requested`).
522
- */
523
- declare class UnsupportedProtocolVersionError extends ProtocolError {
524
- constructor(data: UnsupportedProtocolVersionErrorData, message?: string);
525
- /**
526
- * Protocol versions the receiver supports.
527
- */
528
- get supported(): string[];
529
- /**
530
- * The protocol version that was requested.
531
- */
532
- get requested(): string;
533
- }
534
- //#endregion
535
- //#region ../core-internal/src/types/guards.d.ts
536
- /**
537
- * Validates and parses an unknown value as a JSON-RPC message.
538
- *
539
- * Use this to validate incoming messages in custom transport implementations.
540
- * Throws if the value does not conform to the JSON-RPC message schema.
541
- *
542
- * @param value - The value to validate (typically a parsed JSON object).
543
- * @returns The validated {@linkcode JSONRPCMessage}.
544
- * @throws If validation fails.
545
- */
546
- declare function parseJSONRPCMessage(value: unknown): JSONRPCMessage;
547
- declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest;
548
- declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification;
549
- /**
550
- * Checks if a value is a valid {@linkcode JSONRPCResultResponse}.
551
- * @param value - The value to check.
552
- *
553
- * @returns True if the value is a valid {@linkcode JSONRPCResultResponse}, false otherwise.
554
- */
555
- declare const isJSONRPCResultResponse: (value: unknown) => value is JSONRPCResultResponse;
556
- /**
557
- * Checks if a value is a valid {@linkcode JSONRPCErrorResponse}.
558
- * @param value - The value to check.
559
- *
560
- * @returns True if the value is a valid {@linkcode JSONRPCErrorResponse}, false otherwise.
561
- */
562
- declare const isJSONRPCErrorResponse: (value: unknown) => value is JSONRPCErrorResponse;
563
- /**
564
- * Checks if a value is a valid {@linkcode JSONRPCResponse} (either a result or error response).
565
- * @param value - The value to check.
566
- *
567
- * @returns True if the value is a valid {@linkcode JSONRPCResponse}, false otherwise.
568
- */
569
- declare const isJSONRPCResponse: (value: unknown) => value is JSONRPCResponse;
570
- /**
571
- * Checks if a value is a valid {@linkcode CallToolResult}.
572
- * @param value - The value to check.
573
- *
574
- * @returns True if the value is a valid {@linkcode CallToolResult}, false otherwise.
575
- */
576
- declare const isCallToolResult: (value: unknown) => value is CallToolResult;
577
- /**
578
- * Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}.
579
- * @param value - The value to check.
580
- *
581
- * @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise.
582
- */
583
- declare const isTaskAugmentedRequestParams: (value: unknown) => value is TaskAugmentedRequestParams;
584
- declare const isInitializeRequest: (value: unknown) => value is InitializeRequest;
585
- declare const isInitializedNotification: (value: unknown) => value is InitializedNotification;
586
- declare function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt;
587
- declare function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate;
588
- //#endregion
589
- //#region ../core-internal/src/util/standardSchema.d.ts
590
- /**
591
- * Standard Schema utilities for user-provided schemas.
592
- * Supports Zod v4, Valibot, ArkType, and other Standard Schema implementations.
593
- * @see https://standardschema.dev
594
- */
595
- interface StandardTypedV1<Input = unknown, Output = Input> {
596
- readonly '~standard': StandardTypedV1.Props<Input, Output>;
597
- }
598
- declare namespace StandardTypedV1 {
599
- interface Props<Input = unknown, Output = Input> {
600
- readonly version: 1;
601
- readonly vendor: string;
602
- readonly types?: Types<Input, Output> | undefined;
603
- }
604
- interface Types<Input = unknown, Output = Input> {
605
- readonly input: Input;
606
- readonly output: Output;
607
- }
608
- type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['input'];
609
- type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['output'];
610
- }
611
- interface StandardSchemaV1<Input = unknown, Output = Input> {
612
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
613
- }
614
- declare namespace StandardSchemaV1 {
615
- interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
616
- readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
617
- }
618
- interface Options {
619
- readonly libraryOptions?: Record<string, unknown> | undefined;
620
- }
621
- type Result<Output> = SuccessResult<Output> | FailureResult;
622
- interface SuccessResult<Output> {
623
- readonly value: Output;
624
- readonly issues?: undefined;
625
- }
626
- interface FailureResult {
627
- readonly issues: ReadonlyArray<Issue>;
628
- }
629
- interface Issue {
630
- readonly message: string;
631
- readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
632
- }
633
- interface PathSegment {
634
- readonly key: PropertyKey;
635
- }
636
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
637
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
638
- }
639
- interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
640
- readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;
641
- }
642
- declare namespace StandardJSONSchemaV1 {
643
- interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
644
- readonly jsonSchema: Converter;
645
- }
646
- interface Converter {
647
- readonly input: (options: Options) => Record<string, unknown>;
648
- readonly output: (options: Options) => Record<string, unknown>;
649
- }
650
- type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | (object & string);
651
- interface Options {
652
- readonly target: Target;
653
- readonly libraryOptions?: Record<string, unknown> | undefined;
654
- }
655
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
656
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
657
- }
658
- /**
659
- * Combined interface for schemas with both validation and JSON Schema conversion —
660
- * the intersection of {@linkcode StandardSchemaV1} and {@linkcode StandardJSONSchemaV1}.
661
- *
662
- * This is the type accepted by `registerTool` / `registerPrompt`. The SDK needs
663
- * `~standard.jsonSchema` to advertise the tool's argument shape in `tools/list`, and
664
- * `~standard.validate` to check incoming arguments when a `tools/call` arrives.
665
- *
666
- * Zod v4, ArkType, and Valibot (via `@valibot/to-json-schema`'s `toStandardJsonSchema`)
667
- * all implement both interfaces.
668
- *
669
- * @see https://standardschema.dev/ for the Standard Schema specification
670
- */
671
- interface StandardSchemaWithJSON<Input = unknown, Output = Input> {
672
- readonly '~standard': StandardSchemaV1.Props<Input, Output> & StandardJSONSchemaV1.Props<Input, Output>;
673
- }
674
- declare namespace StandardSchemaWithJSON {
675
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
676
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
677
- }
678
- /**
679
- * Narrowing of {@linkcode StandardSchemaV1} whose `validate` is guaranteed synchronous.
680
- *
681
- * The Zod schemas backing `specTypeSchemas` contain no async refinements or transforms,
682
- * so every entry satisfies this interface. Consumers can call `validate()` and access
683
- * `.issues` / `.value` on the result without `await`.
684
- *
685
- * `StandardSchemaV1Sync` is assignable to `StandardSchemaV1` — it is a strict subtype.
686
- */
687
- interface StandardSchemaV1Sync<Input = unknown, Output = Input> extends StandardSchemaV1<Input, Output> {
688
- readonly '~standard': StandardSchemaV1Sync.Props<Input, Output>;
689
- }
690
- declare namespace StandardSchemaV1Sync {
691
- interface Props<Input = unknown, Output = Input> extends StandardSchemaV1.Props<Input, Output> {
692
- readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result<Output>;
693
- }
694
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
695
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
696
- }
697
- //#endregion
698
- //#region ../core-internal/src/types/specTypeSchema.d.ts
699
- /**
700
- * Explicit allowlist of protocol Zod schemas that correspond to a public spec type in `types.ts`.
701
- *
702
- * This intentionally excludes internal helper schemas exported from `schemas.ts` that have no
703
- * matching public type (e.g. `ListChangedOptionsBaseSchema`, `BaseRequestParamsSchema`,
704
- * `NotificationsParamsSchema`, `ClientTasksCapabilitySchema`, `ServerTasksCapabilitySchema`).
705
- * Keeping the list explicit means new public spec types must be added here deliberately, and
706
- * internals never leak into `SpecTypeName`.
707
- *
708
- * `ResourceTemplateSchema` is included; its public type is exported as `ResourceTemplateType`
709
- * (the bare name collides with the server package's `ResourceTemplate` class), so
710
- * `SpecTypes['ResourceTemplate']` is structurally equal to `ResourceTemplateType` rather than to
711
- * a type literally named `ResourceTemplate`.
712
- */
713
- declare const SPEC_SCHEMA_KEYS: readonly ["AnnotationsSchema", "AudioContentSchema", "BaseMetadataSchema", "BlobResourceContentsSchema", "BooleanSchemaSchema", "CallToolRequestSchema", "CallToolRequestParamsSchema", "CallToolResultSchema", "CancelledNotificationSchema", "CancelledNotificationParamsSchema", "CancelTaskRequestSchema", "CancelTaskResultSchema", "ClientCapabilitiesSchema", "ClientNotificationSchema", "ClientRequestSchema", "ClientResultSchema", "CompatibilityCallToolResultSchema", "CompleteRequestSchema", "CompleteRequestParamsSchema", "CompleteResultSchema", "ContentBlockSchema", "CreateMessageRequestSchema", "CreateMessageRequestParamsSchema", "CreateMessageResultSchema", "CreateMessageResultWithToolsSchema", "CreateTaskResultSchema", "CursorSchema", "DiscoverRequestSchema", "DiscoverResultSchema", "ElicitationCompleteNotificationSchema", "ElicitationCompleteNotificationParamsSchema", "ElicitRequestSchema", "ElicitRequestFormParamsSchema", "ElicitRequestParamsSchema", "ElicitRequestURLParamsSchema", "ElicitResultSchema", "EmbeddedResourceSchema", "EmptyResultSchema", "EnumSchemaSchema", "GetPromptRequestSchema", "GetPromptRequestParamsSchema", "GetPromptResultSchema", "GetTaskPayloadRequestSchema", "GetTaskPayloadResultSchema", "GetTaskRequestSchema", "GetTaskResultSchema", "IconSchema", "IconsSchema", "ImageContentSchema", "ImplementationSchema", "InitializedNotificationSchema", "InitializeRequestSchema", "InitializeRequestParamsSchema", "InitializeResultSchema", "JSONArraySchema", "JSONObjectSchema", "JSONRPCErrorResponseSchema", "JSONRPCMessageSchema", "JSONRPCNotificationSchema", "JSONRPCRequestSchema", "JSONRPCResponseSchema", "JSONRPCResultResponseSchema", "JSONValueSchema", "LegacyTitledEnumSchemaSchema", "ListPromptsRequestSchema", "ListPromptsResultSchema", "ListResourcesRequestSchema", "ListResourcesResultSchema", "ListResourceTemplatesRequestSchema", "ListResourceTemplatesResultSchema", "ListRootsRequestSchema", "ListRootsResultSchema", "ListTasksRequestSchema", "ListTasksResultSchema", "ListToolsRequestSchema", "ListToolsResultSchema", "LoggingLevelSchema", "LoggingMessageNotificationSchema", "LoggingMessageNotificationParamsSchema", "ModelHintSchema", "ModelPreferencesSchema", "MultiSelectEnumSchemaSchema", "NotificationSchema", "NumberSchemaSchema", "PaginatedRequestSchema", "PaginatedRequestParamsSchema", "PaginatedResultSchema", "PingRequestSchema", "PrimitiveSchemaDefinitionSchema", "ProgressSchema", "ProgressNotificationSchema", "ProgressNotificationParamsSchema", "ProgressTokenSchema", "PromptSchema", "PromptArgumentSchema", "PromptListChangedNotificationSchema", "PromptMessageSchema", "PromptReferenceSchema", "ReadResourceRequestSchema", "ReadResourceRequestParamsSchema", "ReadResourceResultSchema", "RelatedTaskMetadataSchema", "RequestSchema", "RequestIdSchema", "RequestMetaEnvelopeSchema", "RequestMetaSchema", "ResourceSchema", "ResourceContentsSchema", "ResourceLinkSchema", "ResourceListChangedNotificationSchema", "ResourceRequestParamsSchema", "ResourceTemplateSchema", "ResourceTemplateReferenceSchema", "ResourceUpdatedNotificationSchema", "ResourceUpdatedNotificationParamsSchema", "ResultSchema", "RoleSchema", "RootSchema", "RootsListChangedNotificationSchema", "SamplingContentSchema", "SamplingMessageSchema", "SamplingMessageContentBlockSchema", "ServerCapabilitiesSchema", "ServerNotificationSchema", "ServerRequestSchema", "ServerResultSchema", "SetLevelRequestSchema", "SetLevelRequestParamsSchema", "SingleSelectEnumSchemaSchema", "StringSchemaSchema", "SubscribeRequestSchema", "SubscribeRequestParamsSchema", "TaskSchema", "TaskAugmentedRequestParamsSchema", "TaskCreationParamsSchema", "TaskMetadataSchema", "TaskStatusSchema", "TaskStatusNotificationSchema", "TaskStatusNotificationParamsSchema", "TextContentSchema", "TextResourceContentsSchema", "TitledMultiSelectEnumSchemaSchema", "TitledSingleSelectEnumSchemaSchema", "ToolSchema", "ToolAnnotationsSchema", "ToolChoiceSchema", "ToolExecutionSchema", "ToolListChangedNotificationSchema", "ToolResultContentSchema", "ToolUseContentSchema", "UnsubscribeRequestSchema", "UnsubscribeRequestParamsSchema", "UntitledMultiSelectEnumSchemaSchema", "UntitledSingleSelectEnumSchemaSchema"];
714
- declare const authSchemas: {
715
- readonly IdJagTokenExchangeResponseSchema: z.ZodObject<{
716
- issued_token_type: z.ZodLiteral<"urn:ietf:params:oauth:token-type:id-jag">;
717
- access_token: z.ZodString;
718
- token_type: z.ZodOptional<z.ZodString>;
719
- expires_in: z.ZodOptional<z.ZodNumber>;
720
- scope: z.ZodOptional<z.ZodString>;
721
- }, z.core.$strip>;
722
- readonly OAuthClientInformationFullSchema: z.ZodObject<{
723
- redirect_uris: z.ZodArray<z.ZodURL>;
724
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
725
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
726
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
727
- client_name: z.ZodOptional<z.ZodString>;
728
- client_uri: z.ZodOptional<z.ZodURL>;
729
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
730
- scope: z.ZodOptional<z.ZodString>;
731
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
732
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
733
- policy_uri: z.ZodOptional<z.ZodString>;
734
- jwks_uri: z.ZodOptional<z.ZodURL>;
735
- jwks: z.ZodOptional<z.ZodAny>;
736
- software_id: z.ZodOptional<z.ZodString>;
737
- software_version: z.ZodOptional<z.ZodString>;
738
- software_statement: z.ZodOptional<z.ZodString>;
739
- client_id: z.ZodString;
740
- client_secret: z.ZodOptional<z.ZodString>;
741
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
742
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
743
- }, z.core.$strip>;
744
- readonly OAuthClientInformationSchema: z.ZodObject<{
745
- client_id: z.ZodString;
746
- client_secret: z.ZodOptional<z.ZodString>;
747
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
748
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
749
- }, z.core.$strip>;
750
- readonly OAuthClientMetadataSchema: z.ZodObject<{
751
- redirect_uris: z.ZodArray<z.ZodURL>;
752
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
753
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
754
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
755
- client_name: z.ZodOptional<z.ZodString>;
756
- client_uri: z.ZodOptional<z.ZodURL>;
757
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
758
- scope: z.ZodOptional<z.ZodString>;
759
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
760
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
761
- policy_uri: z.ZodOptional<z.ZodString>;
762
- jwks_uri: z.ZodOptional<z.ZodURL>;
763
- jwks: z.ZodOptional<z.ZodAny>;
764
- software_id: z.ZodOptional<z.ZodString>;
765
- software_version: z.ZodOptional<z.ZodString>;
766
- software_statement: z.ZodOptional<z.ZodString>;
767
- }, z.core.$strip>;
768
- readonly OAuthClientRegistrationErrorSchema: z.ZodObject<{
769
- error: z.ZodString;
770
- error_description: z.ZodOptional<z.ZodString>;
771
- }, z.core.$strip>;
772
- readonly OAuthErrorResponseSchema: z.ZodObject<{
773
- error: z.ZodString;
774
- error_description: z.ZodOptional<z.ZodString>;
775
- error_uri: z.ZodOptional<z.ZodString>;
776
- }, z.core.$strip>;
777
- readonly OAuthMetadataSchema: z.ZodObject<{
778
- issuer: z.ZodString;
779
- authorization_endpoint: z.ZodURL;
780
- token_endpoint: z.ZodURL;
781
- registration_endpoint: z.ZodOptional<z.ZodURL>;
782
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
783
- response_types_supported: z.ZodArray<z.ZodString>;
784
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
785
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
786
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
787
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
788
- service_documentation: z.ZodOptional<z.ZodURL>;
789
- revocation_endpoint: z.ZodOptional<z.ZodURL>;
790
- revocation_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
791
- revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
792
- introspection_endpoint: z.ZodOptional<z.ZodString>;
793
- introspection_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
794
- introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
795
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
796
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
797
- }, z.core.$loose>;
798
- readonly OAuthProtectedResourceMetadataSchema: z.ZodObject<{
799
- resource: z.ZodString;
800
- authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
801
- jwks_uri: z.ZodOptional<z.ZodString>;
802
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
803
- bearer_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
804
- resource_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
805
- resource_name: z.ZodOptional<z.ZodString>;
806
- resource_documentation: z.ZodOptional<z.ZodString>;
807
- resource_policy_uri: z.ZodOptional<z.ZodString>;
808
- resource_tos_uri: z.ZodOptional<z.ZodString>;
809
- tls_client_certificate_bound_access_tokens: z.ZodOptional<z.ZodBoolean>;
810
- authorization_details_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
811
- dpop_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
812
- dpop_bound_access_tokens_required: z.ZodOptional<z.ZodBoolean>;
813
- }, z.core.$loose>;
814
- readonly OAuthTokenRevocationRequestSchema: z.ZodObject<{
815
- token: z.ZodString;
816
- token_type_hint: z.ZodOptional<z.ZodString>;
817
- }, z.core.$strip>;
818
- readonly OAuthTokensSchema: z.ZodObject<{
819
- access_token: z.ZodString;
820
- id_token: z.ZodOptional<z.ZodString>;
821
- token_type: z.ZodString;
822
- expires_in: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
823
- scope: z.ZodOptional<z.ZodString>;
824
- refresh_token: z.ZodOptional<z.ZodString>;
825
- }, z.core.$strip>;
826
- readonly OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
827
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
828
- issuer: z.ZodString;
829
- authorization_endpoint: z.ZodURL;
830
- token_endpoint: z.ZodURL;
831
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
832
- jwks_uri: z.ZodURL;
833
- registration_endpoint: z.ZodOptional<z.ZodURL>;
834
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
835
- response_types_supported: z.ZodArray<z.ZodString>;
836
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
837
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
838
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
839
- subject_types_supported: z.ZodArray<z.ZodString>;
840
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
841
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
842
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
843
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
844
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
845
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
846
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
847
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
848
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
849
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
850
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
851
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
852
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
853
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
854
- service_documentation: z.ZodOptional<z.ZodString>;
855
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
856
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
857
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
858
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
859
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
860
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
861
- op_policy_uri: z.ZodOptional<z.ZodURL>;
862
- op_tos_uri: z.ZodOptional<z.ZodURL>;
863
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
864
- }, z.core.$strip>;
865
- readonly OpenIdProviderMetadataSchema: z.ZodObject<{
866
- issuer: z.ZodString;
867
- authorization_endpoint: z.ZodURL;
868
- token_endpoint: z.ZodURL;
869
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
870
- jwks_uri: z.ZodURL;
871
- registration_endpoint: z.ZodOptional<z.ZodURL>;
872
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
873
- response_types_supported: z.ZodArray<z.ZodString>;
874
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
875
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
876
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
877
- subject_types_supported: z.ZodArray<z.ZodString>;
878
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
879
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
880
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
881
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
882
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
883
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
884
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
885
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
886
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
887
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
888
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
889
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
890
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
891
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
892
- service_documentation: z.ZodOptional<z.ZodString>;
893
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
894
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
895
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
896
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
897
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
898
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
899
- op_policy_uri: z.ZodOptional<z.ZodURL>;
900
- op_tos_uri: z.ZodOptional<z.ZodURL>;
901
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
902
- }, z.core.$loose>;
903
- };
904
- type ProtocolSchemaKey = (typeof SPEC_SCHEMA_KEYS)[number];
905
- type AuthSchemaKey = keyof typeof authSchemas;
906
- type SchemaKey = ProtocolSchemaKey | AuthSchemaKey;
907
- type SchemaFor<K$1 extends SchemaKey> = K$1 extends ProtocolSchemaKey ? (typeof schemas_d_exports)[K$1] : K$1 extends AuthSchemaKey ? (typeof authSchemas)[K$1] : never;
908
- type StripSchemaSuffix<K$1> = K$1 extends `${infer N}Schema` ? N : never;
909
- /**
910
- * Union of every named type in the SDK's protocol and OAuth schemas (e.g. `'CallToolResult'`,
911
- * `'ContentBlock'`, `'Tool'`, `'OAuthTokens'`). Derived from the internal Zod schemas, so it stays
912
- * in sync with the spec.
913
- */
914
- type SpecTypeName = StripSchemaSuffix<SchemaKey>;
915
- /**
916
- * Maps each {@linkcode SpecTypeName} to its TypeScript type.
917
- *
918
- * `SpecTypes['CallToolResult']` is equivalent to importing the `CallToolResult` type directly.
919
- */
920
- type SpecTypes = { [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.output<SchemaFor<K>> : never };
921
- /**
922
- * Input shape for each {@linkcode SpecTypeName}. For most types this equals {@linkcode SpecTypes},
923
- * but a few schemas apply defaults/preprocessing, so the accepted input may be looser than the
924
- * resulting output type.
925
- */
926
- type SpecTypeInputs = { [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.input<SchemaFor<K>> : never };
927
- type SchemaRecord = { readonly [K in SpecTypeName]: StandardSchemaV1Sync<SpecTypeInputs[K], SpecTypes[K]> };
928
- type GuardRecord = { readonly [K in SpecTypeName]: (value: unknown) => value is SpecTypeInputs[K] };
929
- /**
930
- * Runtime validators for every MCP spec type, keyed by type name.
931
- *
932
- * Use this when you need to validate a spec-defined shape at a boundary the SDK does not own, for
933
- * example an extension's custom-method payload that embeds a `CallToolResult`, or a value read from
934
- * storage that should be a `Tool`.
935
- *
936
- * Each entry implements the Standard Schema interface, so it composes with any
937
- * Standard-Schema-aware library. For a simple boolean check, use {@linkcode isSpecType} instead.
938
- *
939
- * @example
940
- * ```ts source="./specTypeSchema.examples.ts#specTypeSchemas_basicUsage"
941
- * const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted);
942
- * if (result.issues === undefined) {
943
- * // result.value is CallToolResult
944
- * }
945
- * ```
946
- */
947
- declare const specTypeSchemas: SchemaRecord;
948
- /**
949
- * Type predicates for every MCP spec type, keyed by type name.
950
- *
951
- * Returns `true` if the value satisfies the schema's input type (`z.input<>`, before defaults and
952
- * transforms are applied), and narrows to that input type. For schemas with `.default()` or
953
- * `.preprocess()`, this may accept values that do not structurally match the named output type;
954
- * for example `isSpecType.CallToolResult({})` is `true` because `content` has a default. Use
955
- * `specTypeSchemas.X['~standard'].validate(value)` when you need the validated output value.
956
- *
957
- * Each guard is a standalone function, so it can be passed directly as a callback.
958
- *
959
- * @example
960
- * ```ts source="./specTypeSchema.examples.ts#isSpecType_basicUsage"
961
- * if (isSpecType.ContentBlock(value)) {
962
- * // value is ContentBlock
963
- * }
964
- *
965
- * const blocks = mixed.filter(isSpecType.ContentBlock);
966
- * ```
967
- */
968
- declare const isSpecType: GuardRecord;
969
- //#endregion
970
- //#region ../core-internal/src/shared/metadataUtils.d.ts
971
- /**
972
- * Utilities for working with {@linkcode BaseMetadata} objects.
973
- */
974
- /**
975
- * Gets the display name for an object with {@linkcode BaseMetadata}.
976
- * For tools, the precedence is: `title` → {@linkcode index.ToolAnnotations | annotations}.`title` → `name`
977
- * For other objects: `title` → `name`
978
- * This implements the spec requirement: "if no title is provided, name should be used for display purposes"
979
- */
980
- declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & {
981
- annotations?: {
982
- title?: string;
983
- };
984
- })): string;
985
- //#endregion
986
- //#region ../core-internal/src/shared/protocol.d.ts
987
- /**
988
- * Callback for progress notifications.
989
- */
990
- type ProgressCallback = (progress: Progress) => void;
991
- /**
992
- * Additional initialization options.
993
- */
994
- type ProtocolOptions = {
995
- /**
996
- * Protocol versions supported. First version is preferred (sent by client,
997
- * used as fallback by server). Passed to transport during {@linkcode Protocol.connect | connect()}.
998
- *
999
- * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS}
1000
- */
1001
- supportedProtocolVersions?: string[];
1002
- /**
1003
- * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.
1004
- *
1005
- * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those.
1006
- *
1007
- * Currently this defaults to `false`, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to `true`.
1008
- */
1009
- enforceStrictCapabilities?: boolean;
1010
- /**
1011
- * An array of notification method names that should be automatically debounced.
1012
- * Any notifications with a method in this list will be coalesced if they
1013
- * occur in the same tick of the event loop.
1014
- * e.g., `['notifications/tools/list_changed']`
1015
- */
1016
- debouncedNotificationMethods?: string[];
1017
- };
1018
- /**
1019
- * The default request timeout, in milliseconds.
1020
- */
1021
- declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
1022
- /**
1023
- * Options that can be given per request.
1024
- */
1025
- type RequestOptions = {
1026
- /**
1027
- * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
1028
- */
1029
- onprogress?: ProgressCallback;
1030
- /**
1031
- * Can be used to cancel an in-flight request. This will cause an `AbortError` to be raised from {@linkcode Protocol.request | request()}.
1032
- */
1033
- signal?: AbortSignal;
1034
- /**
1035
- * A timeout (in milliseconds) for this request. If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised from {@linkcode Protocol.request | request()}.
1036
- *
1037
- * If not specified, {@linkcode DEFAULT_REQUEST_TIMEOUT_MSEC} will be used as the timeout.
1038
- */
1039
- timeout?: number;
1040
- /**
1041
- * If `true`, receiving a progress notification will reset the request timeout.
1042
- * This is useful for long-running operations that send periodic progress updates.
1043
- * Default: `false`
1044
- */
1045
- resetTimeoutOnProgress?: boolean;
1046
- /**
1047
- * Maximum total time (in milliseconds) to wait for a response.
1048
- * If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised, regardless of progress notifications.
1049
- * If not specified, there is no maximum total timeout.
1050
- */
1051
- maxTotalTimeout?: number;
1052
- } & TransportSendOptions;
1053
- /**
1054
- * Options that can be given per notification.
1055
- */
1056
- type NotificationOptions = {
1057
- /**
1058
- * May be used to indicate to the transport which incoming request to associate this outgoing notification with.
1059
- */
1060
- relatedRequestId?: RequestId;
1061
- };
1062
- /**
1063
- * Base context provided to all request handlers.
1064
- */
1065
- type BaseContext = {
1066
- /**
1067
- * The session ID from the transport, if available.
1068
- */
1069
- sessionId?: string;
1070
- /**
1071
- * Information about the MCP request being handled.
1072
- */
1073
- mcpReq: {
1074
- /**
1075
- * The JSON-RPC ID of the request being handled.
1076
- */
1077
- id: RequestId;
1078
- /**
1079
- * The method name of the request (e.g., 'tools/call', 'ping').
1080
- */
1081
- method: string;
1082
- /**
1083
- * Metadata from the original request.
1084
- */
1085
- _meta?: RequestMeta;
1086
- /**
1087
- * An abort signal used to communicate if the request was cancelled from the sender's side.
1088
- */
1089
- signal: AbortSignal;
1090
- /**
1091
- * Sends a request that relates to the current request being handled.
1092
- *
1093
- * This is used by certain transports to correctly associate related messages.
1094
- *
1095
- * For spec methods the result type is inferred from the method name.
1096
- * For custom (non-spec) methods, pass a result schema as the second argument.
1097
- */
1098
- send: {
1099
- <M extends RequestMethod>(request: {
1100
- method: M;
1101
- params?: Record<string, unknown>;
1102
- }, options?: RequestOptions): Promise<ResultTypeMap[M]>;
1103
- <T extends StandardSchemaV1>(request: Request$1, resultSchema: T, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T>>;
1104
- };
1105
- /**
1106
- * Sends a notification that relates to the current request being handled.
1107
- *
1108
- * This is used by certain transports to correctly associate related messages.
1109
- */
1110
- notify: (notification: Notification) => Promise<void>;
1111
- };
1112
- /**
1113
- * HTTP transport information, only available when using an HTTP-based transport.
1114
- */
1115
- http?: {
1116
- /**
1117
- * Information about a validated access token, provided to request handlers.
1118
- */
1119
- authInfo?: AuthInfo;
1120
- };
1121
- };
1122
- /**
1123
- * Context provided to server-side request handlers, extending {@linkcode BaseContext} with server-specific fields.
1124
- */
1125
- type ServerContext = BaseContext & {
1126
- mcpReq: {
1127
- /**
1128
- * Send a log message notification to the client.
1129
- * Respects the client's log level filter set via logging/setLevel.
1130
- *
1131
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1132
- * Remains functional during the deprecation window (at least twelve months).
1133
- * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
1134
- */
1135
- log: (level: LoggingLevel, data: unknown, logger?: string) => Promise<void>;
1136
- /**
1137
- * Send an elicitation request to the client, requesting user input.
1138
- */
1139
- elicitInput: (params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions) => Promise<ElicitResult>;
1140
- /**
1141
- * Request LLM sampling from the client.
1142
- *
1143
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1144
- * Remains functional during the deprecation window (at least twelve months).
1145
- * Migrate to calling LLM provider APIs directly.
1146
- */
1147
- requestSampling: (params: CreateMessageRequest['params'], options?: RequestOptions) => Promise<CreateMessageResult | CreateMessageResultWithTools>;
1148
- };
1149
- http?: {
1150
- /**
1151
- * The original HTTP request.
1152
- */
1153
- req?: globalThis.Request;
1154
- /**
1155
- * Closes the SSE stream for this request, triggering client reconnection.
1156
- * Only available when using a StreamableHTTPServerTransport with eventStore configured.
1157
- */
1158
- closeSSE?: () => void;
1159
- /**
1160
- * Closes the standalone GET SSE stream, triggering client reconnection.
1161
- * Only available when using a StreamableHTTPServerTransport with eventStore configured.
1162
- */
1163
- closeStandaloneSSE?: () => void;
1164
- };
1165
- };
1166
- /**
1167
- * Context provided to client-side request handlers.
1168
- */
1169
- type ClientContext = BaseContext;
1170
- /**
1171
- * Implements MCP protocol framing on top of a pluggable transport, including
1172
- * features like request/response linking, notifications, and progress.
1173
- *
1174
- * `Protocol` is abstract; `Client` and `Server` are the concrete role-specific
1175
- * implementations most code should use.
1176
- */
1177
- declare abstract class Protocol<ContextT extends BaseContext> {
1178
- private _options?;
1179
- private _transport?;
1180
- private _requestMessageId;
1181
- private _requestHandlers;
1182
- private _requestHandlerAbortControllers;
1183
- private _notificationHandlers;
1184
- private _responseHandlers;
1185
- private _progressHandlers;
1186
- private _timeoutInfo;
1187
- private _pendingDebouncedNotifications;
1188
- protected _supportedProtocolVersions: string[];
1189
- /**
1190
- * Callback for when the connection is closed for any reason.
1191
- *
1192
- * This is invoked when {@linkcode Protocol.close | close()} is called as well.
1193
- */
1194
- onclose?: () => void;
1195
- /**
1196
- * Callback for when an error occurs.
1197
- *
1198
- * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
1199
- */
1200
- onerror?: (error: Error) => void;
1201
- /**
1202
- * A handler to invoke for any request types that do not have their own handler installed.
1203
- */
1204
- fallbackRequestHandler?: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>;
1205
- /**
1206
- * A handler to invoke for any notification types that do not have their own handler installed.
1207
- */
1208
- fallbackNotificationHandler?: (notification: Notification) => Promise<void>;
1209
- constructor(_options?: ProtocolOptions | undefined);
1210
- /**
1211
- * Builds the context object for request handlers. Subclasses must override
1212
- * to return the appropriate context type (e.g., ServerContext adds HTTP request info).
1213
- */
1214
- protected abstract buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ContextT;
1215
- private _oncancel;
1216
- private _setupTimeout;
1217
- private _resetTimeout;
1218
- private _cleanupTimeout;
1219
- /**
1220
- * Attaches to the given transport, starts it, and starts listening for messages.
1221
- *
1222
- * The caller assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.
1223
- */
1224
- connect(transport: Transport): Promise<void>;
1225
- private _onclose;
1226
- private _onerror;
1227
- private _onnotification;
1228
- private _onrequest;
1229
- private _onprogress;
1230
- private _onresponse;
1231
- get transport(): Transport | undefined;
1232
- /**
1233
- * Closes the connection.
1234
- */
1235
- close(): Promise<void>;
1236
- /**
1237
- * A method to check if a capability is supported by the remote side, for the given method to be called.
1238
- *
1239
- * This should be implemented by subclasses.
1240
- */
1241
- protected abstract assertCapabilityForMethod(method: RequestMethod | string): void;
1242
- /**
1243
- * A method to check if a notification is supported by the local side, for the given method to be sent.
1244
- *
1245
- * This should be implemented by subclasses.
1246
- */
1247
- protected abstract assertNotificationCapability(method: NotificationMethod | string): void;
1248
- /**
1249
- * A method to check if a request handler is supported by the local side, for the given method to be handled.
1250
- *
1251
- * This should be implemented by subclasses.
1252
- */
1253
- protected abstract assertRequestHandlerCapability(method: string): void;
1254
- /**
1255
- * Sends a request and waits for a response.
1256
- *
1257
- * For spec methods the result schema is resolved automatically from the method name
1258
- * and the return type is method-keyed. For custom (non-spec) methods, pass a
1259
- * `resultSchema` as the second argument; the response is validated against it and
1260
- * the return type is inferred from the schema.
1261
- *
1262
- * Do not use this method to emit notifications! Use {@linkcode Protocol.notification | notification()} instead.
1263
- */
1264
- request<M extends RequestMethod>(request: {
1265
- method: M;
1266
- params?: Record<string, unknown>;
1267
- }, options?: RequestOptions): Promise<ResultTypeMap[M]>;
1268
- request<T extends StandardSchemaV1>(request: Request$1, resultSchema: T, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T>>;
1269
- /**
1270
- * Sends a request and waits for a response, using the provided schema for validation.
1271
- *
1272
- * This is the internal implementation used by SDK methods that need to specify
1273
- * a particular result schema (e.g., for compatibility schemas).
1274
- */
1275
- protected _requestWithSchema<T extends StandardSchemaV1>(request: Request$1, resultSchema: T, options?: RequestOptions): Promise<StandardSchemaV1.InferOutput<T>>;
1276
- /**
1277
- * Emits a notification, which is a one-way message that does not expect a response.
1278
- */
1279
- notification(notification: Notification, options?: NotificationOptions): Promise<void>;
1280
- /**
1281
- * Registers a handler to invoke when this protocol object receives a request with the given method.
1282
- *
1283
- * Note that this will replace any previous request handler for the same method.
1284
- *
1285
- * For spec methods, pass `(method, handler)`; the request is parsed with the spec
1286
- * schema and the handler receives the typed `Request`. For custom (non-spec)
1287
- * methods, pass `(method, schemas, handler)`; `params` are validated against
1288
- * `schemas.params` and the handler receives the parsed params object directly.
1289
- * Supplying `schemas.result` types the handler's return value.
1290
- *
1291
- * @example Custom request method
1292
- * ```ts source="./protocol.examples.ts#Protocol_setRequestHandler_customMethod"
1293
- * const SearchParams = z.object({ query: z.string(), limit: z.number().optional() });
1294
- * const SearchResult = z.object({ hits: z.array(z.string()) });
1295
- *
1296
- * protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => {
1297
- * return { hits: [`result for ${params.query}`] };
1298
- * });
1299
- * ```
1300
- */
1301
- setRequestHandler<M extends RequestMethod>(method: M, handler: (request: RequestTypeMap[M], ctx: ContextT) => ResultTypeMap[M] | Promise<ResultTypeMap[M]>): void;
1302
- setRequestHandler<P extends StandardSchemaV1, R extends StandardSchemaV1 | undefined = undefined>(method: string, schemas: {
1303
- params: P;
1304
- result?: R;
1305
- }, handler: (params: StandardSchemaV1.InferOutput<P>, ctx: ContextT) => InferHandlerResult<R> | Promise<InferHandlerResult<R>>): void;
1306
- /**
1307
- * Hook for subclasses to wrap a registered request handler with role-specific
1308
- * validation or behavior (e.g. `Server` validates `tools/call` results, `Client`
1309
- * validates `elicitation/create` mode and result). Runs for both the 2-arg and
1310
- * 3-arg registration paths. The default implementation is identity.
1311
- *
1312
- * Subclasses overriding this hook avoid redeclaring `setRequestHandler`'s overload set.
1313
- */
1314
- protected _wrapHandler(_method: string, handler: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>): (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>;
1315
- /**
1316
- * Removes the request handler for the given method.
1317
- */
1318
- removeRequestHandler(method: RequestMethod | string): void;
1319
- /**
1320
- * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
1321
- */
1322
- assertCanSetRequestHandler(method: RequestMethod | string): void;
1323
- /**
1324
- * Registers a handler to invoke when this protocol object receives a notification with the given method.
1325
- *
1326
- * Note that this will replace any previous notification handler for the same method.
1327
- *
1328
- * For spec methods, pass `(method, handler)`; the notification is parsed with the
1329
- * spec schema. For custom (non-spec) methods, pass `(method, schemas, handler)`;
1330
- * `params` are validated against `schemas.params` and the handler receives the
1331
- * parsed params object directly. The raw notification is passed as the second
1332
- * argument; `_meta` is recoverable via `notification.params?._meta`.
1333
- */
1334
- setNotificationHandler<M extends NotificationMethod>(method: M, handler: (notification: NotificationTypeMap[M]) => void | Promise<void>): void;
1335
- setNotificationHandler<P extends StandardSchemaV1>(method: string, schemas: {
1336
- params: P;
1337
- }, handler: (params: StandardSchemaV1.InferOutput<P>, notification: Notification) => void | Promise<void>): void;
1338
- /**
1339
- * Removes the notification handler for the given method.
1340
- */
1341
- removeNotificationHandler(method: NotificationMethod | string): void;
1342
- }
1343
- /**
1344
- * Schema bundle accepted by {@linkcode Protocol.setRequestHandler | setRequestHandler}'s 3-arg form.
1345
- *
1346
- * `params` is required and validates the inbound `request.params`. `result` is optional;
1347
- * when supplied it types the handler's return value (no runtime validation is performed
1348
- * on the result).
1349
- */
1350
- interface RequestHandlerSchemas<P extends StandardSchemaV1 = StandardSchemaV1, R extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined> {
1351
- params: P;
1352
- result?: R;
1353
- }
1354
- type InferHandlerResult<R extends StandardSchemaV1 | undefined> = R extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<R> : Result$1;
1355
- //#endregion
1356
- //#region ../core-internal/src/shared/stdio.d.ts
1357
- declare const STDIO_DEFAULT_MAX_BUFFER_SIZE: number;
1358
- /**
1359
- * Buffers a continuous stdio stream into discrete JSON-RPC messages.
1360
- */
1361
- declare class ReadBuffer {
1362
- private _buffer?;
1363
- private _maxBufferSize;
1364
- constructor(options?: {
1365
- maxBufferSize?: number;
1366
- });
1367
- append(chunk: Buffer): void;
1368
- readMessage(): JSONRPCMessage | null;
1369
- clear(): void;
1370
- }
1371
- declare function deserializeMessage(line: string): JSONRPCMessage;
1372
- declare function serializeMessage(message: JSONRPCMessage): string;
1373
- //#endregion
1374
- //#region ../core-internal/src/shared/uriTemplate.d.ts
1375
- type Variables = Record<string, string | string[]>;
1376
- declare class UriTemplate {
1377
- /**
1378
- * Returns true if the given string contains any URI template expressions.
1379
- * A template expression is a sequence of characters enclosed in curly braces,
1380
- * like `{foo}` or `{?bar}`.
1381
- */
1382
- static isTemplate(str: string): boolean;
1383
- private static validateLength;
1384
- private readonly template;
1385
- private readonly parts;
1386
- get variableNames(): string[];
1387
- constructor(template: string);
1388
- toString(): string;
1389
- private parse;
1390
- private getOperator;
1391
- private getNames;
1392
- private encodeValue;
1393
- private expandPart;
1394
- expand(variables: Variables): string;
1395
- private escapeRegExp;
1396
- private partToRegExp;
1397
- match(uri: string): Variables | null;
1398
- }
1399
- //#endregion
1400
- //#region ../core-internal/src/util/inMemory.d.ts
1401
- /**
1402
- * In-memory transport for creating clients and servers that talk to each other within the same process.
1403
- *
1404
- * Intended for testing and development. For production in-process connections, use
1405
- * `StreamableHTTPClientTransport` against a local server URL.
1406
- */
1407
- declare class InMemoryTransport implements Transport {
1408
- private _otherTransport?;
1409
- private _messageQueue;
1410
- private _closed;
1411
- onclose?: () => void;
1412
- onerror?: (error: Error) => void;
1413
- onmessage?: (message: JSONRPCMessage, extra?: {
1414
- authInfo?: AuthInfo;
1415
- }) => void;
1416
- sessionId?: string;
1417
- /**
1418
- * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a {@linkcode @modelcontextprotocol/client!client/client.Client | Client} and one to a {@linkcode @modelcontextprotocol/server!server/server.Server | Server}.
1419
- */
1420
- static createLinkedPair(): [InMemoryTransport, InMemoryTransport];
1421
- start(): Promise<void>;
1422
- close(): Promise<void>;
1423
- /**
1424
- * Sends a message with optional auth info.
1425
- * This is useful for testing authentication scenarios.
1426
- */
1427
- send(message: JSONRPCMessage, options?: {
1428
- relatedRequestId?: RequestId;
1429
- authInfo?: AuthInfo;
1430
- }): Promise<void>;
1431
- }
1432
- //#endregion
1433
6
  //#region src/server/completable.d.ts
1434
7
  declare const COMPLETABLE_SYMBOL: unique symbol;
1435
8
  type CompleteCallback<T extends StandardSchemaV1 = StandardSchemaV1> = (value: StandardSchemaV1.InferInput<T>, context?: {
@@ -1478,589 +51,6 @@ declare function completable<T extends StandardSchemaV1>(schema: T, complete: Co
1478
51
  */
1479
52
  declare function isCompletable(schema: unknown): schema is CompletableSchema<StandardSchemaV1>;
1480
53
  //#endregion
1481
- //#region src/server/server.d.ts
1482
- type ServerOptions = ProtocolOptions & {
1483
- /**
1484
- * Capabilities to advertise as being supported by this server.
1485
- *
1486
- * Note: per the MCP spec, a server that declares a capability MUST respond to that
1487
- * capability's requests (e.g. `tools/list` for `tools`) — potentially with an empty
1488
- * result — rather than with a "Method not found" error. {@linkcode server/mcp.McpServer | McpServer}
1489
- * handles this automatically for capabilities declared here; when using the low-level
1490
- * {@linkcode Server} directly, you are responsible for registering a request handler for
1491
- * every capability you declare.
1492
- */
1493
- capabilities?: ServerCapabilities;
1494
- /**
1495
- * Optional instructions describing how to use the server and its features.
1496
- */
1497
- instructions?: string;
1498
- /**
1499
- * JSON Schema validator for elicitation response validation.
1500
- *
1501
- * The validator is used to validate user input returned from elicitation
1502
- * requests against the requested schema.
1503
- *
1504
- * @default Runtime-selected validator (AJV-backed on Node.js, `@cfworker/json-schema`-backed on browser/workerd runtimes)
1505
- */
1506
- jsonSchemaValidator?: jsonSchemaValidator;
1507
- };
1508
- /**
1509
- * An MCP server on top of a pluggable transport.
1510
- *
1511
- * This server will automatically respond to the initialization flow as initiated from the client.
1512
- *
1513
- * @deprecated Use {@linkcode server/mcp.McpServer | McpServer} instead for the high-level API. Only use `Server` for advanced use cases.
1514
- */
1515
- declare class Server extends Protocol<ServerContext> {
1516
- private _serverInfo;
1517
- private _clientCapabilities?;
1518
- private _clientVersion?;
1519
- private _negotiatedProtocolVersion?;
1520
- private _capabilities;
1521
- private _instructions?;
1522
- private _jsonSchemaValidator;
1523
- /**
1524
- * Callback for when initialization has fully completed (i.e., the client has sent an `notifications/initialized` notification).
1525
- */
1526
- oninitialized?: () => void;
1527
- /**
1528
- * Initializes this server with the given name and version information.
1529
- */
1530
- constructor(_serverInfo: Implementation, options?: ServerOptions);
1531
- /**
1532
- * Registers the built-in `logging/setLevel` request handler.
1533
- *
1534
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1535
- * Remains functional during the deprecation window (at least twelve months).
1536
- * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
1537
- */
1538
- private _registerLoggingHandler;
1539
- protected buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ServerContext;
1540
- private _loggingLevels;
1541
- private readonly LOG_LEVEL_SEVERITY;
1542
- private isMessageIgnored;
1543
- /**
1544
- * Registers new capabilities. This can only be called before connecting to a transport.
1545
- *
1546
- * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization).
1547
- */
1548
- registerCapabilities(capabilities: ServerCapabilities): void;
1549
- /**
1550
- * Enforces server-side validation for `tools/call` results regardless of how the
1551
- * handler was registered.
1552
- */
1553
- protected _wrapHandler(method: string, handler: (request: JSONRPCRequest, ctx: ServerContext) => Promise<Result$1>): (request: JSONRPCRequest, ctx: ServerContext) => Promise<Result$1>;
1554
- protected assertCapabilityForMethod(method: RequestMethod | string): void;
1555
- protected assertNotificationCapability(method: NotificationMethod | string): void;
1556
- protected assertRequestHandlerCapability(method: string): void;
1557
- private _oninitialize;
1558
- /**
1559
- * After initialization has completed, this will be populated with the client's reported capabilities.
1560
- */
1561
- getClientCapabilities(): ClientCapabilities | undefined;
1562
- /**
1563
- * After initialization has completed, this will be populated with information about the client's name and version.
1564
- */
1565
- getClientVersion(): Implementation | undefined;
1566
- /**
1567
- * After initialization has completed, this will be populated with the protocol version negotiated
1568
- * with the client (the version the server responded with during the initialize handshake), or
1569
- * `undefined` before initialization.
1570
- */
1571
- getNegotiatedProtocolVersion(): string | undefined;
1572
- /**
1573
- * Returns the current server capabilities.
1574
- */
1575
- getCapabilities(): ServerCapabilities;
1576
- ping(): Promise<{
1577
- _meta?: {
1578
- [x: string]: unknown;
1579
- progressToken?: string | number | undefined;
1580
- "io.modelcontextprotocol/related-task"?: {
1581
- taskId: string;
1582
- } | undefined;
1583
- } | undefined;
1584
- resultType?: string | undefined;
1585
- }>;
1586
- /**
1587
- * Request LLM sampling from the client (without tools).
1588
- * Returns single content block for backwards compatibility.
1589
- *
1590
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1591
- * Remains functional during the deprecation window (at least twelve months).
1592
- * Migrate to calling LLM provider APIs directly.
1593
- */
1594
- createMessage(params: CreateMessageRequestParamsBase, options?: RequestOptions): Promise<CreateMessageResult>;
1595
- /**
1596
- * Request LLM sampling from the client with tool support.
1597
- * Returns content that may be a single block or array (for parallel tool calls).
1598
- *
1599
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1600
- * Remains functional during the deprecation window (at least twelve months).
1601
- * Migrate to calling LLM provider APIs directly.
1602
- */
1603
- createMessage(params: CreateMessageRequestParamsWithTools, options?: RequestOptions): Promise<CreateMessageResultWithTools>;
1604
- /**
1605
- * Request LLM sampling from the client.
1606
- * When tools may or may not be present, returns the union type.
1607
- *
1608
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1609
- * Remains functional during the deprecation window (at least twelve months).
1610
- * Migrate to calling LLM provider APIs directly.
1611
- */
1612
- createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise<CreateMessageResult | CreateMessageResultWithTools>;
1613
- /**
1614
- * Creates an elicitation request for the given parameters.
1615
- * For backwards compatibility, `mode` may be omitted for form requests and will default to `"form"`.
1616
- * @param params The parameters for the elicitation request.
1617
- * @param options Optional request options.
1618
- * @returns The result of the elicitation request.
1619
- */
1620
- elicitInput(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): Promise<ElicitResult>;
1621
- /**
1622
- * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete`
1623
- * notification for the specified elicitation ID.
1624
- *
1625
- * @param elicitationId The ID of the elicitation to mark as complete.
1626
- * @param options Optional notification options. Useful when the completion notification should be related to a prior request.
1627
- * @returns A function that emits the completion notification when awaited.
1628
- */
1629
- createElicitationCompletionNotifier(elicitationId: string, options?: NotificationOptions): () => Promise<void>;
1630
- /**
1631
- * Requests the list of roots from the client.
1632
- *
1633
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1634
- * Remains functional during the deprecation window (at least twelve months).
1635
- * Migrate to passing paths via tool parameters, resource URIs, or configuration.
1636
- */
1637
- listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<{
1638
- [x: string]: unknown;
1639
- roots: {
1640
- uri: string;
1641
- name?: string | undefined;
1642
- _meta?: Record<string, unknown> | undefined;
1643
- }[];
1644
- _meta?: {
1645
- [x: string]: unknown;
1646
- progressToken?: string | number | undefined;
1647
- "io.modelcontextprotocol/related-task"?: {
1648
- taskId: string;
1649
- } | undefined;
1650
- } | undefined;
1651
- resultType?: string | undefined;
1652
- }>;
1653
- /**
1654
- * Sends a logging message to the client, if connected.
1655
- * Note: You only need to send the parameters object, not the entire JSON-RPC message.
1656
- * @see {@linkcode LoggingMessageNotification}
1657
- * @param params
1658
- * @param sessionId Optional for stateless transports and backward compatibility.
1659
- *
1660
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1661
- * Remains functional during the deprecation window (at least twelve months).
1662
- * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
1663
- */
1664
- sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise<void>;
1665
- sendResourceUpdated(params: ResourceUpdatedNotification['params']): Promise<void>;
1666
- sendResourceListChanged(): Promise<void>;
1667
- sendToolListChanged(): Promise<void>;
1668
- sendPromptListChanged(): Promise<void>;
1669
- }
1670
- //#endregion
1671
- //#region src/server/mcp.d.ts
1672
- /**
1673
- * High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
1674
- * For advanced usage (like sending notifications or setting custom request handlers), use the underlying
1675
- * {@linkcode Server} instance available via the {@linkcode McpServer.server | server} property.
1676
- *
1677
- * @example
1678
- * ```ts source="./mcp.examples.ts#McpServer_basicUsage"
1679
- * const server = new McpServer({
1680
- * name: 'my-server',
1681
- * version: '1.0.0'
1682
- * });
1683
- * ```
1684
- */
1685
- declare class McpServer {
1686
- /**
1687
- * The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications.
1688
- */
1689
- readonly server: Server;
1690
- private _registeredResources;
1691
- private _registeredResourceTemplates;
1692
- private _registeredTools;
1693
- private _registeredPrompts;
1694
- constructor(serverInfo: Implementation, options?: ServerOptions);
1695
- /**
1696
- * Attaches to the given transport, starts it, and starts listening for messages.
1697
- *
1698
- * The `server` object assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.
1699
- *
1700
- * @example
1701
- * ```ts source="./mcp.examples.ts#McpServer_connect_stdio"
1702
- * const server = new McpServer({ name: 'my-server', version: '1.0.0' });
1703
- * const transport = new StdioServerTransport();
1704
- * await server.connect(transport);
1705
- * ```
1706
- */
1707
- connect(transport: Transport): Promise<void>;
1708
- /**
1709
- * Closes the connection.
1710
- */
1711
- close(): Promise<void>;
1712
- private _toolHandlersInitialized;
1713
- private setToolRequestHandlers;
1714
- /**
1715
- * Creates a tool error result.
1716
- *
1717
- * @param errorMessage - The error message.
1718
- * @returns The tool error result.
1719
- */
1720
- private createToolError;
1721
- /**
1722
- * Validates tool input arguments against the tool's input schema.
1723
- */
1724
- private validateToolInput;
1725
- /**
1726
- * Validates tool output against the tool's output schema.
1727
- */
1728
- private validateToolOutput;
1729
- /**
1730
- * Executes a tool handler.
1731
- */
1732
- private executeToolHandler;
1733
- private _completionHandlerInitialized;
1734
- private setCompletionRequestHandler;
1735
- private handlePromptCompletion;
1736
- private handleResourceCompletion;
1737
- private _resourceHandlersInitialized;
1738
- private setResourceRequestHandlers;
1739
- private _promptHandlersInitialized;
1740
- private setPromptRequestHandlers;
1741
- /**
1742
- * Registers a resource with a config object and callback.
1743
- * For static resources, use a URI string. For dynamic resources, use a {@linkcode ResourceTemplate}.
1744
- *
1745
- * @example
1746
- * ```ts source="./mcp.examples.ts#McpServer_registerResource_static"
1747
- * server.registerResource(
1748
- * 'config',
1749
- * 'config://app',
1750
- * {
1751
- * title: 'Application Config',
1752
- * mimeType: 'text/plain'
1753
- * },
1754
- * async uri => ({
1755
- * contents: [{ uri: uri.href, text: 'App configuration here' }]
1756
- * })
1757
- * );
1758
- * ```
1759
- */
1760
- registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource;
1761
- registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
1762
- private _createRegisteredResource;
1763
- private _createRegisteredResourceTemplate;
1764
- private _createRegisteredPrompt;
1765
- private _createRegisteredTool;
1766
- /**
1767
- * Registers a tool with a config object and callback.
1768
- *
1769
- * @example
1770
- * ```ts source="./mcp.examples.ts#McpServer_registerTool_basic"
1771
- * server.registerTool(
1772
- * 'calculate-bmi',
1773
- * {
1774
- * title: 'BMI Calculator',
1775
- * description: 'Calculate Body Mass Index',
1776
- * inputSchema: z.object({
1777
- * weightKg: z.number(),
1778
- * heightM: z.number()
1779
- * }),
1780
- * outputSchema: z.object({ bmi: z.number() })
1781
- * },
1782
- * async ({ weightKg, heightM }) => {
1783
- * const output = { bmi: weightKg / (heightM * heightM) };
1784
- * return {
1785
- * content: [{ type: 'text', text: JSON.stringify(output) }],
1786
- * structuredContent: output
1787
- * };
1788
- * }
1789
- * );
1790
- * ```
1791
- */
1792
- registerTool<OutputArgs extends StandardSchemaWithJSON, InputArgs extends StandardSchemaWithJSON | undefined = undefined>(name: string, config: {
1793
- title?: string;
1794
- description?: string;
1795
- inputSchema?: InputArgs;
1796
- outputSchema?: OutputArgs;
1797
- annotations?: ToolAnnotations;
1798
- icons?: Icon[];
1799
- _meta?: Record<string, unknown>;
1800
- }, cb: ToolCallback<InputArgs>): RegisteredTool;
1801
- /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `inputSchema`/`outputSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
1802
- registerTool<InputArgs extends ZodRawShape, OutputArgs extends ZodRawShape | StandardSchemaWithJSON | undefined = undefined>(name: string, config: {
1803
- title?: string;
1804
- description?: string;
1805
- inputSchema?: InputArgs;
1806
- outputSchema?: OutputArgs;
1807
- annotations?: ToolAnnotations;
1808
- icons?: Icon[];
1809
- _meta?: Record<string, unknown>;
1810
- }, cb: LegacyToolCallback<InputArgs>): RegisteredTool;
1811
- /**
1812
- * Registers a prompt with a config object and callback.
1813
- *
1814
- * @example
1815
- * ```ts source="./mcp.examples.ts#McpServer_registerPrompt_basic"
1816
- * server.registerPrompt(
1817
- * 'review-code',
1818
- * {
1819
- * title: 'Code Review',
1820
- * description: 'Review code for best practices',
1821
- * argsSchema: z.object({ code: z.string() })
1822
- * },
1823
- * ({ code }) => ({
1824
- * messages: [
1825
- * {
1826
- * role: 'user' as const,
1827
- * content: {
1828
- * type: 'text' as const,
1829
- * text: `Please review this code:\n\n${code}`
1830
- * }
1831
- * }
1832
- * ]
1833
- * })
1834
- * );
1835
- * ```
1836
- */
1837
- registerPrompt<Args extends StandardSchemaWithJSON>(name: string, config: {
1838
- title?: string;
1839
- description?: string;
1840
- argsSchema?: Args;
1841
- icons?: Icon[];
1842
- _meta?: Record<string, unknown>;
1843
- }, cb: PromptCallback<Args>): RegisteredPrompt;
1844
- /** @deprecated Wrap with `z.object({...})` instead. Raw-shape form: `argsSchema` may be a plain `{ field: z.string() }` record; it is auto-wrapped with `z.object()`. */
1845
- registerPrompt<Args extends ZodRawShape>(name: string, config: {
1846
- title?: string;
1847
- description?: string;
1848
- argsSchema?: Args;
1849
- icons?: Icon[];
1850
- _meta?: Record<string, unknown>;
1851
- }, cb: LegacyPromptCallback<Args>): RegisteredPrompt;
1852
- /**
1853
- * Checks if the server is connected to a transport.
1854
- * @returns `true` if the server is connected
1855
- */
1856
- isConnected(): boolean;
1857
- /**
1858
- * Sends a logging message to the client, if connected.
1859
- * Note: You only need to send the parameters object, not the entire JSON-RPC message.
1860
- * @see {@linkcode LoggingMessageNotification}
1861
- * @param params
1862
- * @param sessionId Optional for stateless transports and backward compatibility.
1863
- *
1864
- * @example
1865
- * ```ts source="./mcp.examples.ts#McpServer_sendLoggingMessage_basic"
1866
- * await server.sendLoggingMessage({
1867
- * level: 'info',
1868
- * data: 'Processing complete'
1869
- * });
1870
- * ```
1871
- *
1872
- * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577).
1873
- * Remains functional during the deprecation window (at least twelve months).
1874
- * Migrate to stderr logging (STDIO servers) or OpenTelemetry.
1875
- */
1876
- sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise<void>;
1877
- /**
1878
- * Sends a resource list changed event to the client, if connected.
1879
- */
1880
- sendResourceListChanged(): void;
1881
- /**
1882
- * Sends a tool list changed event to the client, if connected.
1883
- */
1884
- sendToolListChanged(): void;
1885
- /**
1886
- * Sends a prompt list changed event to the client, if connected.
1887
- */
1888
- sendPromptListChanged(): void;
1889
- }
1890
- /**
1891
- * A callback to complete one variable within a resource template's URI template.
1892
- */
1893
- type CompleteResourceTemplateCallback = (value: string, context?: {
1894
- arguments?: Record<string, string>;
1895
- }) => string[] | Promise<string[]>;
1896
- /**
1897
- * A resource template combines a URI pattern with optional functionality to enumerate
1898
- * all resources matching that pattern.
1899
- */
1900
- declare class ResourceTemplate {
1901
- private _callbacks;
1902
- private _uriTemplate;
1903
- constructor(uriTemplate: string | UriTemplate, _callbacks: {
1904
- /**
1905
- * A callback to list all resources matching this template. This is required to be specified, even if `undefined`, to avoid accidentally forgetting resource listing.
1906
- */
1907
- list: ListResourcesCallback | undefined;
1908
- /**
1909
- * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values.
1910
- */
1911
- complete?: {
1912
- [variable: string]: CompleteResourceTemplateCallback;
1913
- };
1914
- });
1915
- /**
1916
- * Gets the URI template pattern.
1917
- */
1918
- get uriTemplate(): UriTemplate;
1919
- /**
1920
- * Gets the list callback, if one was provided.
1921
- */
1922
- get listCallback(): ListResourcesCallback | undefined;
1923
- /**
1924
- * Gets the callback for completing a specific URI template variable, if one was provided.
1925
- */
1926
- completeCallback(variable: string): CompleteResourceTemplateCallback | undefined;
1927
- }
1928
- /**
1929
- * A plain record of Zod field schemas, e.g. `{ name: z.string() }`. Accepted by
1930
- * `registerTool`/`registerPrompt` as a shorthand; auto-wrapped with `z.object()`.
1931
- * Zod schemas only — `z.object()` cannot wrap other Standard Schema libraries.
1932
- */
1933
- type ZodRawShape = Record<string, z.ZodType>;
1934
- /** Infers the parsed-output type of a {@linkcode ZodRawShape}. */
1935
- type InferRawShape<S extends ZodRawShape> = z.infer<z.ZodObject<S>>;
1936
- /** {@linkcode ToolCallback} variant used when `inputSchema` is a {@linkcode ZodRawShape}. */
1937
- type LegacyToolCallback<Args extends ZodRawShape | undefined> = Args extends ZodRawShape ? (args: InferRawShape<Args>, ctx: ServerContext) => CallToolResult | Promise<CallToolResult> : (ctx: ServerContext) => CallToolResult | Promise<CallToolResult>;
1938
- /** {@linkcode PromptCallback} variant used when `argsSchema` is a {@linkcode ZodRawShape}. */
1939
- type LegacyPromptCallback<Args extends ZodRawShape | undefined> = Args extends ZodRawShape ? (args: InferRawShape<Args>, ctx: ServerContext) => GetPromptResult | Promise<GetPromptResult> : (ctx: ServerContext) => GetPromptResult | Promise<GetPromptResult>;
1940
- type BaseToolCallback<SendResultT extends Result$1, Ctx extends ServerContext, Args extends StandardSchemaWithJSON | undefined> = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput<Args>, ctx: Ctx) => SendResultT | Promise<SendResultT> : (ctx: Ctx) => SendResultT | Promise<SendResultT>;
1941
- /**
1942
- * Callback for a tool handler registered with {@linkcode McpServer.registerTool}.
1943
- */
1944
- type ToolCallback<Args extends StandardSchemaWithJSON | undefined = undefined> = BaseToolCallback<CallToolResult, ServerContext, Args>;
1945
- /**
1946
- * Tool handler callback type.
1947
- */
1948
- type AnyToolHandler<Args extends StandardSchemaWithJSON | undefined = undefined> = ToolCallback<Args>;
1949
- /**
1950
- * Internal executor type that encapsulates handler invocation with proper types.
1951
- */
1952
- type ToolExecutor = (args: unknown, ctx: ServerContext) => Promise<CallToolResult>;
1953
- type RegisteredTool = {
1954
- title?: string;
1955
- description?: string;
1956
- inputSchema?: StandardSchemaWithJSON;
1957
- outputSchema?: StandardSchemaWithJSON;
1958
- annotations?: ToolAnnotations;
1959
- icons?: Icon[];
1960
- execution?: ToolExecution;
1961
- _meta?: Record<string, unknown>;
1962
- handler: AnyToolHandler<StandardSchemaWithJSON | undefined>;
1963
- /** @hidden */
1964
- executor: ToolExecutor;
1965
- enabled: boolean;
1966
- enable(): void;
1967
- disable(): void;
1968
- update(updates: {
1969
- name?: string | null;
1970
- title?: string;
1971
- description?: string;
1972
- paramsSchema?: StandardSchemaWithJSON;
1973
- outputSchema?: StandardSchemaWithJSON;
1974
- annotations?: ToolAnnotations;
1975
- icons?: Icon[];
1976
- _meta?: Record<string, unknown>;
1977
- callback?: ToolCallback<StandardSchemaWithJSON>;
1978
- enabled?: boolean;
1979
- }): void;
1980
- remove(): void;
1981
- };
1982
- /**
1983
- * Additional, optional information for annotating a resource.
1984
- */
1985
- type ResourceMetadata = Omit<Resource, 'uri' | 'name'>;
1986
- /**
1987
- * Callback to list all resources matching a given template.
1988
- */
1989
- type ListResourcesCallback = (ctx: ServerContext) => ListResourcesResult | Promise<ListResourcesResult>;
1990
- /**
1991
- * Callback to read a resource at a given URI.
1992
- */
1993
- type ReadResourceCallback = (uri: URL, ctx: ServerContext) => ReadResourceResult | Promise<ReadResourceResult>;
1994
- type RegisteredResource = {
1995
- name: string;
1996
- title?: string;
1997
- metadata?: ResourceMetadata;
1998
- readCallback: ReadResourceCallback;
1999
- enabled: boolean;
2000
- enable(): void;
2001
- disable(): void;
2002
- update(updates: {
2003
- name?: string;
2004
- title?: string;
2005
- uri?: string | null;
2006
- metadata?: ResourceMetadata;
2007
- callback?: ReadResourceCallback;
2008
- enabled?: boolean;
2009
- }): void;
2010
- remove(): void;
2011
- };
2012
- /**
2013
- * Callback to read a resource at a given URI, following a filled-in URI template.
2014
- */
2015
- type ReadResourceTemplateCallback = (uri: URL, variables: Variables, ctx: ServerContext) => ReadResourceResult | Promise<ReadResourceResult>;
2016
- type RegisteredResourceTemplate = {
2017
- resourceTemplate: ResourceTemplate;
2018
- title?: string;
2019
- metadata?: ResourceMetadata;
2020
- readCallback: ReadResourceTemplateCallback;
2021
- enabled: boolean;
2022
- enable(): void;
2023
- disable(): void;
2024
- update(updates: {
2025
- name?: string | null;
2026
- title?: string;
2027
- template?: ResourceTemplate;
2028
- metadata?: ResourceMetadata;
2029
- callback?: ReadResourceTemplateCallback;
2030
- enabled?: boolean;
2031
- }): void;
2032
- remove(): void;
2033
- };
2034
- type PromptCallback<Args extends StandardSchemaWithJSON | undefined = undefined> = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput<Args>, ctx: ServerContext) => GetPromptResult | Promise<GetPromptResult> : (ctx: ServerContext) => GetPromptResult | Promise<GetPromptResult>;
2035
- /**
2036
- * Internal handler type that encapsulates parsing and callback invocation.
2037
- * This allows type-safe handling without runtime type assertions.
2038
- */
2039
- type PromptHandler = (args: Record<string, unknown> | undefined, ctx: ServerContext) => Promise<GetPromptResult>;
2040
- type RegisteredPrompt = {
2041
- title?: string;
2042
- description?: string;
2043
- argsSchema?: StandardSchemaWithJSON;
2044
- icons?: Icon[];
2045
- _meta?: Record<string, unknown>;
2046
- /** @hidden */
2047
- handler: PromptHandler;
2048
- enabled: boolean;
2049
- enable(): void;
2050
- disable(): void;
2051
- update<Args extends StandardSchemaWithJSON>(updates: {
2052
- name?: string | null;
2053
- title?: string;
2054
- description?: string;
2055
- argsSchema?: Args;
2056
- icons?: Icon[];
2057
- _meta?: Record<string, unknown>;
2058
- callback?: PromptCallback<Args>;
2059
- enabled?: boolean;
2060
- }): void;
2061
- remove(): void;
2062
- };
2063
- //#endregion
2064
54
  //#region src/server/middleware/hostHeaderValidation.d.ts
2065
55
  type HostHeaderValidationResult = {
2066
56
  ok: true;
@@ -2092,6 +82,168 @@ declare function localhostAllowedHostnames(): string[];
2092
82
  */
2093
83
  declare function hostHeaderValidationResponse(req: Request, allowedHostnames: string[]): Response | undefined;
2094
84
  //#endregion
85
+ //#region src/server/middleware/originValidation.d.ts
86
+ /**
87
+ * Framework-agnostic Origin header validation helpers.
88
+ *
89
+ * Browsers attach an `Origin` header to cross-origin requests; validating it
90
+ * against an allowlist (alongside Host header validation) protects local and
91
+ * development MCP servers against DNS rebinding and cross-site request
92
+ * forgery. The framework middleware packages (`@modelcontextprotocol/express`,
93
+ * `@modelcontextprotocol/hono`, `@modelcontextprotocol/fastify`,
94
+ * `@modelcontextprotocol/node`) wrap these helpers; use them directly when
95
+ * mounting a handler bare on a fetch-native runtime.
96
+ *
97
+ * Validation is deny-on-failure: a present `Origin` value that cannot be
98
+ * parsed (including the opaque `null` origin) is rejected, never passed
99
+ * through. Requests without an `Origin` header pass — non-browser MCP clients
100
+ * do not send one.
101
+ */
102
+ type OriginValidationResult = {
103
+ ok: true;
104
+ origin?: string;
105
+ hostname?: string;
106
+ } | {
107
+ ok: false;
108
+ errorCode: 'invalid_origin_header' | 'invalid_origin';
109
+ message: string;
110
+ originHeader?: string;
111
+ hostname?: string;
112
+ };
113
+ /**
114
+ * Validate an `Origin` header against an allowlist of hostnames (port-agnostic).
115
+ *
116
+ * - A missing/empty `Origin` header passes: non-browser clients do not send one,
117
+ * and only browser-originated requests carry the header this check defends against.
118
+ * - Allowlist items are hostnames only (no scheme, no port), the same convention as
119
+ * `validateHostHeader`. For IPv6, include brackets (e.g. `[::1]`).
120
+ * - Any present value that cannot be parsed as an origin URL — including the literal
121
+ * `null` origin browsers send for opaque contexts — is rejected (deny on failure).
122
+ */
123
+ declare function validateOriginHeader(originHeader: string | null | undefined, allowedOriginHostnames: string[]): OriginValidationResult;
124
+ /**
125
+ * Convenience allowlist of localhost-class origin hostnames, mirroring
126
+ * `localhostAllowedHostnames`.
127
+ */
128
+ declare function localhostAllowedOrigins(): string[];
129
+ /**
130
+ * Web-standard `Request` helper for Origin validation: returns a `403` JSON-RPC
131
+ * error response when the request's `Origin` header is not allowed, and
132
+ * `undefined` when the request may proceed.
133
+ *
134
+ * ```ts
135
+ * const rejected = originValidationResponse(request, localhostAllowedOrigins());
136
+ * if (rejected) return rejected;
137
+ * ```
138
+ */
139
+ declare function originValidationResponse(req: Request, allowedOriginHostnames: string[]): Response | undefined;
140
+ //#endregion
141
+ //#region src/server/requestStateCodec.d.ts
142
+ /**
143
+ * Options for {@linkcode createRequestStateCodec}.
144
+ */
145
+ interface RequestStateCodecOptions {
146
+ /**
147
+ * The HMAC secret. A `string` value is UTF-8-encoded. MUST be at least
148
+ * 32 bytes (256 bits) long; a `RangeError` is thrown at
149
+ * construction otherwise. The same key must be available to every server
150
+ * instance that may receive an echoed `requestState` (so a per-process
151
+ * random key only works when one process serves every round of a flow).
152
+ */
153
+ key: Uint8Array | string;
154
+ /**
155
+ * How long a minted `requestState` stays valid, in seconds. An echoed
156
+ * value past its expiry is rejected by {@linkcode RequestStateCodec.verify}.
157
+ * Defaults to `600` (ten minutes).
158
+ */
159
+ ttlSeconds?: number;
160
+ /**
161
+ * Optional context binding. Called at mint time and again at verify time;
162
+ * a `requestState` minted under one binding value is rejected when echoed
163
+ * under a different one. Use this to bind state to the authenticated
164
+ * principal and/or the originating method (the spec's user-binding MUST
165
+ * for state that influences authorization), for example:
166
+ *
167
+ * ```ts
168
+ * bind: ctx => `${ctx.mcpReq.method}\0${ctx.http?.authInfo?.clientId ?? ''}`
169
+ * ```
170
+ *
171
+ * The returned value is stored in the envelope as a domain-separated HMAC
172
+ * tag (keyed by the codec's `key`), not the raw string — so a principal
173
+ * identifier in the binding does not appear in the wire value the client
174
+ * holds.
175
+ *
176
+ * When configured, {@linkcode RequestStateCodec.mint} requires its `ctx`
177
+ * argument.
178
+ */
179
+ bind?: (ctx: ServerContext) => string;
180
+ }
181
+ /**
182
+ * The codec returned by {@linkcode createRequestStateCodec}: `mint` seals a
183
+ * JSON-serializable payload into the wire string a handler returns from
184
+ * `inputRequired({ requestState })`; `verify` is the function to drop into
185
+ * {@linkcode server/server.ServerOptions | ServerOptions}`.requestState.verify`
186
+ * (it throws on any failure, which the seam answers as the frozen `-32602`).
187
+ * The decoded payload `verify` resolves with is handed to the handler by the
188
+ * seam via the typed `ctx.mcpReq.requestState<T>()` accessor — `mint<T>` and
189
+ * `requestState<T>()` are the typed encode/read pair.
190
+ */
191
+ interface RequestStateCodec<T = unknown> {
192
+ /**
193
+ * Seal `payload` into an opaque wire string. The result is what the
194
+ * handler returns from `inputRequired({ requestState })`.
195
+ *
196
+ * @param ctx The handler's context. Required when the codec was created
197
+ * with a {@linkcode RequestStateCodecOptions.bind | bind}
198
+ * callback; ignored otherwise.
199
+ */
200
+ mint(payload: T, ctx?: ServerContext): Promise<string>;
201
+ /**
202
+ * Verify an echoed `requestState` and return the original payload. Throws
203
+ * on any failure (bad MAC, expired, bind mismatch, malformed). The thrown
204
+ * message is a fixed opaque reason code (`'malformed'` / `'mac'` /
205
+ * `'expired'` / `'bind'`) — never the decoded payload, the binding value,
206
+ * or any other context-derived field.
207
+ *
208
+ * Pass this directly as `ServerOptions.requestState.verify`.
209
+ */
210
+ verify(state: string, ctx: ServerContext): Promise<T>;
211
+ }
212
+ /**
213
+ * Create an opt-in HMAC-SHA256 codec for the multi-round-trip `requestState`
214
+ * (protocol revision 2026-07-28).
215
+ *
216
+ * `requestState` round-trips through the client and is attacker-controlled
217
+ * input on re-entry. The SDK applies no protection of its own; this helper is
218
+ * the convenience implementation of the spec's integrity MUST so authors don't
219
+ * hand-roll HMAC. Wire shape:
220
+ *
221
+ * "v1." b64url({"p":<payload>,"exp":<unixSeconds>,"b":<bindTag>?}) "." b64url(mac)
222
+ *
223
+ * where `bindTag` is `b64url(HMAC(key, "mcp.requestState.bind:" + bind(ctx))[:16])`
224
+ * — the binding value is never embedded raw.
225
+ *
226
+ * The codec is **signed, not encrypted**: the body is integrity-protected but
227
+ * the client can base64url-decode it and read the payload (`p`) in clear. Do
228
+ * not put secrets in the payload; use an AEAD construction if confidentiality
229
+ * is required. The handler reads its payload back via the typed
230
+ * `ctx.mcpReq.requestState<T>()` accessor — the seam has already run `verify`
231
+ * (integrity proven, payload decoded) by the time the handler is entered.
232
+ *
233
+ * Verification is fail-closed and constant-time (WebCrypto `subtle.verify` for
234
+ * the body MAC; a fixed-length XOR-accumulator compare for the bind tag).
235
+ * See `examples/mrtr/server.ts` for a worked end-to-end example.
236
+ *
237
+ * Design comparison (mcp.d `secureRequestState`, the peer SDK's reference
238
+ * implementation): mcp.d additionally offers an AES-256-GCM encrypted mode and
239
+ * derives independent cipher / bind-HMAC sub-keys from the operator secret via
240
+ * HKDF-SHA256, with an auto-generated per-process ephemeral key when none is
241
+ * supplied. This codec deliberately ships only the signed mode and a single
242
+ * keyed HMAC (domain-separated by input prefix) — HKDF sub-key derivation and
243
+ * an encrypted mode are intentionally out of scope for the initial release.
244
+ */
245
+ declare function createRequestStateCodec<T = unknown>(options: RequestStateCodecOptions): RequestStateCodec<T>;
246
+ //#endregion
2095
247
  //#region src/server/streamableHttp.d.ts
2096
248
  type StreamId = string;
2097
249
  type EventId = string;
@@ -2394,5 +546,5 @@ declare class WebStandardStreamableHTTPServerTransport implements Transport {
2394
546
  //#region src/fromJsonSchema.d.ts
2395
547
  declare function fromJsonSchema<T = unknown>(schema: JsonSchemaType, validator?: jsonSchemaValidator): StandardSchemaWithJSON<T, T>;
2396
548
  //#endregion
2397
- export { AjvJsonSchemaValidator, Annotations, type AnyToolHandler, AudioContent, AuthInfo, AuthorizationServerMetadata, BAGGAGE_META_KEY, BaseContext, BaseMetadata, type BaseToolCallback, BlobResourceContents, BooleanSchema, CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, CallToolRequest, CallToolRequestParams, CallToolResult, CancelTaskRequest, CancelTaskResult, CancelledNotification, CancelledNotificationParams, CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft, ClientCapabilities, ClientContext, ClientNotification, ClientRequest, ClientResult, CompatibilityCallToolResult, type CompletableSchema, type CompleteCallback, CompleteRequest, CompleteRequestParams, CompleteRequestPrompt, CompleteRequestResourceTemplate, type CompleteResourceTemplateCallback, CompleteResult, ContentBlock, CreateMessageRequest, CreateMessageRequestParams, CreateMessageRequestParamsBase, CreateMessageRequestParamsWithTools, CreateMessageResult, CreateMessageResultWithTools, CreateTaskResult, Cursor, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, DEFAULT_REQUEST_TIMEOUT_MSEC, DiscoverRequest, DiscoverResult, ElicitRequest, ElicitRequestFormParams, ElicitRequestParams, ElicitRequestURLParams, ElicitResult, ElicitationCompleteNotification, ElicitationCompleteNotificationParams, EmbeddedResource, EmptyResult, EnumSchema, type EventId, type EventStore, FetchLike, GetPromptRequest, GetPromptRequestParams, GetPromptResult, GetTaskPayloadRequest, GetTaskPayloadResult, GetTaskRequest, GetTaskResult, type HandleRequestOptions, type HostHeaderValidationResult, INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, Icon, Icons, IdJagTokenExchangeResponse, ImageContent, Implementation, InMemoryTransport, InitializeRequest, InitializeRequestParams, InitializeResult, InitializedNotification, InternalError, InvalidParamsError, InvalidRequestError, JSONArray, JSONObject, JSONRPCErrorResponse, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONRPCResultResponse, JSONRPC_VERSION, JSONValue, JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, LATEST_PROTOCOL_VERSION, LOG_LEVEL_META_KEY, LegacyTitledEnumSchema, ListChangedCallback, ListChangedHandlers, ListChangedOptions, ListPromptsRequest, ListPromptsResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, type ListResourcesCallback, ListResourcesRequest, ListResourcesResult, ListRootsRequest, ListRootsResult, ListTasksRequest, ListTasksResult, ListToolsRequest, ListToolsResult, LoggingLevel, LoggingMessageNotification, LoggingMessageNotificationParams, METHOD_NOT_FOUND, McpServer, MessageExtraInfo, MetaObject, MethodNotFoundError, ModelHint, ModelPreferences, MultiSelectEnumSchema, Notification, NotificationMethod, NotificationOptions, NotificationParams, NotificationTypeMap, NumberSchema, OAuthClientInformation, OAuthClientInformationFull, OAuthClientInformationMixed, OAuthClientMetadata, OAuthClientRegistrationError, OAuthError, OAuthErrorCode, OAuthErrorResponse, OAuthMetadata, OAuthProtectedResourceMetadata, OAuthTokenRevocationRequest, OAuthTokens, OpenIdProviderDiscoveryMetadata, OpenIdProviderMetadata, PARSE_ERROR, PROTOCOL_VERSION_META_KEY, PaginatedRequest, PaginatedRequestParams, PaginatedResult, ParseError, PingRequest, PrimitiveSchemaDefinition, Progress, ProgressCallback, ProgressNotification, ProgressNotificationParams, ProgressToken, Prompt, PromptArgument, type PromptCallback, PromptListChangedNotification, PromptMessage, PromptReference, ProtocolError, ProtocolErrorCode, ProtocolOptions, RELATED_TASK_META_KEY, ReadBuffer, type ReadResourceCallback, ReadResourceRequest, ReadResourceRequestParams, ReadResourceResult, type ReadResourceTemplateCallback, type RegisteredPrompt, type RegisteredResource, type RegisteredResourceTemplate, type RegisteredTool, RelatedTaskMetadata, Request$1 as Request, RequestHandlerSchemas, RequestId, RequestMeta, RequestMetaEnvelope, RequestMetaObject, RequestMethod, RequestOptions, RequestParams, RequestTypeMap, Resource, ResourceContents, ResourceLink, ResourceListChangedNotification, type ResourceMetadata, ResourceRequestParams, ResourceTemplate, ResourceTemplateReference, ResourceTemplateType, ResourceUpdatedNotification, ResourceUpdatedNotificationParams, Result$1 as Result, ResultTypeMap, Role, Root, RootsListChangedNotification, STDIO_DEFAULT_MAX_BUFFER_SIZE, SUPPORTED_PROTOCOL_VERSIONS, SamplingContent, SamplingMessage, SamplingMessageContentBlock, SdkError, SdkErrorCode, SdkHttpError, SdkHttpErrorData, Server, ServerCapabilities, ServerContext, ServerNotification, type ServerOptions, ServerRequest, ServerResult, SetLevelRequest, SetLevelRequestParams, SingleSelectEnumSchema, SpecTypeName, SpecTypes, StandardSchemaV1, StandardSchemaV1Sync, StandardSchemaWithJSON, type StreamId, StringSchema, SubscribeRequest, SubscribeRequestParams, TRACEPARENT_META_KEY, TRACESTATE_META_KEY, Task, TaskAugmentedRequestParams, TaskCreationParams, TaskMetadata, TaskStatus, TaskStatusNotification, TaskStatusNotificationParams, TextContent, TextResourceContents, TitledMultiSelectEnumSchema, TitledSingleSelectEnumSchema, Tool, ToolAnnotations, type ToolCallback, ToolChoice, ToolExecution, ToolListChangedNotification, ToolResultContent, ToolUseContent, Transport, TransportSendOptions, UnsubscribeRequest, UnsubscribeRequestParams, UnsupportedProtocolVersionError, UnsupportedProtocolVersionErrorData, UntitledMultiSelectEnumSchema, UntitledSingleSelectEnumSchema, UriTemplate, UrlElicitationRequiredError, Variables, WebStandardStreamableHTTPServerTransport, type WebStandardStreamableHTTPServerTransportOptions, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate, checkResourceAllowed, completable, createFetchWithInit, deserializeMessage, fromJsonSchema, getDisplayName, hostHeaderValidationResponse, isCallToolResult, isCompletable, isInitializeRequest, isInitializedNotification, isJSONRPCErrorResponse, isJSONRPCNotification, isJSONRPCRequest, isJSONRPCResponse, isJSONRPCResultResponse, isSpecType, isTaskAugmentedRequestParams, jsonSchemaValidator, localhostAllowedHostnames, parseJSONRPCMessage, resourceUrlFromServerUrl, serializeMessage, specTypeSchemas, validateHostHeader };
549
+ export { type AjvJsonSchemaValidator, Annotations, type AnyToolHandler, AudioContent, AuthInfo, type AuthorizationServerMetadata, BAGGAGE_META_KEY, type BaseContext, BaseMetadata, type BaseToolCallback, BlobResourceContents, BooleanSchema, CLIENT_CAPABILITIES_META_KEY, CLIENT_INFO_META_KEY, type CacheHint, type CacheScope, CallToolRequest, CallToolRequestParams, CallToolResult, CancelTaskRequest, CancelTaskResult, CancelledNotification, CancelledNotificationParams, type CfWorkerJsonSchemaValidator, type CfWorkerSchemaDraft, ClientCapabilities, type ClientContext, ClientNotification, ClientRequest, ClientResult, CompatibilityCallToolResult, type CompletableSchema, type CompleteCallback, CompleteRequest, CompleteRequestParams, CompleteRequestPrompt, CompleteRequestResourceTemplate, type CompleteResourceTemplateCallback, CompleteResult, ContentBlock, type CreateMcpHandlerOptions, CreateMessageRequest, CreateMessageRequestParams, CreateMessageRequestParamsBase, CreateMessageRequestParamsWithTools, CreateMessageResult, CreateMessageResultWithTools, CreateTaskResult, Cursor, DEFAULT_NEGOTIATED_PROTOCOL_VERSION, DEFAULT_REQUEST_TIMEOUT_MSEC, DiscoverRequest, DiscoverResult, ElicitRequest, ElicitRequestFormParams, ElicitRequestParams, ElicitRequestURLParams, ElicitResult, ElicitationCompleteNotification, ElicitationCompleteNotificationParams, EmbeddedResource, EmptyResult, EnumSchema, type EventId, type EventStore, type FetchLike, GetPromptRequest, GetPromptRequestParams, GetPromptResult, GetTaskPayloadRequest, GetTaskPayloadResult, GetTaskRequest, GetTaskResult, type HandleRequestOptions, HandlerResultTypeMap, type HostHeaderValidationResult, INTERNAL_ERROR, INVALID_PARAMS, INVALID_REQUEST, Icon, Icons, type IdJagTokenExchangeResponse, ImageContent, Implementation, InMemoryServerEventBus, InMemoryTransport, type InboundClassificationOutcome, type InboundHttpRequest, type InboundLadderRejection, type InboundLegacyRoute, type InboundLegacyRouteReason, type InboundModernRoute, type InboundValidationRung, InitializeRequest, InitializeRequestParams, InitializeResult, InitializedNotification, InputRequest, InputRequests, InputRequiredResult, type InputRequiredSpec, InputResponse, type InputResponseView, InputResponses, InternalError, InvalidParamsError, InvalidRequestError, JSONArray, JSONObject, JSONRPCErrorResponse, JSONRPCMessage, JSONRPCNotification, JSONRPCRequest, JSONRPCResponse, JSONRPCResultResponse, JSONRPC_VERSION, JSONValue, type JsonSchemaType, type JsonSchemaValidator, type JsonSchemaValidatorResult, LATEST_PROTOCOL_VERSION, LOG_LEVEL_META_KEY, type LegacyHttpHandler, LegacyTitledEnumSchema, ListChangedCallback, ListChangedHandlers, ListChangedOptions, ListPromptsRequest, ListPromptsResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, type ListResourcesCallback, ListResourcesRequest, ListResourcesResult, ListRootsRequest, ListRootsResult, ListTasksRequest, ListTasksResult, ListToolsRequest, ListToolsResult, LoggingLevel, LoggingMessageNotification, LoggingMessageNotificationParams, METHOD_NOT_FOUND, type McpHandlerRequestOptions, type McpHttpHandler, type McpRequestContext, McpServer, type McpServerFactory, MessageClassification, MessageExtraInfo, MetaObject, MethodNotFoundError, MissingRequiredClientCapabilityError, MissingRequiredClientCapabilityErrorData, ModelHint, ModelPreferences, MultiSelectEnumSchema, Notification, NotificationMethod, type NotificationOptions, NotificationParams, NotificationTypeMap, NumberSchema, type OAuthClientInformation, type OAuthClientInformationFull, type OAuthClientInformationMixed, type OAuthClientMetadata, type OAuthClientRegistrationError, OAuthError, OAuthErrorCode, type OAuthErrorResponse, type OAuthMetadata, type OAuthProtectedResourceMetadata, type OAuthTokenRevocationRequest, type OAuthTokens, type OpenIdProviderDiscoveryMetadata, type OpenIdProviderMetadata, type OriginValidationResult, PARSE_ERROR, PROTOCOL_VERSION_META_KEY, PaginatedRequest, PaginatedRequestParams, PaginatedResult, ParseError, PerRequestHTTPServerTransport, type PerRequestHTTPServerTransportOptions, type PerRequestMessageExtra, type PerRequestResponseMode, PingRequest, PrimitiveSchemaDefinition, Progress, type ProgressCallback, ProgressNotification, ProgressNotificationParams, ProgressToken, Prompt, PromptArgument, type PromptCallback, PromptListChangedNotification, PromptMessage, PromptReference, type ProtocolEra, ProtocolError, ProtocolErrorCode, type ProtocolOptions, RELATED_TASK_META_KEY, ReadBuffer, type ReadResourceCallback, ReadResourceRequest, ReadResourceRequestParams, ReadResourceResult, type ReadResourceTemplateCallback, type RegisteredPrompt, type RegisteredResource, type RegisteredResourceTemplate, type RegisteredTool, RelatedTaskMetadata, Request$1 as Request, type RequestHandlerSchemas, RequestId, RequestMeta, RequestMetaEnvelope, RequestMetaObject, RequestMethod, type RequestOptions, RequestParams, type RequestStateAccessor, type RequestStateCodec, type RequestStateCodecOptions, RequestTypeMap, Resource, ResourceContents, ResourceLink, ResourceListChangedNotification, type ResourceMetadata, ResourceNotFoundError, ResourceRequestParams, ResourceTemplate, ResourceTemplateReference, ResourceTemplateType, ResourceUpdatedNotification, ResourceUpdatedNotificationParams, Result, ResultTypeMap, Role, Root, RootsListChangedNotification, STDIO_DEFAULT_MAX_BUFFER_SIZE, SUBSCRIPTION_ID_META_KEY, SUPPORTED_PROTOCOL_VERSIONS, SamplingContent, SamplingMessage, SamplingMessageContentBlock, SdkError, SdkErrorCode, SdkHttpError, type SdkHttpErrorData, Server, ServerCapabilities, type ServerContext, type ServerEvent, type ServerEventBus, ServerNotification, type ServerNotifier, type ServerOptions, ServerRequest, ServerResult, SetLevelRequest, SetLevelRequestParams, SingleSelectEnumSchema, type SpecTypeName, type SpecTypes, type StandardSchemaV1, type StandardSchemaV1Sync, type StandardSchemaWithJSON, type StoredOAuthClientInformation, type StoredOAuthTokens, type StreamId, StringSchema, SubscribeRequest, SubscribeRequestParams, SubscriptionFilter, SubscriptionsAcknowledgedNotification, SubscriptionsAcknowledgedNotificationParams, SubscriptionsListenRequest, SubscriptionsListenRequestParams, SubscriptionsListenResult, SubscriptionsListenResultMeta, TRACEPARENT_META_KEY, TRACESTATE_META_KEY, Task, TaskAugmentedRequestParams, TaskCreationParams, TaskMetadata, TaskStatus, TaskStatusNotification, TaskStatusNotificationParams, TextContent, TextResourceContents, TitledMultiSelectEnumSchema, TitledSingleSelectEnumSchema, Tool, ToolAnnotations, type ToolCallback, ToolChoice, ToolExecution, ToolListChangedNotification, ToolResultContent, ToolUseContent, type Transport, type TransportSendOptions, UnsubscribeRequest, UnsubscribeRequestParams, UnsupportedProtocolVersionError, UnsupportedProtocolVersionErrorData, UntitledMultiSelectEnumSchema, UntitledSingleSelectEnumSchema, UriTemplate, UrlElicitationRequiredError, type Variables, WebStandardStreamableHTTPServerTransport, type WebStandardStreamableHTTPServerTransportOptions, acceptedContent, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate, checkResourceAllowed, classifyInboundRequest, completable, createFetchWithInit, createMcpHandler, createRequestStateCodec, deserializeMessage, fromJsonSchema, getDisplayName, hostHeaderValidationResponse, inputRequired, inputResponse, isCallToolResult, isCompletable, isInitializeRequest, isInitializedNotification, isInputRequiredResult, isJSONRPCErrorResponse, isJSONRPCNotification, isJSONRPCRequest, isJSONRPCResponse, isJSONRPCResultResponse, isLegacyRequest, isSpecType, isTaskAugmentedRequestParams, type jsonSchemaValidator, legacyStatelessFallback, localhostAllowedHostnames, localhostAllowedOrigins, originValidationResponse, parseJSONRPCMessage, resourceUrlFromServerUrl, serializeMessage, specTypeSchemas, validateHostHeader, validateOriginHeader };
2398
550
  //# sourceMappingURL=index.d.mts.map