UNPKG

@kya-os/mcp-i

Version:

COMING SOON:Production-ready MCP Identity with automatic registration, key rotation, and optimized performance

207 lines (206 loc) 5.3 kB
export type RegistryName = string; export type RegistryTier = 'verified'; export interface RegistryConfig { include?: string[] | 'verified'; exclude?: string[]; } export interface RegistryStatus { name: string; status: 'active' | 'pending' | 'failed'; registeredAt?: string; type?: 'primary' | 'secondary'; error?: string; } export interface RegistryAdapter { name: string; type: 'primary' | 'secondary'; publish(data: any): Promise<any>; verify?(did: string): Promise<boolean>; } export interface RegistryPublishData { did: string; name: string; description?: string; repository?: string; publicKey: string; metadata?: Record<string, any>; } export interface RegistryPublishResult { success: boolean; registryAgentId?: string; profileUrl?: string; error?: string; claimUrl?: string; claimToken?: string; generatedKeys?: { publicKey: string; privateKey: string; warning: string; }; } export type DirectoryPreference = string[] | 'verified' | 'none'; export type DirectoryName = 'smithery' | 'glama' | string; export interface MCPIdentityProgressEvent { stage: 'checking_existing' | 'generating_keys' | 'registering' | 'saving' | 'complete'; progress: number; message?: string; data?: any; } export interface MCPIdentityProgressCallback { (event: MCPIdentityProgressEvent): void; } export interface MCPIdentityOptions { name?: string; description?: string; repository?: string; apiEndpoint?: string; persistencePath?: string; storage?: 'file' | 'memory' | 'auto'; memoryKey?: string; transport?: 'axios' | 'fetch' | 'auto'; processingMode?: 'sync' | 'async' | 'auto'; registryEndpoint?: 'cli' | 'auto-register' | 'auto'; timestampTolerance?: number; enableNonceTracking?: boolean; encryptionPassword?: string; directories?: DirectoryPreference; mode?: 'development' | 'production'; logger?: Logger; logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent'; onProgress?: MCPIdentityProgressCallback; registrationPollInterval?: number; registrationMaxPollingTime?: number; registrationPollBackoff?: boolean; } export interface MCPServer { setRequestHandler(method: string, handler: Function): void; connect(transport: any): Promise<void>; serverInfo?: { capabilities?: Record<string, any>; }; } export interface MCPMiddleware { (server: MCPServer, identity: any): void; } export interface MCPRequest<T = any> { method: string; params?: T; } export interface MCPResponse<T = any> { content?: T; error?: { code: number; message: string; }; } export interface Logger { debug(message: string, ...args: any[]): void; info(message: string, ...args: any[]): void; warn(message: string, ...args: any[]): void; error(message: string, ...args: any[]): void; } export interface AutoRegisterResponse { success: boolean; did: string; agent: { id: string; slug: string; name: string; url: string; }; keys: { publicKey: string; privateKey?: string; }; } export interface AsyncRegistrationResponse { success: boolean; jobId: string; status: string; message: string; estimatedTime: string; } export interface RegistrationStatusResponse { jobId: string; status: 'pending' | 'processing' | 'completed' | 'failed'; result?: AutoRegisterResponse; error?: { message: string; code?: string; }; progress?: number; estimatedTimeRemaining?: number; } export interface CLIRegisterRequest { name: string; description?: string; repository?: string; publicKey?: string; } export interface CLIRegisterResponse { success: boolean; did: string; agent: { id: string; slug: string; name: string; url: string; }; claimUrl: string; claimToken: string; keys?: { publicKey: string; privateKey: string; warning: string; }; responseTime: number; } export interface PersistedIdentity { did: string; publicKey: string; privateKey: string; agentId: string; agentSlug: string; registeredAt: string; directories?: DirectoryPreference; } export interface RegistrationData { name: string; description?: string; repository?: string; publicKey?: string; directories?: DirectoryPreference; metadata?: Record<string, any>; } export interface Challenge { nonce: string; timestamp: number; verifier_did?: string; scope?: string[]; } export interface ChallengeResponse { did: string; signature: string; timestamp: number; nonce: string; publicKey?: string; } export interface MCPICapabilities { version: string; did: string; publicKey: string; conformanceLevel: number; handshakeSupported: boolean; handshakeEndpoint?: string; verificationEndpoint?: string; registry?: string; } export interface SignedResponse<T = any> { [key: string]: any; _mcp_identity: { did: string; signature: string; timestamp: string; conformanceLevel?: number; }; }