cli.js•764 B
#!/usr/bin/env node
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Path to the compiled index.js
const indexPath = join(__dirname, 'dist', 'index.js');
// Spawn the MCP server
const child = spawn('node', [indexPath], {
stdio: 'inherit',
env: process.env
});
// Handle process termination
child.on('error', (error) => {
console.error('Failed to start MCP server:', error);
process.exit(1);
});
child.on('exit', (code) => {
process.exit(code || 0);
});
// Forward signals to child process
process.on('SIGINT', () => child.kill('SIGINT'));
process.on('SIGTERM', () => child.kill('SIGTERM'));