37 lines
666 B
JavaScript
Raw Permalink Normal View History

2025-03-28 20:38:53 +01:00
#!/usr/bin/env node
2025-04-09 00:25:27 +02:00
import TaskMasterMCPServer from './src/index.js';
import dotenv from 'dotenv';
import logger from './src/logger.js';
2025-03-28 20:38:53 +01:00
// Load environment variables
dotenv.config();
/**
* Start the MCP server
*/
async function startServer() {
2025-04-09 00:25:27 +02:00
const server = new TaskMasterMCPServer();
2025-03-28 20:38:53 +01:00
2025-04-09 00:25:27 +02:00
// Handle graceful shutdown
process.on('SIGINT', async () => {
await server.stop();
process.exit(0);
});
2025-03-28 20:38:53 +01:00
2025-04-09 00:25:27 +02:00
process.on('SIGTERM', async () => {
await server.stop();
process.exit(0);
});
2025-03-28 20:38:53 +01:00
2025-04-09 00:25:27 +02:00
try {
await server.start();
} catch (error) {
logger.error(`Failed to start MCP server: ${error.message}`);
process.exit(1);
}
2025-03-28 20:38:53 +01:00
}
// Start the server
startServer();