modelcontextprotocol / modelcontextprotocol/typescript-sdk
Add ways for server processes to self-terminate when host is gone
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
While working on VS Code and LSP we have learned that it is quite hard to prevent leaking processes, e.g stdio servers might be lingering around long after the host is gone. This can be due to various reasons and an effective way we have found is to start a server with the PID of its host. With that the server periodically checks for the PID and terminates if it is gone, like so https://github.com/microsoft/vscode-languageserver-node/blob/main/server/src/node/main.ts#L51
Having something like this in the SDK would benefit MCP servers and help to keep process-bleed in check
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked VS Code example at server/src/node/main.ts around the host-PID handling, then inspect the TypeScript SDK's server startup paths for stdio servers. Define how the SDK should receive and monitor a host PID, and verify that an MCP server terminates when its host process is gone without affecting normal operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100