UNPKG

@kya-os/mcp-i

Version:

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

68 lines (67 loc) • 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.loadIdentityFromEnv = loadIdentityFromEnv; exports.generateEnvInstructions = generateEnvInstructions; exports.showVercelDeveloperInstructions = showVercelDeveloperInstructions; const logger_1 = require("./logger"); function loadIdentityFromEnv(prefix = 'MCP_IDENTITY_') { const logger = (0, logger_1.getLogger)(); try { const did = process.env[`${prefix}DID`]; const publicKey = process.env[`${prefix}PUBLIC_KEY`]; const privateKey = process.env[`${prefix}PRIVATE_KEY`]; const agentId = process.env[`${prefix}AGENT_ID`]; const agentSlug = process.env[`${prefix}AGENT_SLUG`]; if (did && publicKey && privateKey) { logger.info('šŸ“¦ Loaded identity from environment variables'); return { did, publicKey, privateKey, agentId: agentId || 'unknown', agentSlug: agentSlug || 'unknown', registeredAt: new Date().toISOString(), directories: 'verified' }; } } catch (error) { logger.debug('No identity found in environment variables'); } return null; } function generateEnvInstructions(identity, prefix = 'MCP_IDENTITY_') { return ` # Add these to your Vercel environment variables: ${prefix}DID="${identity.did}" ${prefix}PUBLIC_KEY="${identity.publicKey}" ${prefix}PRIVATE_KEY="${identity.privateKey}" ${prefix}AGENT_ID="${identity.agentId}" ${prefix}AGENT_SLUG="${identity.agentSlug}" `; } function showVercelDeveloperInstructions(identity, claimUrl) { const logger = (0, logger_1.getLogger)(); console.log('\n'); console.log('='.repeat(60)); console.log('šŸŽ‰ MCP-I IDENTITY CREATED SUCCESSFULLY! šŸŽ‰'); console.log('='.repeat(60)); console.log('\nšŸ“‹ Your Agent Details:\n'); console.log(` DID: ${identity.did}`); console.log(` Agent ID: ${identity.agentId}`); console.log(` Profile: https://knowthat.ai/agents/${identity.agentSlug}`); if (claimUrl) { console.log('\nšŸŽÆ IMPORTANT: Claim your agent to manage it:'); console.log(` ${claimUrl}`); console.log('\n This link lets you:'); console.log(' - Edit your agent details'); console.log(' - Add logos and descriptions'); console.log(' - Manage directory listings'); console.log(' - View analytics'); } console.log('\n⚔ For Vercel Deployment:'); console.log('\n1. Add these environment variables in Vercel Dashboard:'); console.log(generateEnvInstructions(identity)); console.log('2. Your identity will persist across deployments!'); console.log('\n' + '='.repeat(60) + '\n'); }