UNPKG

ken-you-code

Version:

Connect your codebase to Kimi: Ultra-fast AI code analysis with Kimi-K2 model via MCP

37 lines (29 loc) 828 B
#!/usr/bin/env node const { spawn } = require('child_process'); const path = require('path'); // Parse command line arguments for API key const args = process.argv.slice(2); const apiKeyArg = args.find((arg) => arg.startsWith('--api-key=')); if (apiKeyArg) { process.env.OPENROUTER_API_KEY = apiKeyArg.split('=')[1]; } // Start the MCP server const serverPath = path.join(__dirname, 'dist', 'server.js'); const server = spawn('node', [serverPath], { stdio: 'inherit', env: process.env, }); server.on('error', (error) => { console.error('Failed to start MCP server:', error.message); process.exit(1); }); server.on('exit', (code) => { process.exit(code || 0); }); // Handle graceful shutdown process.on('SIGINT', () => { server.kill('SIGINT'); }); process.on('SIGTERM', () => { server.kill('SIGTERM'); });