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
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