/** * MCP Server Middleware * * Creates an HTTP middleware for Harper's scope.server.http() that handles * MCP (Model Context Protocol) requests as direct JSON-RPC. * * Each knowledge base gets its own MCP endpoint at /mcp/. * The kbId is extracted from the URL path, validated against the * KnowledgeBase table, and passed to all tools implicitly via the caller. * * Auth: Validates JWT Bearer tokens issued by the co-located OAuth 2.1 * authorization server. Tokens are scoped to a specific KB via the * audience claim (aud = "{baseUrl}/mcp/{kbId}"). Unauthenticated * requests get read-only access. */ import type { HarperRequest } from '../types.ts'; /** * Create an MCP middleware function for Harper's scope.server.http(). * * The middleware: * 1. Checks if the request pathname starts with /mcp/ * 2. Extracts kbId from the path * 3. Validates the KB exists * 4. Validates Bearer token (scoped to this KB) * 5. Handles the MCP request via JSON-RPC dispatch */ export declare function createMcpMiddleware(): (request: HarperRequest, next: (req: HarperRequest) => Promise) => Promise; //# sourceMappingURL=server.d.ts.map