Skip to content

Close MCP stdio transport on stdin close#41656

Closed
liyanqing90 wants to merge 2 commits into
microsoft:mainfrom
liyanqing90:codex/mcp-stdio-close-disconnect
Closed

Close MCP stdio transport on stdin close#41656
liyanqing90 wants to merge 2 commits into
microsoft:mainfrom
liyanqing90:codex/mcp-stdio-close-disconnect

Conversation

@liyanqing90

Copy link
Copy Markdown

Summary

  • close the MCP stdio transport when stdin emits either end or close
  • make the close path idempotent so both events can fire safely
  • add an MCP launch regression test that verifies browser cleanup after stdio client disconnect

Why

The stdio transport only mapped stdin end to transport.close(). Some client disconnect paths surface as stdin close; in that case backend disposal could rely on the broader exit watchdog instead of the normal server close path. Closing the transport on both events lets the MCP server dispose its backend and close the launched browser promptly.

Tests

  • PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm ci
  • npm run build
  • npm run tsc
  • npm run test-mcp -- launch.spec.ts --project=chrome

@liyanqing90 liyanqing90 changed the title [codex] Close MCP stdio transport on stdin close Close MCP stdio transport on stdin close Jul 6, 2026
@liyanqing90

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@pavelfeldman

Copy link
Copy Markdown
Member

Please start with filing an issue

@liyanqing90

Copy link
Copy Markdown
Author

Filed issue as requested: #41664

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.

2 participants