index.ts•663 B
#!/usr/bin/env node
import { MySQLMCPServer } from './server.js';
async function main() {
const server = new MySQLMCPServer();
// 处理进程退出信号
process.on('SIGINT', async () => {
console.error('收到 SIGINT 信号,正在关闭服务器...');
process.exit(0);
});
process.on('SIGTERM', async () => {
console.error('收到 SIGTERM 信号,正在关闭服务器...');
process.exit(0);
});
try {
await server.run();
} catch (error) {
console.error('服务器启动失败:', error);
process.exit(1);
}
}
main().catch((error) => {
console.error('未处理的错误:', error);
process.exit(1);
});