Skip to content

Commit 41f2302

Browse files
committed
Document that connect() drivers must pass the transport's context builder
The JSON-response-mode refusal of request-scoped server requests takes effect through the dispatcher's transport_builder, so a caller driving the transport's streams by hand needs to pass transport_context_for the way the session manager does. No-Verification-Needed: docstring-only edit
1 parent c516350 commit 41f2302

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/mcp/server/streamable_http.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,12 @@ async def connect(
964964
]:
965965
"""Context manager that provides read and write streams for a connection.
966966
967+
Drive the yielded streams through a `JSONRPCDispatcher` built with
968+
`transport_context_for` as its `transport_builder`, as the session
969+
manager does: that is what makes the request-scoped channel refuse
970+
server-initiated requests in JSON-response mode instead of parking
971+
them where nothing can deliver them.
972+
967973
Yields:
968974
Tuple of (read_stream, write_stream) for bidirectional communication
969975
"""

0 commit comments

Comments
 (0)