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.
For more information on mounting applications in Starlette, see the [Starlette documentation](https://www.starlette.io/routing/#submounting-routes).
414
524
415
525
## Examples
@@ -584,7 +694,7 @@ if __name__ == "__main__":
584
694
585
695
### Writing MCP Clients
586
696
587
-
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):
588
698
589
699
```python
590
700
from mcp import ClientSession, StdioServerParameters, types
@@ -648,6 +758,28 @@ if __name__ == "__main__":
648
758
asyncio.run(run())
649
759
```
650
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