The official Python SDK for Model Context Protocol servers and clients
by modelcontextprotocolPython
Last 12 weeks · 125 commits
5 of 6 standards met
Summary Fixes a streamable HTTP client hang when a POST request receives an SSE response that closes before sending a JSON-RPC response. This targets #1577. It overlaps with the older #1578, but keeps the current-main patch narrow: preserve the existing reconnect behavior when a resumable event id is available, and only resolve the pending request with the existing SDK error when there is no response and no resumable event to follow. Root Cause consumed the POST SSE stream and returned silently if the stream ended before a response and no had been observed. Because no or transport exception was written to the read stream, the JSON-RPC dispatcher kept the corresponding waiter pending forever. Changes Send a correlated when a POST SSE response closes before a reply and cannot be resumed. Also resolve the pending request with if reconnection attempts are exhausted. Add a non-SDK server regression test that closes an SSE response without a JSON-RPC reply and asserts raises instead of hanging. Validation
Summary map bare Streamable HTTP 401 POST responses for JSON-RPC requests to a correlated JSON-RPC error instead of the generic fallback keep existing JSON-RPC error bodies, 404 pre-session, and session-terminated handling unchanged add a regression test for operation-specific authorization failures Fixes #1295. Verification RED: failed with vs GREEN: Note: the local Homebrew uv is 0.9.4 while this repo requires >=0.9.5, so verification used an isolated binary.
Bug Description in raises a false when a block in the previous message is not followed by a block in the last message. Spec Context Per SEP-1577: blocks MUST be preceded by a block ✅ (already checked) There is no requirement that must be followed by A plain text response after a is valid. Reproduction Root Cause Line 83 runs the ID-matching check outside the block: Fix (proposed) Add to the condition: AI Disclosure Bug discovered with AI assistance (opencode).
Repository: modelcontextprotocol/python-sdk. Description: The official Python SDK for Model Context Protocol servers and clients Stars: 23507, Forks: 3599. Primary language: Python. Languages: Python (100%), Shell (0%), HTML (0%). License: MIT. Homepage: https://py.sdk.modelcontextprotocol.io/ Latest release: v1.28.1 (5d ago). Open PRs: 100, open issues: 419. Last activity: 10h ago. Community health: 87%. Top contributors: dsp-ant, maxisbey, Kludex, ihrpr, jspahrsummers, felixweinberger, nick-merrill, jerome3o-anthropic, calclavia, dependabot[bot] and others.