fix(server): handle POST body disconnects gracefully - #3249
Conversation
|
Thanks for the contribution. This repository only keeps pull requests open when they're linked to an issue that a maintainer has assigned to the author — CONTRIBUTING.md explains why and how we work. This PR has been closed for now because you aren't currently assigned to #1648. If a maintainer would like this change as a PR from you, they'll assign you to #1648 and this PR will reopen automatically — there's nothing more you need to do. (If you opened the issue, this PR already shows up on its timeline.) There's no need to open a new PR — this one will be reopened. While it's closed, please push any updates as new commits rather than force-pushing, since GitHub can't reopen a PR whose branch has been rewritten. Maintainers: reopening this PR, removing the |
Summary
ClientDisconnectwhile reading a Streamable HTTP POST body as a normal client-side eventFixes #1648.
Verification
uv run --frozen pytest tests/server/test_streamable_http_router.py -q(4 passed)uv run --frozen ruff check src/mcp/server/streamable_http.py tests/server/test_streamable_http_router.pyuv run --frozen ruff format --check src/mcp/server/streamable_http.py tests/server/test_streamable_http_router.pyuv run --frozen pyright src/mcp/server/streamable_http.py tests/server/test_streamable_http_router.py(0 errors)The full
scripts/test -n 0run collected 5,592 tests but could not complete on this Windows host because unrelated stdio interaction tests were unable to spawn child Python processes (PermissionError: [WinError 5]).AI assistance was used during investigation and implementation. I reviewed the final diff and take responsibility for the change.