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

# Stdio Transport

> Connect MCPTools to a local MCP server over stdio using the command parameter.

The stdio (standard input/output) transport is the default one in Agno's integration. It works best for local integrations.

To use it, simply initialize the `MCPTools` class with the `command` argument.
The command you want to pass is the one used to run the MCP server the agent will have access to.

## Prerequisites

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

Install the Python dependencies and [Node.js](https://nodejs.org/en/download), then verify the runtimes used by the examples:

```bash theme={null}
uv pip install -U "agno[mcp]" openai
uvx --version
node --version
npx --version
```

```bash theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
export GOOGLE_MAPS_API_KEY="your_google_maps_api_key_here"
```

<Warning>
  The `@modelcontextprotocol/server-google-maps` npm package is deprecated and no longer supported. The multi-server snippet below documents the legacy server. Use a maintained Maps MCP server for new projects.
</Warning>

For example, `uvx mcp-server-git` runs a [Git MCP server](https://github.com/modelcontextprotocol/servers/tree/main/src/git):

```python theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.mcp import MCPTools

# Initialize and connect to the MCP server
# Can also use custom binaries: command="./my-mcp-server"
mcp_tools = MCPTools(command="uvx mcp-server-git")
await mcp_tools.connect()

try:
    agent = Agent(model=OpenAIResponses(id="gpt-5.2"), tools=[mcp_tools])
    await agent.aprint_response("What is the license for this project?", stream=True)
finally:
    # Always close the connection when done
    await mcp_tools.close()
```

You can also use multiple MCP servers at once, with the `MultiMCPTools` class. For example:

<Note>
  `MultiMCPTools` is deprecated and will be removed in a future version. Use multiple `MCPTools` instances instead.
</Note>

```python theme={null}
import asyncio
import os
from datetime import date, timedelta

from agno.agent import Agent
from agno.tools.mcp import MultiMCPTools


async def run_agent(message: str) -> None:
    """Run the Airbnb and Google Maps agent with the given message."""

    env = {
        "GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
    }

    # Initialize and connect to multiple MCP servers
    mcp_tools = MultiMCPTools(
        commands=[
            "npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt",
            "npx -y @modelcontextprotocol/server-google-maps",
        ],
        env=env,
    )
    await mcp_tools.connect()

    try:
        agent = Agent(
            tools=[mcp_tools],
            markdown=True,
        )

        await agent.aprint_response(message, stream=True)
    finally:
        # Always close the connection when done
        await mcp_tools.close()


# Example usage
if __name__ == "__main__":
    check_in = date.today() + timedelta(days=30)
    check_out = check_in + timedelta(days=3)
    # Pull request example
    asyncio.run(
        run_agent(
            f"What listings are available in Cape Town for 2 people "
            f"from {check_in.isoformat()} to {check_out.isoformat()}?"
        )
    )
```
