Jul 21, 2025

Deploying Model Context Protocol Servers for Agentic AI

Deploying Model Context Protocol Servers for Agentic AI

Tutorial: MCP (Model Context Protocol) is the "USB of AI" - learn to connect AI systems to external services with an advanced travel agent example.

Introduction

In Part 1 of our MCP series, "Introduction to Model Context Protocol Servers for Agentic AI," we explored MCP's foundational concepts and walked through practical examples using existing MCP servers – from filesystem operations to database connections.

Now it's time to dive deeper into real-world MCP implementation strategies.

Part 2 explores two complementary approaches that reflect the current MCP ecosystem: leveraging existing community servers through no-code workflows, and building custom servers for specialized integrations. You'll discover how to create sophisticated AI travel agents using platforms like n8n with existing Airbnb MCP servers, then build a custom TripAdvisor integration from scratch using FastMCP – a practical example you can implement in under 20 minutes.

By the end of this guide, you'll have the complete MCP toolkit for choosing and executing the right approach for your specific project requirements. As usual, you can follow along below or watch the video.

Real-World Implementation: Building Travel Agent MCP Servers

To demonstrate MCP’s practical applications, let’s examine two contrasting approaches to building travel-related functionality: a no-code solution using existing MCP servers and a custom implementation for specific API integration.

The No-Code Approach: Leveraging Existing MCP Servers

The MCP ecosystem’s rapid growth means that for many common use cases, you don’t need to build anything from scratch. Take Airbnb integration as an example – community developers have already created robust MCP servers that can search listings, retrieve property details, and handle booking workflows.

Using platforms like n8n (a workflow automation tool), you can create sophisticated AI agents without writing a single line of code. The process involves:

  1. Installing the MCP Server: Download pre-built MCP servers from repositories like GitHub or specialized marketplaces

  2. Configuring the Workflow: Set up trigger conditions and data flow patterns

  3. Connecting to Your AI Model: Link the MCP server to your chosen language model through the workflow interface

This approach particularly excels when you need rapid prototyping or when working with well-established services that already have mature MCP implementations. In this flow above, our AI agent is going to act like our traffic manager. It will call the MCP Client to check for the list of tools available, and when necessary, will also execute the tool. For the example, our client list will be an AirBNB MCP server, which will help us ping AirBNB for available listings in an area. You can download the Worklfow here by loopsera.

The actual MCP server code this workflow uses can be found at github.com/openbnb-org/mcp-server-airbnb. In n8n, open the workflow and click the MCP Client List Tools node.

Then click on the Credential to connect with edit button.

Then you need to change the Command to npx and in the Arguments field put in the following.

Note that the structure of the Argument is very similar to the Stdio example from the top of the article. Now you can run the workflow and give it a prompt. Try something like, “Find me hotels in Houston”.

If everything is set up properly and worked, you should get a bunch of listings for places to stay in Houston.

Building Your Own MCP Server

Creating a custom MCP server involves several key decisions and implementation steps. Let's walk through building a travel-focused MCP server that integrates with TripAdvisor's API, similar to how travel booking platforms aggregate information from multiple sources.

Planning Your Server

Before implementation, consider these architectural decisions:

Technology Stack: Choose your preferred programming language and framework. Python with FastAPI provides excellent MCP support and rapid development capabilities.

Data Storage: Determine whether you need persistent storage, vector databases for semantic search, or simple in-memory caching.

External APIs: Identify which external services your server will integrate with and obtain necessary API keys and authentication credentials.

Tool Definitions: Plan the specific tools and capabilities your server will expose to AI agents.

TripAdvisor Integration Example

Let's implement a practical MCP server that integrates with TripAdvisor's API to provide hotel search capabilities. The first thing to do is head on over to Tripadvisor.com/developer and get some credentials. Then, white list your IP and copy your API Key to a clipboard to be used in a few seconds.

Head on over to github.com/godfreynolan/mcp_tripadvisor and clone the repo. Much like Let's examine a practical MCP server implementation that integrates with TripAdvisor's Content API. This example demonstrates how you can knock together a working MCP server in about 20 minutes. The server implementation (server.py) showcases the elegance of the FastMCP framework:

# server.py
import requests
from mcp.server.fastmcp import FastMCP

# Create server
mcp = FastMCP("Echo Server")

@mcp.tool()
def get_hotels(city: str) -> str:
    """Search for hotels in a specified city using TripAdvisor Content API"""
    print(f"[debug-server] get_hotels({city})")

    url = f"<https://api.content.tripadvisor.com/api/v1/location/search>"
    params = {
        "language": "en",
        "key": "EEF2BB27EBA24062A2CD946FA89B3109",
        "searchQuery": city
    }

    headers = {"accept": "application/json"}
    response = requests.get(url, params=params, headers=headers)
    return response.text

if __name__ == "__main__":
    mcp.run(transport="sse")

The client side (main.py) demonstrates how to create an agent that utilizes the TripAdvisor MCP server. This shows the real power of the OpenAI Agent SDK combined with MCP:

# main.py
from agents import Agent, Runner
from agents.mcp import MCPServerSse
from agents.model_settings import ModelSettings

async def run(mcp_server):
    agent = Agent(
        name="Assistant",
        instructions="Use the tools to answer the questions.",
        mcp_servers=[mcp_server],
        model_settings=ModelSettings(tool_choice="required"),
    )

    message = "List the hotels in Houston."
    result = await Runner.run(starting_agent=agent, input=message)
    print(result.final_output)

The main execution (also in main.py) connects to the SSE server and manages the process lifecycle automatically:

# main.py (continued)
async def main():
    async with MCPServerSse(
        name="SSE Python Server",
        params={"url": "<http://localhost:8000/sse>"},
    ) as server:
        await run(server)

# Server process management
process = subprocess.Popen(["uv", "run", "server.py"])
time.sleep(3)  # Give server time to start
asyncio.run(main())
process.terminate()

This implementation demonstrates several key MCP patterns: the @mcp.tool() decorator automatically registers functions as tools, SSE transport enables HTTP communication, and the agent configuration with tool_choice="required" ensures the AI uses available tools rather than trying to answer from knowledge alone. The system automatically starts the server process, executes queries like "List the hotels in Houston," and returns formatted results from TripAdvisor's API.

To run this example, install dependencies with uv add requests mcp fastmcp agents, create the server.py and main.py files, then execute uv run main.py. You will need to have you OpenAI API Key exported here, so if you run into an error, make sure to check that first. If it all went well, the system handles server startup, agent execution, and cleanup automatically. Now you should see some listings in Houston

Some More MCP Examples

As your MCP implementations grow more sophisticated, you’ll encounter scenarios requiring multiple servers working together. Consider a comprehensive travel planning system that might include:

  • Accommodation MCP Server: Handling hotel and rental property searches

  • Transportation MCP Server: Managing flight and ground transportation booking

  • Activity MCP Server: Organizing tours, restaurant reservations, and entertainment

  • Weather MCP Server: Providing location-specific weather forecasts

  • Currency MCP Server: Handling exchange rates and payment processing

The agent framework automatically coordinates between these servers, understanding which tools to invoke based on user requests and maintaining context across the entire conversation.

Conclusion

After working through this comprehensive guide, you will have mastered the Model Context Protocol (MCP) - the "USB of AI" that standardizes connections between AI agents and external services. You've learned to eliminate complex custom function definitions through MCP's middleware layer, implemented practical examples from filesystem operations to API integrations, explored both no-code solutions using existing servers and custom development with frameworks like FastMCP, and discovered how to build multi-agent systems where different agents share standardized tools. Armed with these skills and hands-on examples, you can now create robust, scalable AI applications that seamlessly interact with any external system while reducing development overhead and maintaining data integrity.

Additional Resources

https://github.com/openai/openai-agents-python

https://astral.sh

https://loopsera.gumroad.com/l/AirbnbMCPAIAgent

https://tripadvisor.com/developers

If you had fun with this tutorial, be sure to join the OpenAI Application Explorers Meetup Group to learn more about awesome apps you can build with AI.

If you had fun with this tutorial, be sure to join the OpenAI Application Explorers Meetup Group to learn more about awesome apps you can build with AI.