/** * `warden-mcp gateway`: the proxy in front of an OpenAPI tool server (OpenWebUI's "OpenAPI tool servers", `mcpo`). * Every operation in the server's `openapi.json` is a tool named by its `operationId`; to the flow policy it is * `mcp____`. Operation descriptions get the same gates and pinning as an MCP `tools/list`, and the * spec the client receives lists only the operations the verdict allows. A call is matched to its operation, judged * by the decision service, forwarded, recorded and screened. */ import type { IncomingMessage, ServerResponse } from 'node:http'; import type { ToolDef } from './types.js'; import type { GatewayConfig, GatewayServer } from './gateway-config.js'; import { Decider, type Who } from './gateway-decide.js'; interface Operation { id: string; method: string; path: string; regex: RegExp; params: string[]; tool: ToolDef; literal: number; } /** OpenAPI's own rule: a path with more literal segments wins over a templated one (`/files/purge` over `/files/{name}`). */ export declare function matchOperation(ops: Operation[], method: string, path: string): Operation; /** The spec's operations as tools, in the shape the MCP gates read. */ export declare function operationsOf(spec: unknown): Operation[]; export declare class OpenApiProxy { private server; private config; private decider; private logLine; private readonly ref; private readonly store; private feed?; /** The last vetted spec, by the digest of its bytes: an unchanged spec is not vetted again, a changed one always is. */ private allowed?; constructor(server: GatewayServer, config: GatewayConfig, decider: Decider, logLine: (m: string) => void); private base; private fetchUp; private text; /** * Fetch the spec on every request (the spec read and every call), vet the operations when the spec changed, keep the * allowed ones. A server that changes its spec between two calls is checked before the second call runs. */ check(): Promise<{ ops: Operation[]; spec: Record; }>; private json; handle(req: IncomingMessage, res: ServerResponse, sub: string, query: string, body: string, who: Who): Promise; } export {}; //# sourceMappingURL=gateway-openapi.d.ts.map