import express from "express"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"; import type { ClioTokens } from "../auth/oauth.js"; import { SessionContext, PendingBrokerSession } from "../utils/sessionContext.js"; import type { HttpAuthConfig } from "./httpAuth.js"; export interface SessionRecord { transport: StreamableHTTPServerTransport; mcpServer: McpServer | null; tokens: ClioTokens | null; pendingOAuthNonce: string | null; /** Broker mode: the PKCE verifier parked between authorize and callback. */ pendingBroker: PendingBrokerSession | null; /** Shared by concurrent tool calls so an expiring token is refreshed once per session. */ refreshInFlight: Promise | null; createdAt: number; } export interface HttpServerOptions { /** Leave the write tools unregistered for every session (READ_ONLY=true). */ readOnly?: boolean; } /** Exported for tests. */ export declare function buildSessionContext(record: SessionRecord, sessionId: string): SessionContext; /** * Build the Express app. The API-key gate is installed before every route, so * all methods on /mcp (POST, GET/SSE stream, DELETE) and any unknown path * return 401 without a valid key. Only PUBLIC_PATHS (/health and the OAuth * redirect target) are reachable without it. Exported for tests. */ export declare function createApp(auth: HttpAuthConfig, opts?: HttpServerOptions): express.Express; /** * Start the HTTP transport. Auth configuration is resolved first (and throws * with a clear message if MCP_API_KEY is missing or too short), so the server * never listens in a misconfigured state. */ export declare function startHttpServer(auth?: HttpAuthConfig, opts?: HttpServerOptions): void; //# sourceMappingURL=http.d.ts.map