refactor(server): add shutdown idempotency guard and test teardown blocks

This commit is contained in:
Lucas Winther committed 2026-09-06 19:22:46 +02:00
1 parent f1e84d281a
commit 3d4a064593
3 files changed
+45 -37

No files matched your search

+3
View File
@@ -12,7 +12,10 @@ async function main(): Promise<void> {
const mcpServer = createServer(config);
// Bind graceful termination
let isShuttingDown = false;
const shutdown = async () => {
if (isShuttingDown) return;
isShuttingDown = true;
console.error("\n[openproject-mcp] Received termination signal, shutting down...");
await mcpServer.stop();
process.exit(0);