Closed
Description
Ref modelcontextprotocol/typescript-sdk#579
We don't use the TS SDK, but we also don't implement shutdown correctly.
For the stdio transport the client SHOULD initiate shutdown by
- First, closing the input stream to the child process (the server)
- Waiting for the server to exit, or sending SIGTERM if the server does not exit within a reasonable time
- Sending SIGKILL if the server does not exit within a reasonable time after SIGTERM
This is implemented here: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/node/extHostMcpNode.ts
We should move away from using the abort controller, have a separate little class for managing connection state. Use a grace time of 2 seconds after each step, and also allow forcefully killing it if $stopMcp
is called twice. Use taskkill on Windows or process.kill on posix.
Activity
pavelfeldman commentedon Jun 1, 2025
Please consider giving us a bit more time to close gracefully upon stdin closure. Browsers will probably take up to 5s on a slow Windows machine.