An MCP (Model Context Protocol) server that wraps the fast-flights library to provide AI agents with powerful flight search and analysis capabilities.
This MCP server provides AI agents with tools to:
- Search Flights: Find available flights between airports on specific dates
- Find Best Price: Identify the cheapest flight option for a route
- Find Shortest Duration: Locate the fastest flight option
- Compare Flights: Get comprehensive analysis of all flight options
- Filter Flights: Apply custom criteria (price, duration, stops) to narrow down results
# Install uv package manager (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies
uv sync
# Test the server
uv run python src/main.py# Test the server configuration
uv run python test_mcp_server.py
# Run functional tests (searches real flights)
uv run python tests/test_server.pyNote: Running uv run main directly will show a JSON-RPC error - this is expected! MCP servers communicate via JSON-RPC and need to be run by an MCP client (like Claude Desktop or Dedalus), not directly from the terminal.
Search for flights between two airports on a specific date.
Parameters:
date(required): Flight date in YYYY-MM-DD format (e.g., "2025-01-01")from_airport(required): Departure airport code (e.g., "LAX", "JFK", "TPE")to_airport(required): Arrival airport code (e.g., "SFO", "LHR", "MYJ")adults(optional): Number of adult passengers (default: 1)children(optional): Number of child passengers (default: 0)infants_in_seat(optional): Number of infants in seat (default: 0)infants_on_lap(optional): Number of infants on lap (default: 0)max_results(optional): Maximum number of flights to return (default: 10)
Returns: Flight search results with pricing, duration, stops, and more.
Find the cheapest flight option for a route and date.
Parameters: Same as search_flights (except max_results)
Returns: Details of the cheapest flight with price comparisons.
Find the flight with the shortest travel time.
Parameters: Same as search_flights (except max_results)
Returns: Details of the fastest flight with duration comparisons.
Get a comprehensive comparison of all available flight options.
Parameters: Same as search_flights (except max_results)
Returns: Analysis including:
- Cheapest flight
- Fastest flight
- Recommended options (flagged as "best" by the search engine)
- Statistics (average price, average duration, price ranges)
- Direct flight availability
Filter flights based on specific criteria.
Parameters:
- All parameters from
search_flightsPLUS: max_price(optional): Maximum price per personmax_duration(optional): Maximum duration in minutesmax_stops(optional): Maximum number of stopsdirect_only(optional): Show only direct flights (default: False)
Returns: Filtered flight results matching your criteria.
from dedalus_labs import AsyncDedalus, DedalusRunner
async def search_example():
client = AsyncDedalus(api_key="your-api-key")
runner = DedalusRunner(client)
result = await runner.run(
input="Find flights from LAX to SFO on 2025-01-15 for 2 adults",
model="claude-3-5-sonnet-20241022",
mcp_servers=["your-org/fast-flights-mcp"]
)
print(result.final_output)result = await runner.run(
input="What's the cheapest flight from New York (JFK) to London (LHR) on March 1st, 2025?",
model="openai/gpt-4",
mcp_servers=["your-org/fast-flights-mcp"]
)result = await runner.run(
input="Compare all flight options from TPE to MYJ on 2025-01-01. Show me the cheapest, fastest, and recommended flights.",
model="claude-3-5-sonnet-20241022",
mcp_servers=["your-org/fast-flights-mcp"]
)result = await runner.run(
input="Find direct flights from LAX to JFK on 2025-02-14 under $300 per person",
model="openai/gpt-4",
mcp_servers=["your-org/fast-flights-mcp"]
)fast-flights-mcp/
├── main.py # Entry point for Dedalus
├── pyproject.toml # Package configuration
├── requirements.txt # Dependencies
├── src/
│ ├── __init__.py # Package marker
│ └── main.py # MCP server implementation
└── tests/
└── test_server.py # Test script
To test your MCP server with Claude Desktop:
-
Find your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the server configuration:
{
"mcpServers": {
"fast-flights": {
"command": "uv",
"args": ["run", "main"],
"cwd": "/Users/mikey/repos/fast-flights-mcp"
}
}
}-
Restart Claude Desktop
-
You should see a 🔌 icon indicating MCP servers are connected
-
Try asking Claude:
- "Find me the cheapest flight from LAX to SFO on January 20th"
- "What's the fastest flight from New York to London on March 1st?"
- "Compare flight options from TPE to MYJ"
- Install Dedalus CLI:
pip install dedalus-labs- Authenticate:
dedalus login# Deploy to Dedalus
dedalus deploy . --name "fast-flights-mcp"from dedalus_labs import AsyncDedalus, DedalusRunner
async def main():
client = AsyncDedalus(api_key="your-api-key")
runner = DedalusRunner(client)
result = await runner.run(
input="Find me the cheapest flight from LAX to NYC on January 20th",
model="claude-3-5-sonnet-20241022",
mcp_servers=["your-org/fast-flights-mcp"]
)
print(result.final_output)- AI Agent Request: Your AI agent receives a natural language request about flights
- Tool Selection: The MCP framework identifies which flight search tool to use
- API Call: The server calls the
fast-flightslibrary with appropriate parameters - Data Processing: Results are formatted and analyzed
- Response: Structured flight data is returned to the AI agent
- Natural Language: The AI formats the results into a user-friendly response
Each flight in the results includes:
name: Airline and flight numberdeparture: Departure timearrival: Arrival timedeparture_time_ahead: Time until departure (if available)arrival_time_ahead: Time until arrival (if available)duration: Total flight duration in minutesstops: Number of stops (0 = direct)price: Price per personis_best: Whether this flight is flagged as a recommended optiondelay: Delay information (if available)
Use standard IATA airport codes:
- LAX - Los Angeles International
- JFK - John F. Kennedy International (New York)
- SFO - San Francisco International
- LHR - London Heathrow
- TPE - Taiwan Taoyuan International
- MYJ - Matsuyama Airport (Japan)
- Check that airport codes are valid IATA codes
- Verify the date is in the future and in YYYY-MM-DD format
- Ensure the route is commonly served
- Make sure all dependencies are installed:
uv sync - Check Python version:
python --version(requires 3.10+) - Verify the
fast-flightslibrary is working:uv run python -c "import fast_flights; print('OK')"
- Ensure
pyproject.tomlis properly configured - Check that
main.pyexists at the root level - Verify all dependencies are listed in
requirements.txt
# Stage 1: Find cheapest option
result1 = await runner.run(
input="Find the cheapest flight from LAX to NYC on Jan 20",
model="openai/gpt-4o-mini",
mcp_servers=["your-org/fast-flights-mcp"]
)
# Stage 2: Compare with fastest option
result2 = await runner.run(
input=f"Based on this cheapest option: {result1.final_output}, now compare it with the fastest flight for the same route and date",
model="claude-3-5-sonnet-20241022",
mcp_servers=["your-org/fast-flights-mcp"]
)
# Stage 3: Make recommendation
result3 = await runner.run(
input=f"Based on these options: {result2.final_output}, recommend the best choice for a business traveler who values time over cost",
model="openai/gpt-4"
)routes = [
("LAX", "JFK", "2025-01-20"),
("LAX", "SFO", "2025-01-21"),
("JFK", "LHR", "2025-01-22")
]
tasks = []
for from_airport, to_airport, date in routes:
task = runner.run(
input=f"Find best price from {from_airport} to {to_airport} on {date}",
model="openai/gpt-4o-mini",
mcp_servers=["your-org/fast-flights-mcp"]
)
tasks.append(task)
results = await asyncio.gather(*tasks)Contributions are welcome! Please feel free to submit a Pull Request.
MIT
For issues or questions:
- Open an issue on GitHub
- Check the fast-flights documentation
- Review MCP server examples
Built with ❤️ using the Model Context Protocol