flights-mcp
by: ravinahp
An MCP server to search for flights.
📌Overview
Purpose: The Find Flights MCP Server facilitates the search and retrieval of flight information using the Duffel API, making complex travel planning easier.
Overview: This server allows users to query flight options conversationally, leveraging advanced features to manage detailed itineraries and search for the best prices flexibly, without needing to navigate traditional flight booking tools.
Key Features:
-
Contextual Memory: The server retains previous flight search information, ensuring seamless follow-up queries without requiring users to keep track of multiple tabs.
-
Flexible Date Search: Users can efficiently search flights across multiple days to identify the best prices, minimizing the need for manual checks.
-
Complex Itineraries: Ideal for multi-city trips and comprehensive travel plans, users can request complex route comparisons in a natural conversational format.
-
Detailed Offer Information: Provides in-depth details about flight offers, including pricing, routes, and carrier data, enhancing informed decision-making.
-
Automatic Connection Handling: Simplifies the searching process by automatically managing flight connections and related details.
Find Flights MCP Server
MCP server for searching and retrieving flight information using the Duffel API.
How It Works
Video Demo
Why This is Helpful
This tool is particularly useful for complex travel plans, as it offers:
- Contextual Memory: Remembers your previous flight searches.
- Flexible Date Search: Search across multiple days for the best prices seamlessly.
- Complex Itineraries: Ideal for multi-city trips and comparing routes.
- Natural Conversation: Describe your travel needs without dealing with traditional search interfaces.
Features
- Search for flights between multiple destinations.
- Support for one-way, round-trip, and multi-city queries.
- Detailed flight offer information.
- Flexible search parameters (departure times, cabin class, number of passengers).
- Automatic handling of flight connections.
Prerequisites
- Python 3.x
- Duffel API Live Key
Getting Your Duffel API Key
Test Mode First (Recommended)
Start with a test API key (duffel_test
):
- Visit Duffel's registration page.
- Create an account.
- Find your test API key in the Developer section.
Getting a Live API Key
To access real flight data, follow these steps:
- Toggle "Test Mode" off in the Duffel dashboard.
- Complete verification steps:
- Verify your email address.
- Complete company information.
- Add payment information (no charges will occur).
- Complete any remaining verification steps.
- Create a Live Token in the Developer section.
Important Notes:
- The MCP server is READ-ONLY; it can only search for flights.
- Sensitive information remains local to your machine.
Installation
Installing via Smithery
To install Find Flights via Smithery:
npx -y @smithery/cli install @ravinahp/travel-mcp --client claude
Manual Installation
Clone the repository:
git clone https://github.com/ravinahp/flights-mcp
cd flights-mcp
Install dependencies using uv
:
uv sync
Configure as MCP Server
Modify your Claude desktop configuration file located at:
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration:
{
"flights-mcp": {
"command": "uv",
"args": [
"--directory",
"/Users/YOUR_USERNAME/Code/flights-mcp",
"run",
"flights-mcp"
],
"env": {
"DUFFEL_API_KEY_LIVE": "your_duffel_live_api_key_here"
}
}
}
Deployment
Building
Prepare the package:
uv sync
uv build
Debugging
Use the MCP Inspector for debugging:
npx @modelcontextprotocol/inspector uv --directory /path/to/find-flights-mcp run find-flights-mcp
Available Tools
1. Search Flights
@mcp.tool()
async def search_flights(params: FlightSearch) -> str:
"""Search for flights based on parameters."""
2. Get Offer Details
@mcp.tool()
async def get_offer_details(params: OfferDetails) -> str:
"""Get detailed information about a specific flight offer."""
3. Search Multi-City Flights
@mcp.tool(name="search_multi_city")
async def search_multi_city(params: MultiCityRequest) -> str:
"""Search for multi-city flights."""
Use Cases
Examples include:
- "Find a one-way flight from SFO to NYC on Jan 7 for 2 adults in business class."
- "Search for a round-trip flight from LAX to London, departing Jan 8 and returning Jan 15."
Response Format
Responses are JSON-formatted with:
- Flight offer details
- Pricing information
- Route details
Error Handling
Includes handling for:
- API request failures
- Invalid airport codes
- Missing or invalid API keys
Contributing
[Add guidelines for contribution, if applicable]
License
This project is licensed under the MIT License.
Performance Notes
- Searches are limited to 50 offers for one-way/round-trip flights.
- Multi-city searches are limited to 10 offers.
Cabin Classes
Available cabin classes include:
economy
premium_economy
business
first