You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
464
+
392
465
You can mount the SSE server to an existing ASGI server using the `sse_app` method. This allows you to integrate the SSE server with other ASGI applications.
393
466
394
467
```python
@@ -621,7 +694,7 @@ if __name__ == "__main__":
621
694
622
695
### Writing MCP Clients
623
696
624
-
The SDK provides a high-level client interface for connecting to MCP servers:
697
+
The SDK provides a high-level client interface for connecting to MCP servers using various [transports](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports):
625
698
626
699
```python
627
700
from mcp import ClientSession, StdioServerParameters, types
@@ -685,6 +758,28 @@ if __name__ == "__main__":
685
758
asyncio.run(run())
686
759
```
687
760
761
+
Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
762
+
763
+
```python
764
+
from mcp.client.streamable_http import streamablehttp_client
765
+
from mcp import ClientSession
766
+
767
+
768
+
asyncdefmain():
769
+
# Connect to a streamable HTTP server
770
+
asyncwith streamablehttp_client("example/mcp") as (
771
+
read_stream,
772
+
write_stream,
773
+
_,
774
+
):
775
+
# Create a session using the client streams
776
+
asyncwith ClientSession(read_stream, write_stream) as session:
0 commit comments