modelcontextprotocol / modelcontextprotocol/python-sdk
Support clean server shutdown
Open
@felixweinberger is already working on this.
Since Jan 15, 2026.
enhancement
P1
v2
- Dominant language
- Python
- Stars
- 24.3k
- Forks
- 4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 31
Description
Summary
Provide a reliable way to cleanly shut down a running MCP server, ensuring all resources are properly released.
Motivation
- Currently there's no clean way to stop a running server programmatically
- Resources (connections, tasks, file handles) may not be properly cleaned up on shutdown
- Important for testing, graceful restarts, and production deployments
Goal
- API for triggering graceful shutdown
- Proper cleanup of all active sessions and transports
- Configurable shutdown timeout / drain period
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.
Assessment
This issue has not been assessed yet.