import { AsyncLocalStorage } from "node:async_hooks"; /** * Session context for tracking MCP client information * Stored in AsyncLocalStorage to propagate through async operations */ export interface SessionContext { /** Session ID (same as mcp-session-id) */ sessionId: string; /** MCP client name from clientInfo (e.g., "claude-code", "cursor") */ clientName: string; /** MCP client version from clientInfo (e.g., "1.2.3") */ clientVersion: string; } /** * AsyncLocalStorage for session context * Allows tools to access session/client info without explicit parameter passing */ export declare const sessionContextStorage: AsyncLocalStorage; /** * Get the current session context * Returns undefined if not in a session context */ export declare function getSessionContext(): SessionContext | undefined; /** * Run a function with session context * The context will be available to all async operations within the function * * @example * ```typescript * await runWithSessionContext( * { sessionId: "abc", clientName: "claude-code", clientVersion: "1.0.0" }, * async () => { * // getSessionContext() returns the context here * const result = await someAsyncOperation(); * } * ); * ``` */ export declare function runWithSessionContext(context: SessionContext, fn: () => T | Promise): T | Promise; //# sourceMappingURL=sessionContext.d.ts.map