/** * Streamable HTTP transport for the Misar.Blog MCP server. * * Builds the SAME server as the stdio binary — see `buildServer` — so the * hosted endpoint and the npm package can never drift apart. Auth is injected * by the host, because it depends on the MisarBlog database. * * Every request runs inside `runWithContext`, which is what makes one shared * tool implementation safe in a multi-tenant process: the credential lives in * AsyncLocalStorage for the duration of the call rather than in module state. */ /** An authenticated caller, as resolved by the host's `authenticate` hook. */ export interface BlogCaller { userId: string; /** The raw API key to forward to the REST API on this caller's behalf. */ apiKey: string; } /** Host-supplied hooks and configuration for {@link createBlogHttpHandler}. */ export interface BlogHttpOptions { /** Resolve an Authorization header to a caller, or null when invalid. */ authenticate: (authHeader: string | null) => Promise; /** * Optional per-caller rate limit, applied after authentication so the budget * is keyed to the API key rather than a shared client IP. Return false to * reject with 429. */ rateLimit?: (caller: BlogCaller) => Promise; /** API base the tools call, e.g. `https://www.misar.blog/api/v1`. */ baseUrl: string; onError?: (error: unknown) => void; } /** Handles one HTTP request against the MCP endpoint. */ export type BlogHttpHandler = (request: Request) => Promise; /** * Build a Web-standard request handler for the MCP endpoint. * * @param options Authentication, rate limiting and the API base URL. * @returns A handler taking a `Request` and resolving to a `Response`. */ export declare function createBlogHttpHandler(options: BlogHttpOptions): BlogHttpHandler; /** Standard CORS preflight response for the MCP endpoint. */ export declare function corsPreflight(): Response; //# sourceMappingURL=http.d.ts.map