UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

66 lines (65 loc) 2.2 kB
/** * AgentShield API Delegation Verifier * * Queries delegations from AgentShield managed service API. * Includes local caching to minimize network calls and maximize performance. * * Performance: * - Fast path (cached): < 5ms * - Slow path (API call): < 100ms * - Cache TTL: 1 minute (configurable) * * API Endpoints: * - POST /api/v1/delegations/verify - Verify delegation by agent DID + scopes * - GET /api/v1/delegations/:id - Get delegation by ID * - POST /api/v1/delegations - Create new delegation (admin only) * - POST /api/v1/delegations/:id/revoke - Revoke delegation (admin only) * * Authentication: Bearer token via X-API-Key header * * Related: PHASE_1_XMCP_I_SERVER.md Ticket 1.3 * Related: AGENTSHIELD_DASHBOARD_PLAN.md Epic 2 (Public API) */ import { DelegationRecord } from "@kya-os/contracts/delegation"; import { DelegationVerifier, DelegationVerifierConfig, VerifyDelegationResult, VerifyDelegationOptions } from "./delegation-verifier"; /** * AgentShield API Delegation Verifier * * Managed mode: Queries delegations from AgentShield dashboard API */ export declare class AgentShieldAPIDelegationVerifier implements DelegationVerifier { private apiUrl; private apiKey; private cache; private cacheTtl; private debug; private accessControlService; constructor(config: DelegationVerifierConfig); /** * Verify agent delegation via API */ verify(agentDid: string, scopes: string[], options?: VerifyDelegationOptions): Promise<VerifyDelegationResult>; /** * Get delegation by ID via API */ get(delegationId: string): Promise<DelegationRecord | null>; /** * Store delegation (admin operation via API) * * Note: This is typically done via AgentShield dashboard UI, * not by the bouncer directly. Included for completeness. */ put(delegation: DelegationRecord): Promise<void>; /** * Revoke delegation via API */ revoke(delegationId: string, reason?: string): Promise<void>; /** * Close connections (cleanup) */ close(): Promise<void>; /** * Build deterministic scopes key for caching */ private buildScopesKey; }