import { K as Krikos } from '../types-iaO2gHBL.js'; /** * Model Context Protocol (MCP) identity validation for Krikos. * * An MCP server can require that a connecting agent prove its identity and hold the right * capability before a request is honored. Krikos provides the gate: map an MCP method (and, for * `tools/call`, the tool name) to a capability requirement, then authorize the acting agent * against the registry before dispatching. A denied request is recorded in the audit trail. * * Structural by design: Krikos imports nothing from any MCP SDK. The request shape is matched by * structure. * * @packageDocumentation */ /** A minimal structural MCP request: a method, and optional params carrying a tool name. */ interface McpRequestLike { /** The JSON-RPC method, for example `tools/call`, `resources/read`, `prompts/get`. */ readonly method: string; /** Optional params; for `tools/call` the tool name lives at `params.name`. */ readonly params?: { readonly name?: string; readonly [key: string]: unknown; }; } /** The capability a method (or method plus tool) requires. */ interface McpCapability { /** The capability name required. */ readonly capability: string; /** The action required. Defaults to the method (or tool name for `tools/call`). */ readonly action?: string; } /** * A mapping from MCP route to capability requirement. A route is either a bare method * (`resources/read`) or a method plus tool name joined by a colon (`tools/call:deploy`). The more * specific tool route wins when both are present. */ type McpCapabilityMap = Readonly>; /** * Builds an MCP identity guard bound to a registry and a capability map. * * The returned function authorizes one request for one agent: it resolves the request's route, * looks up its capability requirement (a tool-specific route takes precedence over the bare * method), and authorizes the agent. A route with no mapping is denied by default when * `denyUnmapped` is true (the safe posture), or allowed when false. Every decision is recorded. * * @param krikos - The registry holding agent identities. * @param mapping - Route-to-capability requirements. * @param options - `denyUnmapped` defaults to true (fail-closed for unmapped routes). * @returns A guard `(agentId, request) => boolean`. */ declare function mcpIdentityGuard(krikos: Krikos, mapping: McpCapabilityMap, options?: { readonly denyUnmapped?: boolean; }): (agentId: string, request: McpRequestLike) => boolean; export { type McpCapability, type McpCapabilityMap, type McpRequestLike, mcpIdentityGuard };