import type { IncomingMessage, ServerResponse } from "node:http"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; /** * Builds a Node HTTP request listener that routes each request to the * StreamableHTTPServerTransport for its MCP session. A new transport (and * MCP server, via `createServer`) is instantiated per session and keyed by * the Mcp-Session-Id header, per the SDK's documented stateful multi-session * pattern — a single shared transport rejects every session after the first. * * Also serves an unauthenticated `GET /health` (cache liveness) and bounds the * session map so a client killed mid-turn (which never fires `transport.onclose`) * can't leak transports on this long-lived shared process. */ export declare function createHttpRequestListener(createServer: () => McpServer): (req: IncomingMessage, res: ServerResponse) => void;