MCP Airbnb Agent - Search for Airbnb listings!

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

Connect an OpenAI gpt-5.6-luna agent to the Airbnb MCP server over stdio and search property listings.

This example docstring names Gemini 2.5 Pro and google-genai, but the executable code uses OpenAIChat(id="gpt-5.6-luna"). Follow the generated OpenAI setup below.

airbnb.py
"""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-5.6-luna"),
        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

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U "agno[mcp]" openai

Prepare Node.js

The MCP server runs with npx. Install Node.js, then verify the commands:

node --version
npx --version

Export your OpenAI API key

export OPENAI_API_KEY="your_openai_api_key_here"

Close connections on failures

In the saved file, replace run_mcp_agent with this version. Keep the existing imports and main block. The async context managers reject failed connections and close every entered connection if the model or a later connection fails.

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

    async with mcp_tools:
        agent = Agent(
            model=OpenAIChat(id="gpt-5.6-luna"),
            tools=[mcp_tools],
            markdown=True,
        )
        await agent.aprint_response(message)

Run the example

Save the code above as airbnb.py, then run:

python airbnb.py

Full source: cookbook/91_tools/mcp/airbnb.py