@kya-os/mcp-i
Version:
COMING SOON:Production-ready MCP Identity with automatic registration, key rotation, and optimized performance
129 lines • 3.88 kB
TypeScript
/**
* @kya-os/mcp-i - Optimized MCP Identity with production features
*
* Enable any MCP server to get a verifiable identity with just 2 lines of code:
*
* ```typescript
* import "@kya-os/mcp-i/auto"; // That's it! Your server now has identity
* ```
*/
import { MCPIdentityOptions, Challenge, ChallengeResponse, MCPICapabilities, SignedResponse, MCPMiddleware, DirectoryPreference } from './types';
import { KeyRotationResult, KeyHealth } from './rotation';
export * from './types';
export * from './vercel-adapter';
export { RegistryFactory, REGISTRY_TIERS, resolveRegistries } from './registry';
export { LoggerFactory, ConsoleLogger, SilentLogger } from './logger';
export { StorageFactory, MemoryStorage, FileStorage } from './storage';
export { TransportFactory, RuntimeDetector } from './transport';
export { KeyRotationManager } from './rotation';
export { initWithDevExperience, showAgentStatus } from './dev-helper';
export { pollRegistrationStatus, isAsyncRegistrationResponse } from './polling';
export declare class MCPIdentity {
readonly did: string;
readonly publicKey: string;
private privateKey;
private timestampTolerance;
private enableNonceTracking;
private usedNonces;
private nonceCleanupInterval?;
private encryptionPassword?;
private decryptedPrivateKey?;
private directories;
private storage;
private transport;
private logger;
private rotationManager?;
private precomputed;
private constructor();
/**
* Initialize MCP Identity - the main entry point
*/
static init(options?: MCPIdentityOptions): Promise<MCPIdentity>;
/**
* Enable automatic key rotation
*/
enableAutoRotation(policy?: {
maxAge?: number;
maxSignatures?: number;
}): Promise<void>;
/**
* Manually rotate keys
*/
rotateKeys(reason?: string): Promise<KeyRotationResult>;
/**
* Check key health
*/
checkKeyHealth(): KeyHealth | null;
/**
* Get decrypted private key (lazy decryption)
*/
private getPrivateKey;
/**
* Sign a message with caching
*/
sign(message: string | Buffer): Promise<string>;
/**
* Request edit access with claim URL support
*/
requestEditAccess(): Promise<{
editUrl: string;
claimUrl?: string;
}>;
/**
* Verify a signature
*/
verify(message: string | Buffer, signature: string, publicKey?: string): Promise<boolean>;
/**
* Respond to an MCP-I challenge
*/
respondToChallenge(challenge: Challenge): Promise<ChallengeResponse>;
/**
* Get MCP-I capabilities for advertisement
*/
getCapabilities(): MCPICapabilities;
/**
* Sign an MCP response with identity metadata
*/
signResponse<T = any>(response: T): Promise<SignedResponse<T>>;
/**
* Generate a new nonce for challenges
*/
static generateNonce(): string;
/**
* Get directory preferences
*/
getDirectories(): DirectoryPreference;
/**
* Clean up old nonces periodically to prevent memory leaks
*/
private startNonceCleanup;
/**
* Clean up resources
*/
destroy(): void;
/**
* Helper to extract agent name from DID
*/
private extractAgentName;
/**
* Helper to extract agent ID
*/
private extractAgentId;
/**
* Helper to extract agent slug
*/
private extractAgentSlug;
/**
* Persist full identity (for key rotation)
*/
private persistIdentity;
}
/**
* Enable MCP Identity for any MCP server
*/
export declare function enableMCPIdentity(options?: MCPIdentityOptions): Promise<MCPIdentity>;
/**
* Create MCP middleware for manual integration
*/
export declare function createMCPMiddleware(identity: MCPIdentity): MCPMiddleware;
//# sourceMappingURL=index.d.ts.map