import { type ZodType } from '@frontmcp/lazy-zod'; import { type RequestId } from '@frontmcp/protocol'; import { type ServerResponse } from '../../common'; import { type ElicitOptions, type ElicitResult } from '../../elicitation'; import { type AuthenticatedServerRequest } from '../../server/server.types'; import { type TransportType } from '../transport.types'; import { RecreateableStreamableHTTPServerTransport } from './streamable-http-transport'; import { LocalTransportAdapter } from './transport.local.adapter'; /** * Resolves the session ID generator for the transport. * * For stateless-http, returns a generator that always yields '__stateless__' * so the MCP SDK sets the Mcp-Session-Id response header (required by the * MCP spec for streamable HTTP). The per-request recreation logic uses the * dedicated `isStateless` flag instead of checking sessionIdGenerator. */ export declare const resolveSessionIdGenerator: (transportType: TransportType, sessionId: string) => (() => string) | undefined; export declare class TransportStreamableHttpAdapter extends LocalTransportAdapter { createTransport(sessionId: string, response: ServerResponse): RecreateableStreamableHTTPServerTransport; initialize(req: AuthenticatedServerRequest, res: ServerResponse): Promise; handleRequest(req: AuthenticatedServerRequest, res: ServerResponse): Promise; /** * Send an elicitation request to the client. * * Only one elicit per session is allowed. A new elicit will cancel any pending one. * On timeout, an ElicitationTimeoutError is thrown to kill tool execution. * * Uses the ElicitationRequestFlow for preparation (validation, ID generation, * storing pending record, building params) with hook support for middleware. * * In distributed mode, the pending elicitation is stored in Redis and results * are routed via pub/sub, allowing the response to be received by any node. * * @param relatedRequestId - The request ID that triggered this elicit * @param message - Message to display to the user * @param requestedSchema - Zod schema for the expected response * @param options - Elicit options (mode, ttl, elicitationId) * @returns ElicitResult with status and typed content */ sendElicitRequest(relatedRequestId: RequestId, message: string, requestedSchema: S, options?: ElicitOptions): Promise ? O : unknown>>; get isInitialized(): boolean; /** * Resets the transport's initialization state to allow re-initialization. * Used when a client retries initialize on an already-initialized session * (e.g., after reconnect following session termination). */ resetForReinitialization(): void; /** * Marks this transport as pre-initialized for session recreation. * This is needed when recreating a transport from Redis because the * original initialize request was processed by a different transport instance. * * Uses the RecreateableStreamableHTTPServerTransport's public API to set * initialization state, avoiding access to private properties. */ markAsInitialized(): void; } //# sourceMappingURL=transport.streamable-http.adapter.d.ts.map