UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

119 lines (118 loc) 3.06 kB
/** * XMCP-I Debug Tools - Development-only debug endpoints * * Provides /verify endpoint for proof inspection and debugging * in development environments only. */ import { AgentIdentity } from "./identity"; import { SessionContext } from "@kya-os/contracts/handshake"; import { DetachedProof, ProofMeta } from "@kya-os/contracts/proof"; import { DIDDocument, AgentDocument } from "./well-known"; /** * Debug verification result */ export interface DebugVerificationResult { success: boolean; signature: { valid: boolean; algorithm: string; kid: string; }; proof: { valid: boolean; timestamp: { valid: boolean; skew: number; remediation?: string; }; hashes: { requestValid: boolean; responseValid: boolean; }; }; session: { valid: boolean; expired: boolean; ttl: number; }; errors?: string[]; } /** * Debug page data structure */ export interface DebugPageData { identity: { did: string; kid: string; didDocumentUrl: string; }; registry: { ktaUrl: string; mcpMirrorStatus: "pending" | "success" | "error" | "unknown"; mcpMirrorUrl?: string; }; capabilities: { protocol: string[]; identity: string[]; source: "well-known" | "handshake"; }; proof?: { jws: string; meta: ProofMeta; canonicalHashes: { requestHash: string; responseHash: string; }; }; verification?: DebugVerificationResult; logRoot?: string; timestamp: number; environment: "development" | "production"; } /** * Debug endpoint manager */ export declare class DebugManager { private identity; private environment; private lastProof?; private lastSession?; private logRoot?; constructor(identity: AgentIdentity, environment?: "development" | "production"); /** * Update debug state with latest proof and session */ updateDebugState(proof: DetachedProof, session: SessionContext): void; /** * Set log root for receipt verification */ setLogRoot(logRoot: string): void; /** * Generate debug page data */ generateDebugPageData(_didDocument?: DIDDocument, agentDocument?: AgentDocument, logRoot?: string): Promise<DebugPageData>; /** * Create debug endpoint handler */ createDebugHandler(): (_request: any) => Promise<Response>; /** * Perform local verification of proof */ private performLocalVerification; /** * Generate DID document URL */ private generateDIDDocumentUrl; /** * Generate KTA URL */ private generateKTAUrl; /** * Generate debug HTML page */ private generateDebugHTML; } /** * Create debug endpoint handler for development */ export declare function createDebugEndpoint(identity: AgentIdentity, environment?: "development" | "production"): DebugManager;