SSE Transport

Connect MCPTools to an MCP server over the deprecated SSE transport using the url and transport parameters.

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.

This transport is not recommended anymore by the MCP protocol. Use the Streamable HTTP transport instead.

To use it, initialize the MCPTools passing the URL of the MCP server and setting the transport to sse:

Prerequisites

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate
uv pip install -U "agno[mcp]" openai
export OPENAI_API_KEY="your_openai_api_key_here"
import asyncio

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.mcp import MCPTools

async def main():
    async with MCPTools(url="http://localhost:8000/sse", transport="sse") as mcp_tools:
        agent = Agent(model=OpenAIResponses(id="gpt-5.2"), tools=[mcp_tools])
        await agent.aprint_response(
            "What is the license for this project?",
            stream=True,
        )

asyncio.run(main())

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:

import asyncio

from agno.tools.mcp import MCPTools, SSEClientParams

async def main():
    server_params = SSEClientParams(
        url="http://localhost:8000/sse",
        headers={"Authorization": "Bearer your-token"},
        timeout=30,
        sse_read_timeout=300,
    )

    async with MCPTools(server_params=server_params, transport="sse") as mcp_tools:
        print([tool.name for tool in mcp_tools.functions.values()])

asyncio.run(main())

Install Node.js and check node --version and npx --version before running the complete client, which also starts an npm server. Keep the local MCP server running in a separate terminal.

Complete example

Set up a simple local server and connect to it using the SSE transport:

Setup the server

from fastmcp import FastMCP

mcp = FastMCP("calendar_assistant")


@mcp.tool()
def get_events(day: str) -> str:
    return f"There are no events scheduled for {day}."


@mcp.tool()
def get_birthdays_this_week() -> str:
    return "It is your mom's birthday tomorrow"


if __name__ == "__main__":
    mcp.run(transport="sse")

Setup the client

import asyncio

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.mcp import MCPTools

# This is the URL of the MCP server we want to use.
server_url = "http://localhost:8000/sse"


async def run_agent(message: str) -> None:
    async with MCPTools(transport="sse", url=server_url) as mcp_tools:
        agent = Agent(
            model=OpenAIResponses(id="gpt-5.2"),
            tools=[mcp_tools],
            markdown=True,
        )
        await agent.aprint_response(input=message, stream=True, markdown=True)


async def run_agent_with_multiple_servers(message: str) -> None:
    async with (
        MCPTools(transport="sse", url=server_url) as calendar_tools,
        MCPTools(
            command="npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt"
        ) as airbnb_tools,
    ):
        agent = Agent(
            model=OpenAIResponses(id="gpt-5.2"),
            tools=[calendar_tools, airbnb_tools],
            markdown=True,
        )
        await agent.aprint_response(input=message, stream=True, markdown=True)


if __name__ == "__main__":
    asyncio.run(run_agent("Do I have any birthdays this week?"))
    asyncio.run(
        run_agent_with_multiple_servers(
            "Check when my mom's birthday is and find Airbnb listings in San Francisco for two people that day."
        )
    )

Run the server

python sse_server.py

Run the client

python sse_client.py