/** * MCP Adapter — Generic governance wrapper for any MCP tool call. * * Works with any MCP server, any client. No MCP SDK dependency. * Wraps tool calls with APS delegation checks and signed receipts. */ import { type RevocationCheckOptions } from '../core/delegation.js'; import type { Delegation, ActionReceipt, SignedPassport } from '../types/passport.js'; export interface MCPToolCall { name: string; arguments: Record; server?: string; } export interface MCPGovernanceConfig { passport: SignedPassport; delegation: Delegation; privateKey: string; scopePrefix?: string; destructiveTools?: string[]; onReceipt?: (r: ActionReceipt) => void; onDenied?: (info: { tool: string; reason: string; }) => void; /** Trust anchors for this gate: issuer public keys whose countersignature * is accepted. A NON-EMPTY list requires a valid countersignature from one * of them. An empty list, or omitting it, means this gate holds no * anchors; it does not mean "trust anyone". */ trustedIssuers?: string[]; /** Explicit wildcard trust: admit a passport whose only authority is its * own signature. Required to admit a self-signed credential, because a * signature that verifies under a key the passport itself supplied is not * an authorization by a trusted issuer. Default false. */ allowSelfSigned?: boolean; /** Revocation posture applied to the delegation check before every * governed call. This adapter is an execution gate: it verifies the * delegation immediately before the tool runs, which is exactly where a * caller who will not act on unknown revocation state says so. Pass * { revocationCheckPolicy: 'fail_closed', cachedRevocationState } to * refuse when revocation evidence is absent or stale. Omitted leaves the * previous behaviour, signature and expiry only. */ revocation?: RevocationCheckOptions; } /** Derive APS scope from MCP tool call */ export declare function mcpToolToScope(call: MCPToolCall, config: Pick): string; /** Govern a single MCP tool call */ export declare function governMCPToolCall(call: MCPToolCall, execute: (args: Record) => Promise, config: MCPGovernanceConfig): Promise<{ result: unknown; receipt: ActionReceipt; } | { denied: true; reason: string; receipt: ActionReceipt; }>; /** Create a governance interceptor for an MCP client */ export declare function createMCPGovernanceInterceptor(config: MCPGovernanceConfig): (call: MCPToolCall, execute: (args: Record) => Promise) => Promise<{ result: unknown; receipt: ActionReceipt; } | { denied: true; reason: string; receipt: ActionReceipt; }>; //# sourceMappingURL=mcp.d.ts.map