> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 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](https://modelcontextprotocol.io/docs/basics/transports#server-sent-events-sse). This transport enables server-to-client streaming, and can prove more useful than [stdio](https://modelcontextprotocol.io/docs/basics/transports#standard-input%2Foutput-stdio) when working with restricted networks.

> [!NOTE]
>
> This transport is not recommended anymore by the MCP protocol. Use the [Streamable HTTP transport](https://agno-v2.mintlify.site/tools/mcp/transports/streamable_http.md) instead.

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

## Prerequisites

<Snippet file="create-venv-step.mdx" />

```bash theme={null}
uv pip install -U "agno[mcp]" openai
export OPENAI_API_KEY="your_openai_api_key_here"
```

```python theme={null}
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:

```python theme={null}
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())
```

## Complete example

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

**1. Setup the server**

```python sse_server.py theme={null}
from mcp.server.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")
```

**2. Setup the client**

```python sse_client.py theme={null}
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."
        )
    )
```

**3. Run the server**

```bash theme={null}
python sse_server.py
```

**4. Run the client**

```bash theme={null}
python sse_client.py
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.