start.js•986 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);
const serverPath = join(__dirname, 'dist', 'index.js');
console.log('🚀 启动Logo MCP服务器...');
console.log('📍 服务器路径:', serverPath);
const server = spawn('node', [serverPath], {
stdio: 'inherit',
cwd: __dirname
});
server.on('error', (error) => {
console.error('❌ 服务器启动失败:', error);
process.exit(1);
});
server.on('close', (code) => {
console.log(`🔚 服务器已关闭,退出代码: ${code}`);
process.exit(code);
});
// 处理进程信号
process.on('SIGINT', () => {
console.log('\n🛑 收到中断信号,正在关闭服务器...');
server.kill('SIGINT');
});
process.on('SIGTERM', () => {
console.log('\n🛑 收到终止信号,正在关闭服务器...');
server.kill('SIGTERM');
});