Transports
Streamable HTTP Transport
The new Streamable HTTP transport replaces the HTTP+SSE transport from protocol version 2024-11-05.
This transport enables the MCP server to handle multiple client connections, and can also use SSE for server-to-client streaming.
To use it, initialize the MCPTools
passing the URL of the MCP server and setting the transport to streamable-http
:
You can also use the server_params
argument to define the MCP connection. This way you can specify the headers to send to the MCP server with every request, and the timeout values:
Complete example
Let’s set up a simple local server and connect to it using the Streamable HTTP transport:
1
Setup the server
streamable_http_server.py
2
Setup the client
streamable_http_client.py
3
Run the server
4
Run the client