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

# MCP Airbnb Agent - Search for Airbnb listings!

> Search Airbnb listings with an OpenAI gpt-4o agent connected to the @openbnb/mcp-server-airbnb stdio MCP server.

Connect an OpenAI `gpt-4o` agent to the Airbnb MCP server over stdio and search property listings.

```python airbnb.py theme={null}
"""MCP Airbnb Agent - Search for Airbnb listings!

This example shows how to create an agent that uses MCP and Gemini 2.5 Pro to search for Airbnb listings.

Run: `uv pip install google-genai mcp agno` to install the dependencies
"""

import asyncio

from agno.agent import Agent
from agno.models.openai.chat import OpenAIChat
from agno.tools.mcp import MCPTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


async def run_mcp_agent(message: str):
    # Initialize the MCP tools
    mcp_tools = MCPTools("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")

    # Connect to the MCP server
    await mcp_tools.connect()

    # Use the MCP tools with an Agent
    agent = Agent(
        model=OpenAIChat(id="gpt-4o"),
        tools=[mcp_tools],
        markdown=True,
    )
    await agent.aprint_response(message)

    # Close the MCP connection
    await mcp_tools.close()


# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    asyncio.run(run_mcp_agent("Show me listings in Barcelona, for 2 people."))
```

## Run the Example

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

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U "agno[mcp]" openai
    ```
  </Step>

  <Step title="Prepare Node.js">
    The MCP server runs with `npx`. Install Node.js, then verify the commands:

    ```bash theme={null}
    node --version
    npx --version
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `airbnb.py`, then run:

    ```bash theme={null}
    python airbnb.py
    ```
  </Step>
</Steps>

Full source: [cookbook/91\_tools/mcp/airbnb.py](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/mcp/airbnb.py)
