航班查询
STDIO使用Duffel API搜索航班信息的服务器
使用Duffel API搜索航班信息的服务器
MCP server for searching and retrieving flight information using Duffel API.
https://github.com/user-attachments/assets/c111aa4c-9559-4d74-a2f6-60e322c273d4
While tools like Google Flights work great for simple trips, this tool shines when dealing with complex travel plans. Here's why:
Think of it as having a travel agent in your chat who remembers everything you've discussed and can instantly search across dates and routes.
Duffel requires account verification and payment information setup, but this MCP server only uses the API for searching flights - no actual bookings or charges will be made to your account.
Try using duffel_test first to see the power of this tool. If you end up liking it, you can go through the verification process below to use the live key.
You can start with a test API key (duffel_test
) to try out the functionality with simulated data before going through the full verification process:
To access real flight data, follow these steps:
💡 TIP: Each time you complete a verification step, you'll need to toggle test mode off again to proceed to the next step. Keep toggling until you've completed all requirements.
⚠️ IMPORTANT NOTES:
duffel_test
) to evaluate the functionalityThis MCP server only uses Duffel's search endpoints and cannot make bookings or charges. Your payment information is solely for Duffel's verification process and is never accessed by or shared with the MCP server.
To install Find Flights for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @ravinahp/travel-mcp --client claude
Clone the repository:
git clone https://github.com/ravinahp/flights-mcp cd flights-mcp
Install dependencies using uv:
uv sync
Note: We use uv instead of pip since the project uses pyproject.toml for dependency management.
To add this tool as an MCP server, modify your Claude desktop configuration file.
Configuration file locations:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration to your JSON file:
{ "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" } } }
⚠️ IMPORTANT:
YOUR_USERNAME
with your actual system usernameyour_duffel_live_api_key_here
with your actual Duffel Live API keyPrepare the package:
# Sync dependencies and update lockfile uv sync # Build package uv build
This will create distributions in the dist/
directory.
For the best debugging experience, use the MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /path/to/find-flights-mcp run flights-mcp
The Inspector provides:
@mcp.tool() async def search_flights(params: FlightSearch) -> str: """Search for flights based on parameters."""
Supports three flight types:
Parameters include:
type
: Flight type ('one_way', 'round_trip', 'multi_city')origin
: Origin airport codedestination
: Destination airport codedeparture_date
: Departure date (YYYY-MM-DD)return_date
: Return date for round-tripsadults
: Number of adult passengerscabin_class
: Preferred cabin classdeparture_time
: Specific departure time rangearrival_time
: Specific arrival time rangemax_connections
: Maximum number of connections@mcp.tool() async def get_offer_details(params: OfferDetails) -> str: """Get detailed information about a specific flight offer."""
Retrieves comprehensive details for a specific flight offer using its unique ID.
@mcp.tool(name="search_multi_city") async def search_multi_city(params: MultiCityRequest) -> str: """Search for multi-city flights."""
Specialized tool for complex multi-city flight itineraries.
Parameters include:
segments
: List of flight segmentsadults
: Number of adult passengerscabin_class
: Preferred cabin classmax_connections
: Maximum number of connectionsYou can use these tools to find flights with various complexities:
The tools return JSON-formatted responses with:
The service includes robust error handling for:
[Add guidelines for contribution, if applicable]
This project is licensed under the MIT License - see the LICENSE file for details.
Available cabin classes:
economy
: Standard economy classpremium_economy
: Premium economy classbusiness
: Business classfirst
: First classExample request with cabin class:
{ "params": { "type": "one_way", "adults": 1, "origin": "SFO", "destination": "LAX", "departure_date": "2025-01-12", "cabin_class": "business" // Specify desired cabin class } }