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"; import { t as AjvJsonSchemaValidator } from "./ajvProvider-DZ_siXcF.mjs"; import { i as jsonSchemaValidator, n as JsonSchemaValidator, r as JsonSchemaValidatorResult, t as JsonSchemaType } from "./types-R2RTIcjk.mjs"; import { n as CfWorkerSchemaDraft, t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-DUhk5Ewx.mjs"; import * as z from "zod/v4"; //#region ../core-internal/src/shared/auth.d.ts /** * RFC 9728 OAuth Protected Resource Metadata */ declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{ resource: z.ZodString; authorization_servers: z.ZodOptional>; jwks_uri: z.ZodOptional; scopes_supported: z.ZodOptional>; bearer_methods_supported: z.ZodOptional>; resource_signing_alg_values_supported: z.ZodOptional>; resource_name: z.ZodOptional; resource_documentation: z.ZodOptional; resource_policy_uri: z.ZodOptional; resource_tos_uri: z.ZodOptional; tls_client_certificate_bound_access_tokens: z.ZodOptional; authorization_details_types_supported: z.ZodOptional>; dpop_signing_alg_values_supported: z.ZodOptional>; dpop_bound_access_tokens_required: z.ZodOptional; }, z.core.$loose>; /** * RFC 8414 OAuth 2.0 Authorization Server Metadata */ declare const OAuthMetadataSchema: z.ZodObject<{ issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; service_documentation: z.ZodOptional; revocation_endpoint: z.ZodOptional; revocation_endpoint_auth_methods_supported: z.ZodOptional>; revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; introspection_endpoint: z.ZodOptional; introspection_endpoint_auth_methods_supported: z.ZodOptional>; introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; code_challenge_methods_supported: z.ZodOptional>; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$loose>; /** * OpenID Connect Discovery 1.0 Provider Metadata * * @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata */ declare const OpenIdProviderMetadataSchema: z.ZodObject<{ issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; userinfo_endpoint: z.ZodOptional; jwks_uri: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; acr_values_supported: z.ZodOptional>; subject_types_supported: z.ZodArray; id_token_signing_alg_values_supported: z.ZodArray; id_token_encryption_alg_values_supported: z.ZodOptional>; id_token_encryption_enc_values_supported: z.ZodOptional>; userinfo_signing_alg_values_supported: z.ZodOptional>; userinfo_encryption_alg_values_supported: z.ZodOptional>; userinfo_encryption_enc_values_supported: z.ZodOptional>; request_object_signing_alg_values_supported: z.ZodOptional>; request_object_encryption_alg_values_supported: z.ZodOptional>; request_object_encryption_enc_values_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; display_values_supported: z.ZodOptional>; claim_types_supported: z.ZodOptional>; claims_supported: z.ZodOptional>; service_documentation: z.ZodOptional; claims_locales_supported: z.ZodOptional>; ui_locales_supported: z.ZodOptional>; claims_parameter_supported: z.ZodOptional; request_parameter_supported: z.ZodOptional; request_uri_parameter_supported: z.ZodOptional; require_request_uri_registration: z.ZodOptional; op_policy_uri: z.ZodOptional; op_tos_uri: z.ZodOptional; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$loose>; /** * OpenID Connect Discovery metadata that may include OAuth 2.0 fields * This schema represents the real-world scenario where OIDC providers * return a mix of OpenID Connect and OAuth 2.0 metadata fields */ declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{ code_challenge_methods_supported: z.ZodOptional>; issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; userinfo_endpoint: z.ZodOptional; jwks_uri: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; acr_values_supported: z.ZodOptional>; subject_types_supported: z.ZodArray; id_token_signing_alg_values_supported: z.ZodArray; id_token_encryption_alg_values_supported: z.ZodOptional>; id_token_encryption_enc_values_supported: z.ZodOptional>; userinfo_signing_alg_values_supported: z.ZodOptional>; userinfo_encryption_alg_values_supported: z.ZodOptional>; userinfo_encryption_enc_values_supported: z.ZodOptional>; request_object_signing_alg_values_supported: z.ZodOptional>; request_object_encryption_alg_values_supported: z.ZodOptional>; request_object_encryption_enc_values_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; display_values_supported: z.ZodOptional>; claim_types_supported: z.ZodOptional>; claims_supported: z.ZodOptional>; service_documentation: z.ZodOptional; claims_locales_supported: z.ZodOptional>; ui_locales_supported: z.ZodOptional>; claims_parameter_supported: z.ZodOptional; request_parameter_supported: z.ZodOptional; request_uri_parameter_supported: z.ZodOptional; require_request_uri_registration: z.ZodOptional; op_policy_uri: z.ZodOptional; op_tos_uri: z.ZodOptional; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$strip>; /** * OAuth 2.1 token response */ declare const OAuthTokensSchema: z.ZodObject<{ access_token: z.ZodString; id_token: z.ZodOptional; token_type: z.ZodString; expires_in: z.ZodOptional>; scope: z.ZodOptional; refresh_token: z.ZodOptional; }, z.core.$strip>; /** * RFC 8693 §2.2.1 Token Exchange response for ID-JAG tokens. * * `token_type` is intentionally optional: per RFC 8693 §2.2.1 it is informational when * the issued token is not an access token, and per RFC 6749 §5.1 it is case-insensitive, * so strict checking rejects conformant IdPs. */ declare const IdJagTokenExchangeResponseSchema: z.ZodObject<{ issued_token_type: z.ZodLiteral<"urn:ietf:params:oauth:token-type:id-jag">; access_token: z.ZodString; token_type: z.ZodOptional; expires_in: z.ZodOptional; scope: z.ZodOptional; }, z.core.$strip>; type IdJagTokenExchangeResponse = z.infer; /** * OAuth 2.1 error response */ declare const OAuthErrorResponseSchema: z.ZodObject<{ error: z.ZodString; error_description: z.ZodOptional; error_uri: z.ZodOptional; }, z.core.$strip>; /** * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata */ declare const OAuthClientMetadataSchema: z.ZodObject<{ redirect_uris: z.ZodArray; token_endpoint_auth_method: z.ZodOptional; grant_types: z.ZodOptional>; response_types: z.ZodOptional>; client_name: z.ZodOptional; client_uri: z.ZodOptional; logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; scope: z.ZodOptional; contacts: z.ZodOptional>; tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; policy_uri: z.ZodOptional; jwks_uri: z.ZodOptional; jwks: z.ZodOptional; software_id: z.ZodOptional; software_version: z.ZodOptional; software_statement: z.ZodOptional; }, z.core.$strip>; /** * RFC 7591 OAuth 2.0 Dynamic Client Registration client information */ declare const OAuthClientInformationSchema: z.ZodObject<{ client_id: z.ZodString; client_secret: z.ZodOptional; client_id_issued_at: z.ZodOptional; client_secret_expires_at: z.ZodOptional; }, z.core.$strip>; /** * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata) */ declare const OAuthClientInformationFullSchema: z.ZodObject<{ redirect_uris: z.ZodArray; token_endpoint_auth_method: z.ZodOptional; grant_types: z.ZodOptional>; response_types: z.ZodOptional>; client_name: z.ZodOptional; client_uri: z.ZodOptional; logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; scope: z.ZodOptional; contacts: z.ZodOptional>; tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; policy_uri: z.ZodOptional; jwks_uri: z.ZodOptional; jwks: z.ZodOptional; software_id: z.ZodOptional; software_version: z.ZodOptional; software_statement: z.ZodOptional; client_id: z.ZodString; client_secret: z.ZodOptional; client_id_issued_at: z.ZodOptional; client_secret_expires_at: z.ZodOptional; }, z.core.$strip>; /** * RFC 7591 OAuth 2.0 Dynamic Client Registration error response */ declare const OAuthClientRegistrationErrorSchema: z.ZodObject<{ error: z.ZodString; error_description: z.ZodOptional; }, z.core.$strip>; /** * RFC 7009 OAuth 2.0 Token Revocation request */ declare const OAuthTokenRevocationRequestSchema: z.ZodObject<{ token: z.ZodString; token_type_hint: z.ZodOptional; }, z.core.$strip>; type OAuthMetadata = z.infer; type OpenIdProviderMetadata = z.infer; type OpenIdProviderDiscoveryMetadata = z.infer; type OAuthTokens = z.infer; type OAuthErrorResponse = z.infer; type OAuthClientMetadata = z.infer; type OAuthClientInformation = z.infer; type OAuthClientInformationFull = z.infer; type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull; type OAuthClientRegistrationError = z.infer; type OAuthTokenRevocationRequest = z.infer; type OAuthProtectedResourceMetadata = z.infer; type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata; //#endregion //#region ../core-internal/src/auth/errors.d.ts /** * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749} * and extensions. */ declare enum OAuthErrorCode { /** * The request is missing a required parameter, includes an invalid parameter value, * includes a parameter more than once, or is otherwise malformed. */ InvalidRequest = "invalid_request", /** * Client authentication failed (e.g., unknown client, no client authentication included, * or unsupported authentication method). */ InvalidClient = "invalid_client", /** * The provided authorization grant or refresh token is invalid, expired, revoked, * does not match the redirection URI used in the authorization request, or was issued to another client. */ InvalidGrant = "invalid_grant", /** * The authenticated client is not authorized to use this authorization grant type. */ UnauthorizedClient = "unauthorized_client", /** * The authorization grant type is not supported by the authorization server. */ UnsupportedGrantType = "unsupported_grant_type", /** * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner. */ InvalidScope = "invalid_scope", /** * The resource owner or authorization server denied the request. */ AccessDenied = "access_denied", /** * The authorization server encountered an unexpected condition that prevented it from fulfilling the request. */ ServerError = "server_error", /** * The authorization server is currently unable to handle the request due to temporary overloading or maintenance. */ TemporarilyUnavailable = "temporarily_unavailable", /** * The authorization server does not support obtaining an authorization code using this method. */ UnsupportedResponseType = "unsupported_response_type", /** * The authorization server does not support the requested token type. */ UnsupportedTokenType = "unsupported_token_type", /** * The access token provided is expired, revoked, malformed, or invalid for other reasons. */ InvalidToken = "invalid_token", /** * The HTTP method used is not allowed for this endpoint. (Custom, non-standard error) */ MethodNotAllowed = "method_not_allowed", /** * Rate limit exceeded. (Custom, non-standard error based on RFC 6585) */ TooManyRequests = "too_many_requests", /** * The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591) */ InvalidClientMetadata = "invalid_client_metadata", /** * The request requires higher privileges than provided by the access token. */ InsufficientScope = "insufficient_scope", /** * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707) */ InvalidTarget = "invalid_target", } /** * OAuth error class for all OAuth-related errors. */ declare class OAuthError extends Error { readonly code: OAuthErrorCode | string; readonly errorUri?: string | undefined; constructor(code: OAuthErrorCode | string, message: string, errorUri?: string | undefined); /** * Converts the error to a standard OAuth error response object. */ toResponseObject(): OAuthErrorResponse; /** * Creates an {@linkcode OAuthError} from an OAuth error response. */ static fromResponse(response: OAuthErrorResponse): OAuthError; } //#endregion //#region ../core-internal/src/errors/sdkErrors.d.ts /** * Error codes for SDK errors (local errors that never cross the wire). * Unlike {@linkcode ProtocolErrorCode} which uses numeric JSON-RPC codes, `SdkErrorCode` uses * descriptive string values for better developer experience. * * These errors are thrown locally by the SDK and are never serialized as * JSON-RPC error responses. */ declare enum SdkErrorCode { /** Transport is not connected */ NotConnected = "NOT_CONNECTED", /** Transport is already connected */ AlreadyConnected = "ALREADY_CONNECTED", /** Protocol is not initialized */ NotInitialized = "NOT_INITIALIZED", /** Required capability is not supported by the remote side */ CapabilityNotSupported = "CAPABILITY_NOT_SUPPORTED", /** Request timed out waiting for response */ RequestTimeout = "REQUEST_TIMEOUT", /** Connection was closed */ ConnectionClosed = "CONNECTION_CLOSED", /** Failed to send message */ SendFailed = "SEND_FAILED", /** Response result failed local schema validation */ InvalidResult = "INVALID_RESULT", ClientHttpNotImplemented = "CLIENT_HTTP_NOT_IMPLEMENTED", ClientHttpAuthentication = "CLIENT_HTTP_AUTHENTICATION", ClientHttpForbidden = "CLIENT_HTTP_FORBIDDEN", ClientHttpUnexpectedContent = "CLIENT_HTTP_UNEXPECTED_CONTENT", ClientHttpFailedToOpenStream = "CLIENT_HTTP_FAILED_TO_OPEN_STREAM", ClientHttpFailedToTerminateSession = "CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION", } /** * SDK errors are local errors that never cross the wire. * They are distinct from {@linkcode ProtocolError} which represents JSON-RPC protocol errors * that are serialized and sent as error responses. * * @example * ```ts source="./sdkErrors.examples.ts#SdkError_basicUsage" * try { * // Throwing an SDK error * throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected'); * } catch (error) { * // Checking error type by code * if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) { * // Handle timeout * } * } * ``` */ declare class SdkError extends Error { readonly code: SdkErrorCode; readonly data?: unknown | undefined; constructor(code: SdkErrorCode, message: string, data?: unknown | undefined); } /** * Typed shape for HTTP error data carried by {@linkcode SdkHttpError}. */ interface SdkHttpErrorData { status: number; statusText?: string; [key: string]: unknown; } /** * An {@linkcode SdkError} subclass for HTTP transport failures. * * Thrown by the streamable HTTP transport when the server responds with a * non-OK status code. Narrows {@linkcode SdkError.data | data} to * {@linkcode SdkHttpErrorData} so consumers can inspect the HTTP status * without unsafe casting. * * @example * ```ts source="./sdkErrors.examples.ts#SdkHttpError_basicUsage" * if (error instanceof SdkHttpError) { * console.log(error.status); // number * console.log(error.statusText); // string | undefined * } * ``` */ declare class SdkHttpError extends SdkError { readonly data: SdkHttpErrorData; constructor(code: SdkErrorCode, message: string, data: SdkHttpErrorData); get status(): number; get statusText(): string | undefined; } //#endregion //#region ../core-internal/src/shared/authUtils.d.ts /** * Utilities for handling OAuth resource URIs. */ /** * Converts a server URL to a resource URL by removing the fragment. * {@link https://datatracker.ietf.org/doc/html/rfc8707#section-2 | RFC 8707 section 2} * states that resource URIs "MUST NOT include a fragment component". * Keeps everything else unchanged (scheme, domain, port, path, query). */ declare function resourceUrlFromServerUrl(url: URL | string): URL; /** * Checks if a requested resource URL matches a configured resource URL. * A requested resource matches if it has the same scheme, domain, port, * and its path starts with the configured resource's path. * * @param options - The options object * @param options.requestedResource - The resource URL being requested * @param options.configuredResource - The resource URL that has been configured * @returns true if the requested resource matches the configured resource, false otherwise */ declare function checkResourceAllowed({ requestedResource, configuredResource }: { requestedResource: URL | string; configuredResource: URL | string; }): boolean; //#endregion //#region ../core-internal/src/types/enums.d.ts /** * Error codes for protocol errors that cross the wire as JSON-RPC error responses. * These follow the JSON-RPC specification and MCP-specific extensions. */ declare enum ProtocolErrorCode { ParseError = -32700, InvalidRequest = -32600, MethodNotFound = -32601, InvalidParams = -32602, InternalError = -32603, ResourceNotFound = -32002, /** * Processing the request requires a capability the client did not declare * in the request's `clientCapabilities` (protocol revision 2026-07-28). */ MissingRequiredClientCapability = -32003, /** * The request's protocol version is unknown to the server or unsupported * by it (protocol revision 2026-07-28). */ UnsupportedProtocolVersion = -32004, UrlElicitationRequired = -32042, } //#endregion //#region ../core-internal/src/types/errors.d.ts /** * Protocol errors are JSON-RPC errors that cross the wire as error responses. * They use numeric error codes from the {@linkcode ProtocolErrorCode} enum. */ declare class ProtocolError extends Error { readonly code: number; readonly data?: unknown | undefined; constructor(code: number, message: string, data?: unknown | undefined); /** * Factory method to create the appropriate error type based on the error code and data */ static fromError(code: number, message: string, data?: unknown): ProtocolError; } /** * Specialized error type when a tool requires a URL mode elicitation. * 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. */ declare class UrlElicitationRequiredError extends ProtocolError { constructor(elicitations: ElicitRequestURLParams[], message?: string); get elicitations(): ElicitRequestURLParams[]; } /** * Error type for the `-32004` UnsupportedProtocolVersion protocol error (protocol * revision 2026-07-28): the request's protocol version is unknown to the server or * unsupported by it. * * The error data lists the protocol versions the receiver supports (`supported`), * so the sender can choose a mutually supported version and retry, and echoes the * version that was requested (`requested`). */ declare class UnsupportedProtocolVersionError extends ProtocolError { constructor(data: UnsupportedProtocolVersionErrorData, message?: string); /** * Protocol versions the receiver supports. */ get supported(): string[]; /** * The protocol version that was requested. */ get requested(): string; } //#endregion //#region ../core-internal/src/types/guards.d.ts /** * Validates and parses an unknown value as a JSON-RPC message. * * Use this to validate incoming messages in custom transport implementations. * Throws if the value does not conform to the JSON-RPC message schema. * * @param value - The value to validate (typically a parsed JSON object). * @returns The validated {@linkcode JSONRPCMessage}. * @throws If validation fails. */ declare function parseJSONRPCMessage(value: unknown): JSONRPCMessage; declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest; declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification; /** * Checks if a value is a valid {@linkcode JSONRPCResultResponse}. * @param value - The value to check. * * @returns True if the value is a valid {@linkcode JSONRPCResultResponse}, false otherwise. */ declare const isJSONRPCResultResponse: (value: unknown) => value is JSONRPCResultResponse; /** * Checks if a value is a valid {@linkcode JSONRPCErrorResponse}. * @param value - The value to check. * * @returns True if the value is a valid {@linkcode JSONRPCErrorResponse}, false otherwise. */ declare const isJSONRPCErrorResponse: (value: unknown) => value is JSONRPCErrorResponse; /** * Checks if a value is a valid {@linkcode JSONRPCResponse} (either a result or error response). * @param value - The value to check. * * @returns True if the value is a valid {@linkcode JSONRPCResponse}, false otherwise. */ declare const isJSONRPCResponse: (value: unknown) => value is JSONRPCResponse; /** * Checks if a value is a valid {@linkcode CallToolResult}. * @param value - The value to check. * * @returns True if the value is a valid {@linkcode CallToolResult}, false otherwise. */ declare const isCallToolResult: (value: unknown) => value is CallToolResult; /** * Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}. * @param value - The value to check. * * @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise. */ declare const isTaskAugmentedRequestParams: (value: unknown) => value is TaskAugmentedRequestParams; declare const isInitializeRequest: (value: unknown) => value is InitializeRequest; declare const isInitializedNotification: (value: unknown) => value is InitializedNotification; declare function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt; declare function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate; //#endregion //#region ../core-internal/src/util/standardSchema.d.ts /** * Standard Schema utilities for user-provided schemas. * Supports Zod v4, Valibot, ArkType, and other Standard Schema implementations. * @see https://standardschema.dev */ interface StandardTypedV1 { readonly '~standard': StandardTypedV1.Props; } declare namespace StandardTypedV1 { interface Props { readonly version: 1; readonly vendor: string; readonly types?: Types | undefined; } interface Types { readonly input: Input; readonly output: Output; } type InferInput = NonNullable['input']; type InferOutput = NonNullable['output']; } interface StandardSchemaV1 { readonly '~standard': StandardSchemaV1.Props; } declare namespace StandardSchemaV1 { interface Props extends StandardTypedV1.Props { readonly validate: (value: unknown, options?: Options | undefined) => Result | Promise>; } interface Options { readonly libraryOptions?: Record | undefined; } type Result = SuccessResult | FailureResult; interface SuccessResult { readonly value: Output; readonly issues?: undefined; } interface FailureResult { readonly issues: ReadonlyArray; } interface Issue { readonly message: string; readonly path?: ReadonlyArray | undefined; } interface PathSegment { readonly key: PropertyKey; } type InferInput = StandardTypedV1.InferInput; type InferOutput = StandardTypedV1.InferOutput; } interface StandardJSONSchemaV1 { readonly '~standard': StandardJSONSchemaV1.Props; } declare namespace StandardJSONSchemaV1 { interface Props extends StandardTypedV1.Props { readonly jsonSchema: Converter; } interface Converter { readonly input: (options: Options) => Record; readonly output: (options: Options) => Record; } type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | (object & string); interface Options { readonly target: Target; readonly libraryOptions?: Record | undefined; } type InferInput = StandardTypedV1.InferInput; type InferOutput = StandardTypedV1.InferOutput; } /** * Combined interface for schemas with both validation and JSON Schema conversion — * the intersection of {@linkcode StandardSchemaV1} and {@linkcode StandardJSONSchemaV1}. * * This is the type accepted by `registerTool` / `registerPrompt`. The SDK needs * `~standard.jsonSchema` to advertise the tool's argument shape in `tools/list`, and * `~standard.validate` to check incoming arguments when a `tools/call` arrives. * * Zod v4, ArkType, and Valibot (via `@valibot/to-json-schema`'s `toStandardJsonSchema`) * all implement both interfaces. * * @see https://standardschema.dev/ for the Standard Schema specification */ interface StandardSchemaWithJSON { readonly '~standard': StandardSchemaV1.Props & StandardJSONSchemaV1.Props; } declare namespace StandardSchemaWithJSON { type InferInput = StandardTypedV1.InferInput; type InferOutput = StandardTypedV1.InferOutput; } /** * Narrowing of {@linkcode StandardSchemaV1} whose `validate` is guaranteed synchronous. * * The Zod schemas backing `specTypeSchemas` contain no async refinements or transforms, * so every entry satisfies this interface. Consumers can call `validate()` and access * `.issues` / `.value` on the result without `await`. * * `StandardSchemaV1Sync` is assignable to `StandardSchemaV1` — it is a strict subtype. */ interface StandardSchemaV1Sync extends StandardSchemaV1 { readonly '~standard': StandardSchemaV1Sync.Props; } declare namespace StandardSchemaV1Sync { interface Props extends StandardSchemaV1.Props { readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => StandardSchemaV1.Result; } type InferInput = StandardTypedV1.InferInput; type InferOutput = StandardTypedV1.InferOutput; } //#endregion //#region ../core-internal/src/types/specTypeSchema.d.ts /** * Explicit allowlist of protocol Zod schemas that correspond to a public spec type in `types.ts`. * * This intentionally excludes internal helper schemas exported from `schemas.ts` that have no * matching public type (e.g. `ListChangedOptionsBaseSchema`, `BaseRequestParamsSchema`, * `NotificationsParamsSchema`, `ClientTasksCapabilitySchema`, `ServerTasksCapabilitySchema`). * Keeping the list explicit means new public spec types must be added here deliberately, and * internals never leak into `SpecTypeName`. * * `ResourceTemplateSchema` is included; its public type is exported as `ResourceTemplateType` * (the bare name collides with the server package's `ResourceTemplate` class), so * `SpecTypes['ResourceTemplate']` is structurally equal to `ResourceTemplateType` rather than to * a type literally named `ResourceTemplate`. */ 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"]; declare const authSchemas: { readonly IdJagTokenExchangeResponseSchema: z.ZodObject<{ issued_token_type: z.ZodLiteral<"urn:ietf:params:oauth:token-type:id-jag">; access_token: z.ZodString; token_type: z.ZodOptional; expires_in: z.ZodOptional; scope: z.ZodOptional; }, z.core.$strip>; readonly OAuthClientInformationFullSchema: z.ZodObject<{ redirect_uris: z.ZodArray; token_endpoint_auth_method: z.ZodOptional; grant_types: z.ZodOptional>; response_types: z.ZodOptional>; client_name: z.ZodOptional; client_uri: z.ZodOptional; logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; scope: z.ZodOptional; contacts: z.ZodOptional>; tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; policy_uri: z.ZodOptional; jwks_uri: z.ZodOptional; jwks: z.ZodOptional; software_id: z.ZodOptional; software_version: z.ZodOptional; software_statement: z.ZodOptional; client_id: z.ZodString; client_secret: z.ZodOptional; client_id_issued_at: z.ZodOptional; client_secret_expires_at: z.ZodOptional; }, z.core.$strip>; readonly OAuthClientInformationSchema: z.ZodObject<{ client_id: z.ZodString; client_secret: z.ZodOptional; client_id_issued_at: z.ZodOptional; client_secret_expires_at: z.ZodOptional; }, z.core.$strip>; readonly OAuthClientMetadataSchema: z.ZodObject<{ redirect_uris: z.ZodArray; token_endpoint_auth_method: z.ZodOptional; grant_types: z.ZodOptional>; response_types: z.ZodOptional>; client_name: z.ZodOptional; client_uri: z.ZodOptional; logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; scope: z.ZodOptional; contacts: z.ZodOptional>; tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; policy_uri: z.ZodOptional; jwks_uri: z.ZodOptional; jwks: z.ZodOptional; software_id: z.ZodOptional; software_version: z.ZodOptional; software_statement: z.ZodOptional; }, z.core.$strip>; readonly OAuthClientRegistrationErrorSchema: z.ZodObject<{ error: z.ZodString; error_description: z.ZodOptional; }, z.core.$strip>; readonly OAuthErrorResponseSchema: z.ZodObject<{ error: z.ZodString; error_description: z.ZodOptional; error_uri: z.ZodOptional; }, z.core.$strip>; readonly OAuthMetadataSchema: z.ZodObject<{ issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; service_documentation: z.ZodOptional; revocation_endpoint: z.ZodOptional; revocation_endpoint_auth_methods_supported: z.ZodOptional>; revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; introspection_endpoint: z.ZodOptional; introspection_endpoint_auth_methods_supported: z.ZodOptional>; introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; code_challenge_methods_supported: z.ZodOptional>; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$loose>; readonly OAuthProtectedResourceMetadataSchema: z.ZodObject<{ resource: z.ZodString; authorization_servers: z.ZodOptional>; jwks_uri: z.ZodOptional; scopes_supported: z.ZodOptional>; bearer_methods_supported: z.ZodOptional>; resource_signing_alg_values_supported: z.ZodOptional>; resource_name: z.ZodOptional; resource_documentation: z.ZodOptional; resource_policy_uri: z.ZodOptional; resource_tos_uri: z.ZodOptional; tls_client_certificate_bound_access_tokens: z.ZodOptional; authorization_details_types_supported: z.ZodOptional>; dpop_signing_alg_values_supported: z.ZodOptional>; dpop_bound_access_tokens_required: z.ZodOptional; }, z.core.$loose>; readonly OAuthTokenRevocationRequestSchema: z.ZodObject<{ token: z.ZodString; token_type_hint: z.ZodOptional; }, z.core.$strip>; readonly OAuthTokensSchema: z.ZodObject<{ access_token: z.ZodString; id_token: z.ZodOptional; token_type: z.ZodString; expires_in: z.ZodOptional>; scope: z.ZodOptional; refresh_token: z.ZodOptional; }, z.core.$strip>; readonly OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{ code_challenge_methods_supported: z.ZodOptional>; issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; userinfo_endpoint: z.ZodOptional; jwks_uri: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; acr_values_supported: z.ZodOptional>; subject_types_supported: z.ZodArray; id_token_signing_alg_values_supported: z.ZodArray; id_token_encryption_alg_values_supported: z.ZodOptional>; id_token_encryption_enc_values_supported: z.ZodOptional>; userinfo_signing_alg_values_supported: z.ZodOptional>; userinfo_encryption_alg_values_supported: z.ZodOptional>; userinfo_encryption_enc_values_supported: z.ZodOptional>; request_object_signing_alg_values_supported: z.ZodOptional>; request_object_encryption_alg_values_supported: z.ZodOptional>; request_object_encryption_enc_values_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; display_values_supported: z.ZodOptional>; claim_types_supported: z.ZodOptional>; claims_supported: z.ZodOptional>; service_documentation: z.ZodOptional; claims_locales_supported: z.ZodOptional>; ui_locales_supported: z.ZodOptional>; claims_parameter_supported: z.ZodOptional; request_parameter_supported: z.ZodOptional; request_uri_parameter_supported: z.ZodOptional; require_request_uri_registration: z.ZodOptional; op_policy_uri: z.ZodOptional; op_tos_uri: z.ZodOptional; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$strip>; readonly OpenIdProviderMetadataSchema: z.ZodObject<{ issuer: z.ZodString; authorization_endpoint: z.ZodURL; token_endpoint: z.ZodURL; userinfo_endpoint: z.ZodOptional; jwks_uri: z.ZodURL; registration_endpoint: z.ZodOptional; scopes_supported: z.ZodOptional>; response_types_supported: z.ZodArray; response_modes_supported: z.ZodOptional>; grant_types_supported: z.ZodOptional>; acr_values_supported: z.ZodOptional>; subject_types_supported: z.ZodArray; id_token_signing_alg_values_supported: z.ZodArray; id_token_encryption_alg_values_supported: z.ZodOptional>; id_token_encryption_enc_values_supported: z.ZodOptional>; userinfo_signing_alg_values_supported: z.ZodOptional>; userinfo_encryption_alg_values_supported: z.ZodOptional>; userinfo_encryption_enc_values_supported: z.ZodOptional>; request_object_signing_alg_values_supported: z.ZodOptional>; request_object_encryption_alg_values_supported: z.ZodOptional>; request_object_encryption_enc_values_supported: z.ZodOptional>; token_endpoint_auth_methods_supported: z.ZodOptional>; token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; display_values_supported: z.ZodOptional>; claim_types_supported: z.ZodOptional>; claims_supported: z.ZodOptional>; service_documentation: z.ZodOptional; claims_locales_supported: z.ZodOptional>; ui_locales_supported: z.ZodOptional>; claims_parameter_supported: z.ZodOptional; request_parameter_supported: z.ZodOptional; request_uri_parameter_supported: z.ZodOptional; require_request_uri_registration: z.ZodOptional; op_policy_uri: z.ZodOptional; op_tos_uri: z.ZodOptional; client_id_metadata_document_supported: z.ZodOptional; }, z.core.$loose>; }; type ProtocolSchemaKey = (typeof SPEC_SCHEMA_KEYS)[number]; type AuthSchemaKey = keyof typeof authSchemas; type SchemaKey = ProtocolSchemaKey | AuthSchemaKey; type SchemaFor = K$1 extends ProtocolSchemaKey ? (typeof schemas_d_exports)[K$1] : K$1 extends AuthSchemaKey ? (typeof authSchemas)[K$1] : never; type StripSchemaSuffix = K$1 extends `${infer N}Schema` ? N : never; /** * Union of every named type in the SDK's protocol and OAuth schemas (e.g. `'CallToolResult'`, * `'ContentBlock'`, `'Tool'`, `'OAuthTokens'`). Derived from the internal Zod schemas, so it stays * in sync with the spec. */ type SpecTypeName = StripSchemaSuffix; /** * Maps each {@linkcode SpecTypeName} to its TypeScript type. * * `SpecTypes['CallToolResult']` is equivalent to importing the `CallToolResult` type directly. */ type SpecTypes = { [K in SchemaKey as StripSchemaSuffix]: SchemaFor extends z.ZodType ? z.output> : never }; /** * Input shape for each {@linkcode SpecTypeName}. For most types this equals {@linkcode SpecTypes}, * but a few schemas apply defaults/preprocessing, so the accepted input may be looser than the * resulting output type. */ type SpecTypeInputs = { [K in SchemaKey as StripSchemaSuffix]: SchemaFor extends z.ZodType ? z.input> : never }; type SchemaRecord = { readonly [K in SpecTypeName]: StandardSchemaV1Sync }; type GuardRecord = { readonly [K in SpecTypeName]: (value: unknown) => value is SpecTypeInputs[K] }; /** * Runtime validators for every MCP spec type, keyed by type name. * * Use this when you need to validate a spec-defined shape at a boundary the SDK does not own, for * example an extension's custom-method payload that embeds a `CallToolResult`, or a value read from * storage that should be a `Tool`. * * Each entry implements the Standard Schema interface, so it composes with any * Standard-Schema-aware library. For a simple boolean check, use {@linkcode isSpecType} instead. * * @example * ```ts source="./specTypeSchema.examples.ts#specTypeSchemas_basicUsage" * const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted); * if (result.issues === undefined) { * // result.value is CallToolResult * } * ``` */ declare const specTypeSchemas: SchemaRecord; /** * Type predicates for every MCP spec type, keyed by type name. * * Returns `true` if the value satisfies the schema's input type (`z.input<>`, before defaults and * transforms are applied), and narrows to that input type. For schemas with `.default()` or * `.preprocess()`, this may accept values that do not structurally match the named output type; * for example `isSpecType.CallToolResult({})` is `true` because `content` has a default. Use * `specTypeSchemas.X['~standard'].validate(value)` when you need the validated output value. * * Each guard is a standalone function, so it can be passed directly as a callback. * * @example * ```ts source="./specTypeSchema.examples.ts#isSpecType_basicUsage" * if (isSpecType.ContentBlock(value)) { * // value is ContentBlock * } * * const blocks = mixed.filter(isSpecType.ContentBlock); * ``` */ declare const isSpecType: GuardRecord; //#endregion //#region ../core-internal/src/shared/metadataUtils.d.ts /** * Utilities for working with {@linkcode BaseMetadata} objects. */ /** * Gets the display name for an object with {@linkcode BaseMetadata}. * For tools, the precedence is: `title` → {@linkcode index.ToolAnnotations | annotations}.`title` → `name` * For other objects: `title` → `name` * This implements the spec requirement: "if no title is provided, name should be used for display purposes" */ declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & { annotations?: { title?: string; }; })): string; //#endregion //#region ../core-internal/src/shared/protocol.d.ts /** * Callback for progress notifications. */ type ProgressCallback = (progress: Progress) => void; /** * Additional initialization options. */ type ProtocolOptions = { /** * Protocol versions supported. First version is preferred (sent by client, * used as fallback by server). Passed to transport during {@linkcode Protocol.connect | connect()}. * * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS} */ supportedProtocolVersions?: string[]; /** * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities. * * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those. * * Currently this defaults to `false`, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to `true`. */ enforceStrictCapabilities?: boolean; /** * An array of notification method names that should be automatically debounced. * Any notifications with a method in this list will be coalesced if they * occur in the same tick of the event loop. * e.g., `['notifications/tools/list_changed']` */ debouncedNotificationMethods?: string[]; }; /** * The default request timeout, in milliseconds. */ declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000; /** * Options that can be given per request. */ type RequestOptions = { /** * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked. */ onprogress?: ProgressCallback; /** * Can be used to cancel an in-flight request. This will cause an `AbortError` to be raised from {@linkcode Protocol.request | request()}. */ signal?: AbortSignal; /** * 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()}. * * If not specified, {@linkcode DEFAULT_REQUEST_TIMEOUT_MSEC} will be used as the timeout. */ timeout?: number; /** * If `true`, receiving a progress notification will reset the request timeout. * This is useful for long-running operations that send periodic progress updates. * Default: `false` */ resetTimeoutOnProgress?: boolean; /** * Maximum total time (in milliseconds) to wait for a response. * If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised, regardless of progress notifications. * If not specified, there is no maximum total timeout. */ maxTotalTimeout?: number; } & TransportSendOptions; /** * Options that can be given per notification. */ type NotificationOptions = { /** * May be used to indicate to the transport which incoming request to associate this outgoing notification with. */ relatedRequestId?: RequestId; }; /** * Base context provided to all request handlers. */ type BaseContext = { /** * The session ID from the transport, if available. */ sessionId?: string; /** * Information about the MCP request being handled. */ mcpReq: { /** * The JSON-RPC ID of the request being handled. */ id: RequestId; /** * The method name of the request (e.g., 'tools/call', 'ping'). */ method: string; /** * Metadata from the original request. */ _meta?: RequestMeta; /** * An abort signal used to communicate if the request was cancelled from the sender's side. */ signal: AbortSignal; /** * Sends a request that relates to the current request being handled. * * This is used by certain transports to correctly associate related messages. * * For spec methods the result type is inferred from the method name. * For custom (non-spec) methods, pass a result schema as the second argument. */ send: { (request: { method: M; params?: Record; }, options?: RequestOptions): Promise; (request: Request$1, resultSchema: T, options?: RequestOptions): Promise>; }; /** * Sends a notification that relates to the current request being handled. * * This is used by certain transports to correctly associate related messages. */ notify: (notification: Notification) => Promise; }; /** * HTTP transport information, only available when using an HTTP-based transport. */ http?: { /** * Information about a validated access token, provided to request handlers. */ authInfo?: AuthInfo; }; }; /** * Context provided to server-side request handlers, extending {@linkcode BaseContext} with server-specific fields. */ type ServerContext = BaseContext & { mcpReq: { /** * Send a log message notification to the client. * Respects the client's log level filter set via logging/setLevel. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to stderr logging (STDIO servers) or OpenTelemetry. */ log: (level: LoggingLevel, data: unknown, logger?: string) => Promise; /** * Send an elicitation request to the client, requesting user input. */ elicitInput: (params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions) => Promise; /** * Request LLM sampling from the client. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to calling LLM provider APIs directly. */ requestSampling: (params: CreateMessageRequest['params'], options?: RequestOptions) => Promise; }; http?: { /** * The original HTTP request. */ req?: globalThis.Request; /** * Closes the SSE stream for this request, triggering client reconnection. * Only available when using a StreamableHTTPServerTransport with eventStore configured. */ closeSSE?: () => void; /** * Closes the standalone GET SSE stream, triggering client reconnection. * Only available when using a StreamableHTTPServerTransport with eventStore configured. */ closeStandaloneSSE?: () => void; }; }; /** * Context provided to client-side request handlers. */ type ClientContext = BaseContext; /** * Implements MCP protocol framing on top of a pluggable transport, including * features like request/response linking, notifications, and progress. * * `Protocol` is abstract; `Client` and `Server` are the concrete role-specific * implementations most code should use. */ declare abstract class Protocol { private _options?; private _transport?; private _requestMessageId; private _requestHandlers; private _requestHandlerAbortControllers; private _notificationHandlers; private _responseHandlers; private _progressHandlers; private _timeoutInfo; private _pendingDebouncedNotifications; protected _supportedProtocolVersions: string[]; /** * Callback for when the connection is closed for any reason. * * This is invoked when {@linkcode Protocol.close | close()} is called as well. */ onclose?: () => void; /** * Callback for when an error occurs. * * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band. */ onerror?: (error: Error) => void; /** * A handler to invoke for any request types that do not have their own handler installed. */ fallbackRequestHandler?: (request: JSONRPCRequest, ctx: ContextT) => Promise; /** * A handler to invoke for any notification types that do not have their own handler installed. */ fallbackNotificationHandler?: (notification: Notification) => Promise; constructor(_options?: ProtocolOptions | undefined); /** * Builds the context object for request handlers. Subclasses must override * to return the appropriate context type (e.g., ServerContext adds HTTP request info). */ protected abstract buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ContextT; private _oncancel; private _setupTimeout; private _resetTimeout; private _cleanupTimeout; /** * Attaches to the given transport, starts it, and starts listening for messages. * * 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. */ connect(transport: Transport): Promise; private _onclose; private _onerror; private _onnotification; private _onrequest; private _onprogress; private _onresponse; get transport(): Transport | undefined; /** * Closes the connection. */ close(): Promise; /** * A method to check if a capability is supported by the remote side, for the given method to be called. * * This should be implemented by subclasses. */ protected abstract assertCapabilityForMethod(method: RequestMethod | string): void; /** * A method to check if a notification is supported by the local side, for the given method to be sent. * * This should be implemented by subclasses. */ protected abstract assertNotificationCapability(method: NotificationMethod | string): void; /** * A method to check if a request handler is supported by the local side, for the given method to be handled. * * This should be implemented by subclasses. */ protected abstract assertRequestHandlerCapability(method: string): void; /** * Sends a request and waits for a response. * * For spec methods the result schema is resolved automatically from the method name * and the return type is method-keyed. For custom (non-spec) methods, pass a * `resultSchema` as the second argument; the response is validated against it and * the return type is inferred from the schema. * * Do not use this method to emit notifications! Use {@linkcode Protocol.notification | notification()} instead. */ request(request: { method: M; params?: Record; }, options?: RequestOptions): Promise; request(request: Request$1, resultSchema: T, options?: RequestOptions): Promise>; /** * Sends a request and waits for a response, using the provided schema for validation. * * This is the internal implementation used by SDK methods that need to specify * a particular result schema (e.g., for compatibility schemas). */ protected _requestWithSchema(request: Request$1, resultSchema: T, options?: RequestOptions): Promise>; /** * Emits a notification, which is a one-way message that does not expect a response. */ notification(notification: Notification, options?: NotificationOptions): Promise; /** * Registers a handler to invoke when this protocol object receives a request with the given method. * * Note that this will replace any previous request handler for the same method. * * For spec methods, pass `(method, handler)`; the request is parsed with the spec * schema and the handler receives the typed `Request`. For custom (non-spec) * methods, pass `(method, schemas, handler)`; `params` are validated against * `schemas.params` and the handler receives the parsed params object directly. * Supplying `schemas.result` types the handler's return value. * * @example Custom request method * ```ts source="./protocol.examples.ts#Protocol_setRequestHandler_customMethod" * const SearchParams = z.object({ query: z.string(), limit: z.number().optional() }); * const SearchResult = z.object({ hits: z.array(z.string()) }); * * protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => { * return { hits: [`result for ${params.query}`] }; * }); * ``` */ setRequestHandler(method: M, handler: (request: RequestTypeMap[M], ctx: ContextT) => ResultTypeMap[M] | Promise): void; setRequestHandler

(method: string, schemas: { params: P; result?: R; }, handler: (params: StandardSchemaV1.InferOutput

, ctx: ContextT) => InferHandlerResult | Promise>): void; /** * Hook for subclasses to wrap a registered request handler with role-specific * validation or behavior (e.g. `Server` validates `tools/call` results, `Client` * validates `elicitation/create` mode and result). Runs for both the 2-arg and * 3-arg registration paths. The default implementation is identity. * * Subclasses overriding this hook avoid redeclaring `setRequestHandler`'s overload set. */ protected _wrapHandler(_method: string, handler: (request: JSONRPCRequest, ctx: ContextT) => Promise): (request: JSONRPCRequest, ctx: ContextT) => Promise; /** * Removes the request handler for the given method. */ removeRequestHandler(method: RequestMethod | string): void; /** * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed. */ assertCanSetRequestHandler(method: RequestMethod | string): void; /** * Registers a handler to invoke when this protocol object receives a notification with the given method. * * Note that this will replace any previous notification handler for the same method. * * For spec methods, pass `(method, handler)`; the notification is parsed with the * spec schema. For custom (non-spec) methods, pass `(method, schemas, handler)`; * `params` are validated against `schemas.params` and the handler receives the * parsed params object directly. The raw notification is passed as the second * argument; `_meta` is recoverable via `notification.params?._meta`. */ setNotificationHandler(method: M, handler: (notification: NotificationTypeMap[M]) => void | Promise): void; setNotificationHandler

(method: string, schemas: { params: P; }, handler: (params: StandardSchemaV1.InferOutput

, notification: Notification) => void | Promise): void; /** * Removes the notification handler for the given method. */ removeNotificationHandler(method: NotificationMethod | string): void; } /** * Schema bundle accepted by {@linkcode Protocol.setRequestHandler | setRequestHandler}'s 3-arg form. * * `params` is required and validates the inbound `request.params`. `result` is optional; * when supplied it types the handler's return value (no runtime validation is performed * on the result). */ interface RequestHandlerSchemas

{ params: P; result?: R; } type InferHandlerResult = R extends StandardSchemaV1 ? StandardSchemaV1.InferOutput : Result$1; //#endregion //#region ../core-internal/src/shared/stdio.d.ts declare const STDIO_DEFAULT_MAX_BUFFER_SIZE: number; /** * Buffers a continuous stdio stream into discrete JSON-RPC messages. */ declare class ReadBuffer { private _buffer?; private _maxBufferSize; constructor(options?: { maxBufferSize?: number; }); append(chunk: Buffer): void; readMessage(): JSONRPCMessage | null; clear(): void; } declare function deserializeMessage(line: string): JSONRPCMessage; declare function serializeMessage(message: JSONRPCMessage): string; //#endregion //#region ../core-internal/src/shared/uriTemplate.d.ts type Variables = Record; declare class UriTemplate { /** * Returns true if the given string contains any URI template expressions. * A template expression is a sequence of characters enclosed in curly braces, * like `{foo}` or `{?bar}`. */ static isTemplate(str: string): boolean; private static validateLength; private readonly template; private readonly parts; get variableNames(): string[]; constructor(template: string); toString(): string; private parse; private getOperator; private getNames; private encodeValue; private expandPart; expand(variables: Variables): string; private escapeRegExp; private partToRegExp; match(uri: string): Variables | null; } //#endregion //#region ../core-internal/src/util/inMemory.d.ts /** * In-memory transport for creating clients and servers that talk to each other within the same process. * * Intended for testing and development. For production in-process connections, use * `StreamableHTTPClientTransport` against a local server URL. */ declare class InMemoryTransport implements Transport { private _otherTransport?; private _messageQueue; private _closed; onclose?: () => void; onerror?: (error: Error) => void; onmessage?: (message: JSONRPCMessage, extra?: { authInfo?: AuthInfo; }) => void; sessionId?: string; /** * 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}. */ static createLinkedPair(): [InMemoryTransport, InMemoryTransport]; start(): Promise; close(): Promise; /** * Sends a message with optional auth info. * This is useful for testing authentication scenarios. */ send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId; authInfo?: AuthInfo; }): Promise; } //#endregion //#region src/server/completable.d.ts declare const COMPLETABLE_SYMBOL: unique symbol; type CompleteCallback = (value: StandardSchemaV1.InferInput, context?: { arguments?: Record; }) => StandardSchemaV1.InferInput[] | Promise[]>; type CompletableMeta = { complete: CompleteCallback; }; type CompletableSchema = T & { [COMPLETABLE_SYMBOL]: CompletableMeta; }; /** * Wraps a schema to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP. * * @example * ```ts source="./completable.examples.ts#completable_basicUsage" * server.registerPrompt( * 'review-code', * { * title: 'Code Review', * argsSchema: z.object({ * language: completable(z.string().describe('Programming language'), value => * ['typescript', 'javascript', 'python', 'rust', 'go'].filter(lang => lang.startsWith(value)) * ) * }) * }, * ({ language }) => ({ * messages: [ * { * role: 'user' as const, * content: { * type: 'text' as const, * text: `Review this ${language} code.` * } * } * ] * }) * ); * ``` * * @see {@linkcode server/mcp.McpServer.registerPrompt | McpServer.registerPrompt} for using completable schemas in prompt argument definitions */ declare function completable(schema: T, complete: CompleteCallback): CompletableSchema; /** * Checks if a schema is completable (has completion metadata). */ declare function isCompletable(schema: unknown): schema is CompletableSchema; //#endregion //#region src/server/server.d.ts type ServerOptions = ProtocolOptions & { /** * Capabilities to advertise as being supported by this server. * * Note: per the MCP spec, a server that declares a capability MUST respond to that * capability's requests (e.g. `tools/list` for `tools`) — potentially with an empty * result — rather than with a "Method not found" error. {@linkcode server/mcp.McpServer | McpServer} * handles this automatically for capabilities declared here; when using the low-level * {@linkcode Server} directly, you are responsible for registering a request handler for * every capability you declare. */ capabilities?: ServerCapabilities; /** * Optional instructions describing how to use the server and its features. */ instructions?: string; /** * JSON Schema validator for elicitation response validation. * * The validator is used to validate user input returned from elicitation * requests against the requested schema. * * @default Runtime-selected validator (AJV-backed on Node.js, `@cfworker/json-schema`-backed on browser/workerd runtimes) */ jsonSchemaValidator?: jsonSchemaValidator; }; /** * An MCP server on top of a pluggable transport. * * This server will automatically respond to the initialization flow as initiated from the client. * * @deprecated Use {@linkcode server/mcp.McpServer | McpServer} instead for the high-level API. Only use `Server` for advanced use cases. */ declare class Server extends Protocol { private _serverInfo; private _clientCapabilities?; private _clientVersion?; private _negotiatedProtocolVersion?; private _capabilities; private _instructions?; private _jsonSchemaValidator; /** * Callback for when initialization has fully completed (i.e., the client has sent an `notifications/initialized` notification). */ oninitialized?: () => void; /** * Initializes this server with the given name and version information. */ constructor(_serverInfo: Implementation, options?: ServerOptions); /** * Registers the built-in `logging/setLevel` request handler. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to stderr logging (STDIO servers) or OpenTelemetry. */ private _registerLoggingHandler; protected buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ServerContext; private _loggingLevels; private readonly LOG_LEVEL_SEVERITY; private isMessageIgnored; /** * Registers new capabilities. This can only be called before connecting to a transport. * * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization). */ registerCapabilities(capabilities: ServerCapabilities): void; /** * Enforces server-side validation for `tools/call` results regardless of how the * handler was registered. */ protected _wrapHandler(method: string, handler: (request: JSONRPCRequest, ctx: ServerContext) => Promise): (request: JSONRPCRequest, ctx: ServerContext) => Promise; protected assertCapabilityForMethod(method: RequestMethod | string): void; protected assertNotificationCapability(method: NotificationMethod | string): void; protected assertRequestHandlerCapability(method: string): void; private _oninitialize; /** * After initialization has completed, this will be populated with the client's reported capabilities. */ getClientCapabilities(): ClientCapabilities | undefined; /** * After initialization has completed, this will be populated with information about the client's name and version. */ getClientVersion(): Implementation | undefined; /** * After initialization has completed, this will be populated with the protocol version negotiated * with the client (the version the server responded with during the initialize handshake), or * `undefined` before initialization. */ getNegotiatedProtocolVersion(): string | undefined; /** * Returns the current server capabilities. */ getCapabilities(): ServerCapabilities; ping(): Promise<{ _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } | undefined; } | undefined; resultType?: string | undefined; }>; /** * Request LLM sampling from the client (without tools). * Returns single content block for backwards compatibility. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to calling LLM provider APIs directly. */ createMessage(params: CreateMessageRequestParamsBase, options?: RequestOptions): Promise; /** * Request LLM sampling from the client with tool support. * Returns content that may be a single block or array (for parallel tool calls). * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to calling LLM provider APIs directly. */ createMessage(params: CreateMessageRequestParamsWithTools, options?: RequestOptions): Promise; /** * Request LLM sampling from the client. * When tools may or may not be present, returns the union type. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to calling LLM provider APIs directly. */ createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise; /** * Creates an elicitation request for the given parameters. * For backwards compatibility, `mode` may be omitted for form requests and will default to `"form"`. * @param params The parameters for the elicitation request. * @param options Optional request options. * @returns The result of the elicitation request. */ elicitInput(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): Promise; /** * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete` * notification for the specified elicitation ID. * * @param elicitationId The ID of the elicitation to mark as complete. * @param options Optional notification options. Useful when the completion notification should be related to a prior request. * @returns A function that emits the completion notification when awaited. */ createElicitationCompletionNotifier(elicitationId: string, options?: NotificationOptions): () => Promise; /** * Requests the list of roots from the client. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to passing paths via tool parameters, resource URIs, or configuration. */ listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<{ [x: string]: unknown; roots: { uri: string; name?: string | undefined; _meta?: Record | undefined; }[]; _meta?: { [x: string]: unknown; progressToken?: string | number | undefined; "io.modelcontextprotocol/related-task"?: { taskId: string; } | undefined; } | undefined; resultType?: string | undefined; }>; /** * Sends a logging message to the client, if connected. * Note: You only need to send the parameters object, not the entire JSON-RPC message. * @see {@linkcode LoggingMessageNotification} * @param params * @param sessionId Optional for stateless transports and backward compatibility. * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to stderr logging (STDIO servers) or OpenTelemetry. */ sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise; sendResourceUpdated(params: ResourceUpdatedNotification['params']): Promise; sendResourceListChanged(): Promise; sendToolListChanged(): Promise; sendPromptListChanged(): Promise; } //#endregion //#region src/server/mcp.d.ts /** * High-level MCP server that provides a simpler API for working with resources, tools, and prompts. * For advanced usage (like sending notifications or setting custom request handlers), use the underlying * {@linkcode Server} instance available via the {@linkcode McpServer.server | server} property. * * @example * ```ts source="./mcp.examples.ts#McpServer_basicUsage" * const server = new McpServer({ * name: 'my-server', * version: '1.0.0' * }); * ``` */ declare class McpServer { /** * The underlying {@linkcode Server} instance, useful for advanced operations like sending notifications. */ readonly server: Server; private _registeredResources; private _registeredResourceTemplates; private _registeredTools; private _registeredPrompts; constructor(serverInfo: Implementation, options?: ServerOptions); /** * Attaches to the given transport, starts it, and starts listening for messages. * * 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. * * @example * ```ts source="./mcp.examples.ts#McpServer_connect_stdio" * const server = new McpServer({ name: 'my-server', version: '1.0.0' }); * const transport = new StdioServerTransport(); * await server.connect(transport); * ``` */ connect(transport: Transport): Promise; /** * Closes the connection. */ close(): Promise; private _toolHandlersInitialized; private setToolRequestHandlers; /** * Creates a tool error result. * * @param errorMessage - The error message. * @returns The tool error result. */ private createToolError; /** * Validates tool input arguments against the tool's input schema. */ private validateToolInput; /** * Validates tool output against the tool's output schema. */ private validateToolOutput; /** * Executes a tool handler. */ private executeToolHandler; private _completionHandlerInitialized; private setCompletionRequestHandler; private handlePromptCompletion; private handleResourceCompletion; private _resourceHandlersInitialized; private setResourceRequestHandlers; private _promptHandlersInitialized; private setPromptRequestHandlers; /** * Registers a resource with a config object and callback. * For static resources, use a URI string. For dynamic resources, use a {@linkcode ResourceTemplate}. * * @example * ```ts source="./mcp.examples.ts#McpServer_registerResource_static" * server.registerResource( * 'config', * 'config://app', * { * title: 'Application Config', * mimeType: 'text/plain' * }, * async uri => ({ * contents: [{ uri: uri.href, text: 'App configuration here' }] * }) * ); * ``` */ registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource; registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate; private _createRegisteredResource; private _createRegisteredResourceTemplate; private _createRegisteredPrompt; private _createRegisteredTool; /** * Registers a tool with a config object and callback. * * @example * ```ts source="./mcp.examples.ts#McpServer_registerTool_basic" * server.registerTool( * 'calculate-bmi', * { * title: 'BMI Calculator', * description: 'Calculate Body Mass Index', * inputSchema: z.object({ * weightKg: z.number(), * heightM: z.number() * }), * outputSchema: z.object({ bmi: z.number() }) * }, * async ({ weightKg, heightM }) => { * const output = { bmi: weightKg / (heightM * heightM) }; * return { * content: [{ type: 'text', text: JSON.stringify(output) }], * structuredContent: output * }; * } * ); * ``` */ registerTool(name: string, config: { title?: string; description?: string; inputSchema?: InputArgs; outputSchema?: OutputArgs; annotations?: ToolAnnotations; icons?: Icon[]; _meta?: Record; }, cb: ToolCallback): RegisteredTool; /** @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()`. */ registerTool(name: string, config: { title?: string; description?: string; inputSchema?: InputArgs; outputSchema?: OutputArgs; annotations?: ToolAnnotations; icons?: Icon[]; _meta?: Record; }, cb: LegacyToolCallback): RegisteredTool; /** * Registers a prompt with a config object and callback. * * @example * ```ts source="./mcp.examples.ts#McpServer_registerPrompt_basic" * server.registerPrompt( * 'review-code', * { * title: 'Code Review', * description: 'Review code for best practices', * argsSchema: z.object({ code: z.string() }) * }, * ({ code }) => ({ * messages: [ * { * role: 'user' as const, * content: { * type: 'text' as const, * text: `Please review this code:\n\n${code}` * } * } * ] * }) * ); * ``` */ registerPrompt(name: string, config: { title?: string; description?: string; argsSchema?: Args; icons?: Icon[]; _meta?: Record; }, cb: PromptCallback): RegisteredPrompt; /** @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()`. */ registerPrompt(name: string, config: { title?: string; description?: string; argsSchema?: Args; icons?: Icon[]; _meta?: Record; }, cb: LegacyPromptCallback): RegisteredPrompt; /** * Checks if the server is connected to a transport. * @returns `true` if the server is connected */ isConnected(): boolean; /** * Sends a logging message to the client, if connected. * Note: You only need to send the parameters object, not the entire JSON-RPC message. * @see {@linkcode LoggingMessageNotification} * @param params * @param sessionId Optional for stateless transports and backward compatibility. * * @example * ```ts source="./mcp.examples.ts#McpServer_sendLoggingMessage_basic" * await server.sendLoggingMessage({ * level: 'info', * data: 'Processing complete' * }); * ``` * * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577). * Remains functional during the deprecation window (at least twelve months). * Migrate to stderr logging (STDIO servers) or OpenTelemetry. */ sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise; /** * Sends a resource list changed event to the client, if connected. */ sendResourceListChanged(): void; /** * Sends a tool list changed event to the client, if connected. */ sendToolListChanged(): void; /** * Sends a prompt list changed event to the client, if connected. */ sendPromptListChanged(): void; } /** * A callback to complete one variable within a resource template's URI template. */ type CompleteResourceTemplateCallback = (value: string, context?: { arguments?: Record; }) => string[] | Promise; /** * A resource template combines a URI pattern with optional functionality to enumerate * all resources matching that pattern. */ declare class ResourceTemplate { private _callbacks; private _uriTemplate; constructor(uriTemplate: string | UriTemplate, _callbacks: { /** * A callback to list all resources matching this template. This is required to be specified, even if `undefined`, to avoid accidentally forgetting resource listing. */ list: ListResourcesCallback | undefined; /** * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values. */ complete?: { [variable: string]: CompleteResourceTemplateCallback; }; }); /** * Gets the URI template pattern. */ get uriTemplate(): UriTemplate; /** * Gets the list callback, if one was provided. */ get listCallback(): ListResourcesCallback | undefined; /** * Gets the callback for completing a specific URI template variable, if one was provided. */ completeCallback(variable: string): CompleteResourceTemplateCallback | undefined; } /** * A plain record of Zod field schemas, e.g. `{ name: z.string() }`. Accepted by * `registerTool`/`registerPrompt` as a shorthand; auto-wrapped with `z.object()`. * Zod schemas only — `z.object()` cannot wrap other Standard Schema libraries. */ type ZodRawShape = Record; /** Infers the parsed-output type of a {@linkcode ZodRawShape}. */ type InferRawShape = z.infer>; /** {@linkcode ToolCallback} variant used when `inputSchema` is a {@linkcode ZodRawShape}. */ type LegacyToolCallback = Args extends ZodRawShape ? (args: InferRawShape, ctx: ServerContext) => CallToolResult | Promise : (ctx: ServerContext) => CallToolResult | Promise; /** {@linkcode PromptCallback} variant used when `argsSchema` is a {@linkcode ZodRawShape}. */ type LegacyPromptCallback = Args extends ZodRawShape ? (args: InferRawShape, ctx: ServerContext) => GetPromptResult | Promise : (ctx: ServerContext) => GetPromptResult | Promise; type BaseToolCallback = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput, ctx: Ctx) => SendResultT | Promise : (ctx: Ctx) => SendResultT | Promise; /** * Callback for a tool handler registered with {@linkcode McpServer.registerTool}. */ type ToolCallback = BaseToolCallback; /** * Tool handler callback type. */ type AnyToolHandler = ToolCallback; /** * Internal executor type that encapsulates handler invocation with proper types. */ type ToolExecutor = (args: unknown, ctx: ServerContext) => Promise; type RegisteredTool = { title?: string; description?: string; inputSchema?: StandardSchemaWithJSON; outputSchema?: StandardSchemaWithJSON; annotations?: ToolAnnotations; icons?: Icon[]; execution?: ToolExecution; _meta?: Record; handler: AnyToolHandler; /** @hidden */ executor: ToolExecutor; enabled: boolean; enable(): void; disable(): void; update(updates: { name?: string | null; title?: string; description?: string; paramsSchema?: StandardSchemaWithJSON; outputSchema?: StandardSchemaWithJSON; annotations?: ToolAnnotations; icons?: Icon[]; _meta?: Record; callback?: ToolCallback; enabled?: boolean; }): void; remove(): void; }; /** * Additional, optional information for annotating a resource. */ type ResourceMetadata = Omit; /** * Callback to list all resources matching a given template. */ type ListResourcesCallback = (ctx: ServerContext) => ListResourcesResult | Promise; /** * Callback to read a resource at a given URI. */ type ReadResourceCallback = (uri: URL, ctx: ServerContext) => ReadResourceResult | Promise; type RegisteredResource = { name: string; title?: string; metadata?: ResourceMetadata; readCallback: ReadResourceCallback; enabled: boolean; enable(): void; disable(): void; update(updates: { name?: string; title?: string; uri?: string | null; metadata?: ResourceMetadata; callback?: ReadResourceCallback; enabled?: boolean; }): void; remove(): void; }; /** * Callback to read a resource at a given URI, following a filled-in URI template. */ type ReadResourceTemplateCallback = (uri: URL, variables: Variables, ctx: ServerContext) => ReadResourceResult | Promise; type RegisteredResourceTemplate = { resourceTemplate: ResourceTemplate; title?: string; metadata?: ResourceMetadata; readCallback: ReadResourceTemplateCallback; enabled: boolean; enable(): void; disable(): void; update(updates: { name?: string | null; title?: string; template?: ResourceTemplate; metadata?: ResourceMetadata; callback?: ReadResourceTemplateCallback; enabled?: boolean; }): void; remove(): void; }; type PromptCallback = Args extends StandardSchemaWithJSON ? (args: StandardSchemaWithJSON.InferOutput, ctx: ServerContext) => GetPromptResult | Promise : (ctx: ServerContext) => GetPromptResult | Promise; /** * Internal handler type that encapsulates parsing and callback invocation. * This allows type-safe handling without runtime type assertions. */ type PromptHandler = (args: Record | undefined, ctx: ServerContext) => Promise; type RegisteredPrompt = { title?: string; description?: string; argsSchema?: StandardSchemaWithJSON; icons?: Icon[]; _meta?: Record; /** @hidden */ handler: PromptHandler; enabled: boolean; enable(): void; disable(): void; update(updates: { name?: string | null; title?: string; description?: string; argsSchema?: Args; icons?: Icon[]; _meta?: Record; callback?: PromptCallback; enabled?: boolean; }): void; remove(): void; }; //#endregion //#region src/server/middleware/hostHeaderValidation.d.ts type HostHeaderValidationResult = { ok: true; hostname: string; } | { ok: false; errorCode: 'missing_host' | 'invalid_host_header' | 'invalid_host'; message: string; hostHeader?: string; hostname?: string; }; /** * Parse and validate a `Host` header against an allowlist of hostnames (port-agnostic). * * - Input host header may include a port (e.g. `localhost:3000`) or IPv6 brackets (e.g. `[::1]:3000`). * - Allowlist items should be hostnames only (no ports). For IPv6, include brackets (e.g. `[::1]`). */ declare function validateHostHeader(hostHeader: string | null | undefined, allowedHostnames: string[]): HostHeaderValidationResult; /** * Convenience allowlist for `localhost` DNS rebinding protection. */ declare function localhostAllowedHostnames(): string[]; /** * Web-standard `Request` helper for DNS rebinding protection. * @example * ```ts source="./hostHeaderValidation.examples.ts#hostHeaderValidationResponse_basicUsage" * const result = validateHostHeader(req.headers.get('host'), ['localhost']); * ``` */ declare function hostHeaderValidationResponse(req: Request, allowedHostnames: string[]): Response | undefined; //#endregion //#region src/server/streamableHttp.d.ts type StreamId = string; type EventId = string; /** * Interface for resumability support via event storage */ interface EventStore { /** * Stores an event for later retrieval * @param streamId ID of the stream the event belongs to * @param message The JSON-RPC message to store * @returns The generated event ID for the stored event */ storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise; /** * Get the stream ID associated with a given event ID. * @param eventId The event ID to look up * @returns The stream ID, or `undefined` if not found * * Optional: If not provided, the SDK will use the `streamId` returned by * {@linkcode replayEventsAfter} for stream mapping. */ getStreamIdForEventId?(eventId: EventId): Promise; replayEventsAfter(lastEventId: EventId, { send }: { send: (eventId: EventId, message: JSONRPCMessage) => Promise; }): Promise; } /** * Configuration options for {@linkcode WebStandardStreamableHTTPServerTransport} */ interface WebStandardStreamableHTTPServerTransportOptions { /** * Function that generates a session ID for the transport. * The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash) * * If not provided, session management is disabled (stateless mode). */ sessionIdGenerator?: (() => string) | undefined; /** * A callback for session initialization events * This is called when the server initializes a new session. * Useful in cases when you need to register multiple mcp sessions * and need to keep track of them. * @param sessionId The generated session ID */ onsessioninitialized?: ((sessionId: string) => void | Promise) | undefined; /** * A callback for session close events * This is called when the server closes a session due to a `DELETE` request. * Useful in cases when you need to clean up resources associated with the session. * Note that this is different from the transport closing, if you are handling * HTTP requests from multiple nodes you might want to close each * {@linkcode WebStandardStreamableHTTPServerTransport} after a request is completed while still keeping the * session open/running. * @param sessionId The session ID that was closed */ onsessionclosed?: ((sessionId: string) => void | Promise) | undefined; /** * If `true`, the server will return JSON responses instead of starting an SSE stream. * This can be useful for simple request/response scenarios without streaming. * Default is `false` (SSE streams are preferred). */ enableJsonResponse?: boolean; /** * Event store for resumability support * If provided, resumability will be enabled, allowing clients to reconnect and resume messages */ eventStore?: EventStore; /** * List of allowed `Host` header values for DNS rebinding protection. * If not specified, host validation is disabled. * @deprecated Use external middleware for host validation instead. */ allowedHosts?: string[]; /** * List of allowed `Origin` header values for DNS rebinding protection. * If not specified, origin validation is disabled. * @deprecated Use external middleware for origin validation instead. */ allowedOrigins?: string[]; /** * Enable DNS rebinding protection (requires `allowedHosts` and/or `allowedOrigins` to be configured). * Default is `false` for backwards compatibility. * @deprecated Use external middleware for DNS rebinding protection instead. */ enableDnsRebindingProtection?: boolean; /** * Retry interval in milliseconds to suggest to clients in SSE `retry` field. * When set, the server will send a `retry` field in SSE priming events to control * client reconnection timing for polling behavior. */ retryInterval?: number; /** * List of protocol versions that this transport will accept. * Used to validate the `mcp-protocol-version` header in incoming requests. * * Note: When using {@linkcode server/server.Server.connect | Server.connect()}, the server automatically passes its * `supportedProtocolVersions` to the transport, so you typically don't need * to set this option directly. * * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS} */ supportedProtocolVersions?: string[]; } /** * Options for handling a request */ interface HandleRequestOptions { /** * Pre-parsed request body. If provided, the transport will use this instead of parsing `req.json()`. * Useful when using body-parser middleware that has already parsed the body. */ parsedBody?: unknown; /** * Authentication info from middleware. If provided, will be passed to message handlers. */ authInfo?: AuthInfo; } /** * Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification * using Web Standard APIs (`Request`, `Response`, `ReadableStream`). * * This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. * * In stateful mode: * - Session ID is generated and included in response headers * - Session ID is always included in initialization responses * - Requests with invalid session IDs are rejected with `404 Not Found` * - Non-initialization requests without a session ID are rejected with `400 Bad Request` * - State is maintained in-memory (connections, message history) * * In stateless mode: * - No Session ID is included in any responses * - No session validation is performed * * @example Stateful setup * ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_stateful" * const server = new McpServer({ name: 'my-server', version: '1.0.0' }); * * const transport = new WebStandardStreamableHTTPServerTransport({ * sessionIdGenerator: () => crypto.randomUUID() * }); * * await server.connect(transport); * ``` * * @example Stateless setup * ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_stateless" * const transport = new WebStandardStreamableHTTPServerTransport({ * sessionIdGenerator: undefined * }); * ``` * * @example Hono.js * ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_hono" * app.all('/mcp', async c => { * return transport.handleRequest(c.req.raw); * }); * ``` * * @example Cloudflare Workers * ```ts source="./streamableHttp.examples.ts#WebStandardStreamableHTTPServerTransport_workers" * const worker = { * async fetch(request: Request): Promise { * return transport.handleRequest(request); * } * }; * ``` */ declare class WebStandardStreamableHTTPServerTransport implements Transport { private sessionIdGenerator; private _started; private _closed; private _streamMapping; private _requestToStreamMapping; private _requestResponseMap; private _initialized; private _enableJsonResponse; private _standaloneSseStreamId; private _eventStore?; private _onsessioninitialized?; private _onsessionclosed?; private _allowedHosts?; private _allowedOrigins?; private _enableDnsRebindingProtection; private _retryInterval?; private _supportedProtocolVersions; sessionId?: string; onclose?: () => void; onerror?: (error: Error) => void; onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void; constructor(options?: WebStandardStreamableHTTPServerTransportOptions); /** * Starts the transport. This is required by the {@linkcode Transport} interface but is a no-op * for the Streamable HTTP transport as connections are managed per-request. */ start(): Promise; /** * Sets the supported protocol versions for header validation. * Called by the server during {@linkcode server/server.Server.connect | connect()} to pass its supported versions. */ setSupportedProtocolVersions(versions: string[]): void; /** * Helper to create a JSON error response */ private createJsonErrorResponse; /** * Validates request headers for DNS rebinding protection. * @returns Error response if validation fails, `undefined` if validation passes. */ private validateRequestHeaders; /** * Handles an incoming HTTP request, whether `GET`, `POST`, or `DELETE` * Returns a `Response` object (Web Standard) */ handleRequest(req: Request, options?: HandleRequestOptions): Promise; /** * Returns true if the client's protocol version supports empty SSE data in * priming events (the fix shipped with protocol version `2025-11-25`). * * The version is checked for membership in this transport instance's * supported protocol versions rather than with an open-ended * `>= '2025-11-25'` comparison: the value may come from an `initialize` * request body, which (unlike the `MCP-Protocol-Version` header) is not * validated against `supportedProtocolVersions` before reaching this * check. An unknown future version string must not silently enable * behavior reserved for versions this transport actually supports. */ private supportsEmptySSEData; /** * Writes a priming event to establish resumption capability. * Only sends if `eventStore` is configured (opt-in for resumability) and * the client's protocol version supports empty SSE data (a supported * version that is >= `2025-11-25`). */ private writePrimingEvent; /** * Handles `GET` requests for SSE stream */ private handleGetRequest; /** * Replays events that would have been sent after the specified event ID * Only used when resumability is enabled */ private replayEvents; /** * Writes an event to an SSE stream via controller with proper formatting */ private writeSSEEvent; /** * Handles unsupported requests (`PUT`, `PATCH`, etc.) */ private handleUnsupportedRequest; /** * Handles `POST` requests containing JSON-RPC messages */ private handlePostRequest; /** * Handles `DELETE` requests to terminate sessions */ private handleDeleteRequest; /** * Validates session ID for non-initialization requests. * Returns `Response` error if invalid, `undefined` otherwise */ private validateSession; /** * Validates the `MCP-Protocol-Version` header on incoming requests. * * For initialization: Version negotiation handles unknown versions gracefully * (server responds with its supported version). * * For subsequent requests with `MCP-Protocol-Version` header: * - Accept if in supported list * - 400 if unsupported * * For HTTP requests without the `MCP-Protocol-Version` header: * - Accept and default to the version negotiated at initialization */ private validateProtocolVersion; close(): Promise; /** * Close an SSE stream for a specific request, triggering client reconnection. * Use this to implement polling behavior during long-running operations - * client will reconnect after the retry interval specified in the priming event. */ closeSSEStream(requestId: RequestId): void; /** * Close the standalone `GET` SSE stream, triggering client reconnection. * Use this to implement polling behavior for server-initiated notifications. */ closeStandaloneSSEStream(): void; send(message: JSONRPCMessage, options?: { relatedRequestId?: RequestId; }): Promise; } //#endregion //#region src/fromJsonSchema.d.ts declare function fromJsonSchema(schema: JsonSchemaType, validator?: jsonSchemaValidator): StandardSchemaWithJSON; //#endregion 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 }; //# sourceMappingURL=index.d.mts.map