/** * Request context stored per session. * Contains HTTP headers and other request info needed for authentication. */ export interface RequestContext { headers: Record; method?: string; url?: string; ip?: string; } /** * Configuration for session manager. */ export interface SessionManagerConfig { /** Callback when a session is created */ onSessionCreated?: (sessionId: string) => void; /** Callback when a session is destroyed */ onSessionDestroyed?: (sessionId: string) => void; /** Logger function */ log?: (message: string) => void; } /** * Manages MCP transport sessions. */ export declare class SessionManager { private sessions; private requestContexts; private mcpServer; private config; constructor(config?: SessionManagerConfig); /** * Set the MCP server that transports will connect to. */ setMcpServer(server: any): void; /** * Generate a new session ID. */ generateSessionId(): string; /** * Check if a session exists. */ hasSession(sessionId: string): boolean; /** * Get an existing session's transport. */ getSession(sessionId: string): any | undefined; /** * Store request context (headers, etc.) for a session. * This is called when an HTTP request arrives, before dispatching to MCP. */ setRequestContext(sessionId: string, context: RequestContext): void; /** * Get the stored request context for a session. * Returns undefined if no context is stored. */ getRequestContext(sessionId: string): RequestContext | undefined; /** * Get or create a transport for a session. */ getOrCreateSession(sessionId: string): Promise; /** * Destroy a session. */ destroySession(sessionId: string): boolean; /** * Get all active session IDs. */ getActiveSessions(): string[]; /** * Get the number of active sessions. */ getSessionCount(): number; /** * Destroy all sessions. */ destroyAllSessions(): void; /** * Internal logging helper (no-op if log not provided). */ private log; } /** * Create a new session manager. */ export declare function createSessionManager(config?: SessionManagerConfig): SessionManager; //# sourceMappingURL=session-manager.d.ts.map