UNPKG

@kya-os/mcp-i

Version:

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

59 lines 1.96 kB
/** * CLI Mode for MCP-I Package * @internal - For use by @kya-os/cli package only * @private * * This module provides a specialized interface for the KYA-OS CLI * with enhanced progress reporting and silent logging by default. */ import { enableMCPIdentity } from './index.js'; /** * Enable MCP Identity with CLI-optimized defaults * @internal - For use by @kya-os/cli package only * * This function: * - Sets silent logging by default * - Provides structured progress events * - Returns additional metadata useful for CLI animations * - Optimizes for the best CLI experience * * @param options Configuration options * @returns MCPIdentity instance with additional CLI metadata */ export async function enableMCPIdentityCLI(options) { // Track if this is a new identity let isNewIdentity = false; let capturedClaimUrl; // Wrap the progress callback to capture metadata const wrappedProgress = (event) => { // Capture claim URL from complete event if (event.stage === 'complete' && event.data?.claimUrl) { capturedClaimUrl = event.data.claimUrl; } // Detect if this is a new identity if (event.stage === 'generating_keys') { isNewIdentity = true; } // Call the original callback if provided options?.onProgress?.(event); }; // Initialize with CLI-optimized defaults const identity = await enableMCPIdentity({ ...options, logLevel: options?.logLevel || 'silent', // Silent by default onProgress: wrappedProgress }); // Get DID for metadata const did = identity.did; // Return identity with additional CLI metadata return { identity, metadata: { isNewIdentity, did, claimUrl: capturedClaimUrl, registryUrl: 'https://knowthat.ai/agents/' + did.split(':').pop() } }; } //# sourceMappingURL=cli-mode.js.map