/** * HTTP handlers for MCP endpoints. * Provides POST, GET, and DELETE handlers for the /mcp endpoint. */ import { AsyncLocalStorage } from 'async_hooks'; import type { Request, Response, Router } from 'express'; import type { SessionManager, RequestContext } from './session-manager.js'; /** * AsyncLocalStorage to store request context within the async flow. * This allows handlers deep in the call stack to access HTTP headers. */ export declare const requestContextStorage: AsyncLocalStorage; /** * Get the current request context from AsyncLocalStorage. * Returns undefined if not in a request context. */ export declare function getCurrentRequestContext(): RequestContext | undefined; /** * Configuration for MCP handlers. */ export interface McpHandlerConfig { /** Session manager instance */ sessionManager: SessionManager; /** Whether to require authentication (default: true) */ requireAuth?: boolean; /** Logger function */ log?: (message: string) => void; } /** * Create the POST /mcp handler. */ export declare function createPostMcpHandler(config: McpHandlerConfig): (req: Request, res: Response) => Promise; /** * Create the GET /mcp handler (SSE stream). */ export declare function createGetMcpHandler(config: McpHandlerConfig): (req: Request, res: Response) => Promise; /** * Create the DELETE /mcp handler (session termination). */ export declare function createDeleteMcpHandler(config: McpHandlerConfig): (req: Request, res: Response) => Promise; /** * Mount all MCP handlers on an Express router. */ export declare function mountMcpHandlers(router: Router, config: McpHandlerConfig): void; //# sourceMappingURL=mcp-handler.d.ts.map