Airbnb MCP Integration

Guide for integrating Airbnb booking capabilities with PraisonAI agents using MCP

Add Airbnb Tool to AI Agent

Diagram

In

AI Agent

Airbnb MCP

Out

Quick Start

  1. Set API Key

    Set your OpenAI API key as an environment variable in your terminal:

    bash
    export OPENAI_API_KEY=your_openai_api_key_here
  2. Create a file

    Create a new file airbnb_search.py with the following code:

    python
    from praisonaiagents import Agent, MCP
    
    search_agent = Agent(
        instructions="""You help book apartments on Airbnb.""",
        llm="gpt-4o-mini",
        tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
    )
    
    search_agent.start("I want to book an apartment in Paris for 2 nights. 03/28 - 03/30 for 2 adults")
  3. Install Dependencies

    Make sure you have Node.js installed, as the MCP server requires it:

    bash
    pip install praisonaiagents
  4. Run the Agent

    Execute your script:

    bash
    python airbnb_search.py

Gradio UI

python
from praisonaiagents import Agent, MCP
import gradio as gr

def search_airbnb(query):
    agent = Agent(
        instructions="You help book apartments on Airbnb.",
        llm="gpt-4o-mini",
        tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
    )
    result = agent.start(query)
    return f"## Airbnb Search Results\n\n{result}"

demo = gr.Interface(
    fn=search_airbnb,
    inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
    outputs=gr.Markdown(),
    title="Airbnb Booking Assistant",
    description="Enter your booking requirements below:"
)

if __name__ == "__main__":
    demo.launch()

Features