Transports
SSE Transport
Agno’s MCP integration supports the SSE transport. This transport enables server-to-client streaming, and can prove more useful than stdio when working with restricted networks.
To use it, initialize the MCPTools
passing the URL of the MCP server and setting the transport to sse
:
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 SSE transport:
1
Setup the server
sse_server.py
2
Setup the client
sse_client.py
3
Run the server
4
Run the client