/** The stateless MCP revision (per-request `_meta`, no handshake). */ export declare const MCP_STATELESS_REVISION = "2026-07-28"; /** Handshake-based revisions this client can speak, newest first. */ export declare const MCP_LEGACY_REVISIONS: readonly ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"]; /** Every revision this client supports, newest first. */ export declare const MCP_SUPPORTED_VERSIONS: readonly string[]; /** First revision that defined the MCP-Protocol-Version HTTP header. */ export declare const MCP_HTTP_VERSION_HEADER_SINCE = "2025-06-18"; export declare const MCP_ERROR_HEADER_MISMATCH = -32020; export declare const MCP_ERROR_MISSING_CLIENT_CAPABILITY = -32021; export declare const MCP_ERROR_UNSUPPORTED_PROTOCOL_VERSION = -32022; export declare const JSONRPC_METHOD_NOT_FOUND = -32601; export declare const META_PROTOCOL_VERSION = "io.modelcontextprotocol/protocolVersion"; export declare const META_CLIENT_INFO = "io.modelcontextprotocol/clientInfo"; export declare const META_CLIENT_CAPABILITIES = "io.modelcontextprotocol/clientCapabilities"; export type McpEra = 'modern' | 'legacy'; export type McpTransportKind = 'stdio' | 'http'; /** The outcome of version negotiation, surfaced in diagnostics. */ export interface McpNegotiatedProtocol { readonly era: McpEra; readonly version: string; readonly transport: McpTransportKind; } export interface McpClientIdentity { readonly name: string; readonly version: string; } /** Revision identifiers are dates, so lexical order is chronological order. */ export declare function isModernVersion(version: string): boolean; /** Build the `_meta` object every modern-era request must carry. */ export declare function buildModernMeta(protocolVersion: string, clientInfo: McpClientIdentity, clientCapabilities: Record): Record; /** Merge modern `_meta` into request params, preserving caller-supplied `_meta` keys. */ export declare function withModernMeta(params: unknown, meta: Record): Record; /** Pick the newest version both sides support, or null when there is none. */ export declare function selectMutualVersion(serverSupported: readonly string[]): string | null; /** * A recognized modern JSON-RPC error code identifies a modern server during * era detection (the client retries/negotiates instead of falling back). */ export declare function isRecognizedModernErrorCode(code: number): boolean; /** Extract `data.supported` from an UnsupportedProtocolVersionError, if present. */ export declare function parseSupportedVersionsFromError(errorData: unknown): string[] | null; /** Extract `supportedVersions` from a DiscoverResult, if well-formed. */ export declare function parseDiscoverSupportedVersions(result: unknown): string[] | null; /** * Modern-era results carry `resultType`; `input_required` marks a Multi * Round-Trip Request interim result. Results from earlier-protocol servers * that omit the field are treated as complete, per the specification. */ export declare function isInputRequiredResult(result: unknown): result is { resultType: 'input_required'; inputRequests?: Record; requestState?: string; }; //# sourceMappingURL=protocol.d.ts.map