diff --git a/src/mcp/server.ts b/src/mcp/server.ts index 3cc045f..4205777 100644 --- a/src/mcp/server.ts +++ b/src/mcp/server.ts @@ -93,6 +93,11 @@ export async function startMcpServer( } process.once('SIGINT', onShutdown) process.once('SIGTERM', onShutdown) + // If the client dies without sending a signal (Windows terminal close, + // Claude Code session exit, lost ssh pipe), stdin closes but the + // process otherwise has nothing to exit on. Don't let zombies pile up. + process.stdin.once('end', onShutdown) + process.stdin.once('close', onShutdown) return { stop } }