Skip to content

fix: exit stdio server when parent process dies (stdin close)#304

Open
haosenwang1018 wants to merge 1 commit intohangwin:masterfrom
haosenwang1018:fix/exit-on-stdin-close
Open

fix: exit stdio server when parent process dies (stdin close)#304
haosenwang1018 wants to merge 1 commit intohangwin:masterfrom
haosenwang1018:fix/exit-on-stdin-close

Conversation

@haosenwang1018
Copy link

Problem

mcp-server-stdio.js processes become zombies when the parent Claude Code session ends. The stdio server has no stdin close detection, so it continues running indefinitely after the parent terminates.

After multiple sessions, 10+ stale processes accumulate and new connections fail with Invalid MCP request or session errors.

Fix

Listen for stdin close and end events in main() to exit cleanly when the parent process dies.

Fixes #300

mcp-server-stdio.js becomes a zombie when the parent Claude Code
session ends because there is no stdin close detection. After
multiple sessions, stale processes accumulate and new connections
get 'Invalid MCP request' errors.

Listen for stdin 'close' and 'end' events to exit cleanly.

Fixes hangwin#300

Signed-off-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp-server-stdio.js becomes zombie when parent process dies (missing stdin close handler)

1 participant