/** * Platform-agnostic HTTP handler for the MCP server. * * Platform adapters (Node.js, Cloudflare Workers) convert their * native request/response types to/from Web Standard objects and * call the `handler` function returned by `createHttpHandler`. */ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { type HttpHandlerConfig, type ClientIpExtractor, type Logger } from './http-types.js'; /** * Create a platform-agnostic HTTP handler for the MCP server. * * @param createServer - Factory that returns a fresh McpServer per request. * The MCP SDK requires one Protocol/Server instance per connection, so each * request gets its own server + transport rather than sharing a singleton. * Callers decide the server's lifecycle/state model (stateless, per-session, …). * @param config - HTTP handler configuration * @param getClientIp - Platform-specific function to extract client IP from a Request * @param logger - Optional logger instance * @returns An object with: * - `handler`: async function that takes a Web Standard Request and returns a Response * - `cleanup`: function to stop the rate limiter cleanup interval */ export declare function createHttpHandler(createServer: () => McpServer, config: HttpHandlerConfig, getClientIp: ClientIpExtractor, logger?: Logger): { handler: (request: Request) => Promise; cleanup: () => void; }; //# sourceMappingURL=http-handler.d.ts.map