import { readLock, type LockFile } from './scan-lock.js'; /** * WARDEN as an MCP Interceptor Server. * * Interceptors are the extension the MCP Interceptors Working Group is specifying (SEP-2624, * modelcontextprotocol/experimental-ext-interceptors): a client, a server or a gateway calls * `interceptors/list` and `interceptor/invoke` on a server like this one at fixed points of a * request, and acts on the answer. A validator inspects and returns a decision; it never changes * the payload. * * This server has two validators, both on the response to `tools/list`: the moment a tool set * reaches a client and before a model reads it. * * - {@link INTEGRITY}: is this the tool set that was approved? It computes the contract and * extras digests of `mcp-tool-set-digest/1` and compares them with the expected ones, which * the invoker passes in `config` or which come from a `warden.lock.json` the server was * started with. * - {@link SCAN}: does a definition carry instructions for the model? WARDEN's static scan. * * The server keeps no state: what a call is compared with arrives with the call, as the proposal * asks ("configuration is passed on each invocation so that Interceptor Servers can remain * stateless"), or is read from a lock file that only `scan --update-lock` writes. * * Written against the proposal as of experimental-ext-interceptors 07c89a24 (2026-10-28). The * extension is experimental and its wire format may change. */ export declare const INTERCEPTORS_EXTENSION = "io.modelcontextprotocol/interceptors"; export declare const INTEGRITY = "warden.tool-definition-integrity"; export declare const SCAN = "warden.tool-definition-scan"; export declare const SUPPORTED_EVENTS: readonly ['tools/list']; type Phase = 'request' | 'response'; type Level = 'info' | 'warn' | 'error'; export interface ValidationMessage { path?: string; message: string; severity: Level; } /** `ValidationResult` of the proposal (section "Validator"). */ export interface ValidationResult { interceptor: string; type: 'validation'; phase: Phase; durationMs?: number; info?: Record; valid: boolean; severity?: Level; messages?: ValidationMessage[]; } /** A request this server refuses, as a JSON-RPC error: `code`, `message` and `data`. */ export declare class InterceptorError extends Error { readonly code: number; readonly data: Record; constructor(code: number, message: string, data: Record); } export interface InterceptorDeps { /** A `warden.lock.json`, when the server was started with `--lock`. */ lock?: LockFile; now?: () => number; } /** The descriptors `interceptors/list` returns. */ export declare function interceptorDescriptors(version: string): Array>; /** The `tools` array of a `tools/list` response payload: the result, the JSON-RPC response, or the array. */ export declare function toolsOf(payload: unknown): unknown[] | undefined; /** `interceptor/invoke`: run one validator over one payload. Throws {@link InterceptorError}. */ export declare function invokeInterceptor(params: unknown, deps?: InterceptorDeps): Promise; export { readLock }; //# sourceMappingURL=interceptor.d.ts.map