Skip to content

Commit c8a4bb1

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 e20be4d commit c8a4bb1

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
@@ -992,6 +992,12 @@ async def connect(
992992
]:
993993
"""Context manager that provides read and write streams for a connection.
994994
995+
Drive the yielded streams through a `JSONRPCDispatcher` built with
996+
`transport_context_for` as its `transport_builder`, as the session
997+
manager does: that is what makes the request-scoped channel refuse
998+
server-initiated requests in JSON-response mode instead of parking
999+
them where nothing can deliver them.
1000+
9951001
Yields:
9961002
Tuple of (read_stream, write_stream) for bidirectional communication
9971003
"""

0 commit comments

Comments
 (0)