使用说明
title: Google Flights MCP emoji: ✈️ colorFrom: blue colorTo: indigo sdk: docker pinned: false
Google Flights MCP Server
A Model Context Protocol (MCP) server for intelligent flight search and travel planning
Overview
Integrates Google Flights data directly into your AI workflow with natural language searches, intelligent price comparisons, and automated travel planning.
Data Sources:
- fast-flights v3 (Primary): Free, no API key required — JS parser, connection segments, native airline filters; round-trip searches return outbound options with RT total prices
- SerpAPI (Fallback): Richer data including flight numbers, layovers, carbon emissions, and multi-seller booking options — used when
SERPAPI_API_KEYis set (250 free searches/month)
Tools
| Tool | Description |
|---|---|
search_one_way_flights |
One-way flights for a specific date |
search_round_trip_flights |
Round-trip flights with fixed dates (supports max_stops) |
search_round_trips_in_date_range |
Page round-trip date pairs in a range (default limit 20; a page over 30 is rejected; advance offset to continue) |
search_flights_by_airline |
Filter flights by airline codes or alliance (STAR_ALLIANCE, SKYTEAM, ONEWORLD) |
get_travel_dates |
Calculate travel dates relative to today |
generate_google_flights_url |
Generate a shareable Google Flights search link |
Resources
airports://all— Notes on IATA usage (v3 no longer ships an airport enum)airports://{code}— Validate a 3-letter IATA code (e.g.airports://LAX)
Prompts
11 built-in travel planning prompts: find_best_deal, weekend_getaway, last_minute_travel, business_trip, family_vacation, budget_backpacker, loyalty_program_optimizer, holiday_peak_travel, long_haul_international, stopover_explorer, reliable_search_strategy.
Quick Start
git clone https://github.com/HaroldLeo/google-flights-mcp.git
cd google-flights-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .
Configuration
Claude Desktop
{
"mcpServers": {
"google-flights": {
"command": "/absolute/path/to/.venv/bin/python",
"args": ["/absolute/path/to/google-flights-mcp/src/mcp_server_google_flights/server.py"],
"env": {
"SERPAPI_API_KEY": "your_serpapi_key_here"
}
}
}
}
Get a free SerpAPI key: serpapi.com/users/sign_up (250 free searches/month)
Remote Deployment (Hugging Face Spaces)
This server supports remote deployment as an SSE MCP server.
Deploy to HF Spaces
- Create a new Space at huggingface.co/new-space with Docker SDK
- Push this repository to the Space
- (Optional) Add
SERPAPI_API_KEYas a Space secret
The Dockerfile and transport switching are already configured — set MCP_TRANSPORT=sse (done automatically in the Dockerfile) to run in SSE mode.
Connect to a deployed Space
{
"mcpServers": {
"google-flights": {
"url": "https://YOUR-USERNAME-google-flights-mcp.hf.space/sse"
}
}
}
Environment Variables
| Variable | Description |
|---|---|
SERPAPI_API_KEY |
SerpAPI key for richer flight data (optional) |
MCP_TRANSPORT |
stdio (default) or sse for remote deployment |
FASTMCP_HOST |
Host for SSE mode (default: 0.0.0.0) |
FASTMCP_PORT |
Port for SSE mode (default: 7860) |
Troubleshooting
No flights found: Try a different date or route. Google Flights rate-limits scraping — SerpAPI fallback is more reliable.
Scraping errors: Retry later, or set SERPAPI_API_KEY for automatic fallback on search_one_way_flights and search_round_trip_flights. Date-range searches do not use SerpApi. search_flights_by_airline uses the SerpApi fallback for one-way searches with airline codes outside the built-in name table when SERPAPI_API_KEY is set.
Slow searches: search_round_trips_in_date_range pages date pairs (default limit 20). A page of more than 30 pairs is rejected. Advance offset by limit to continue, or narrow the range with min_stay_days/max_stay_days.
License
MIT — see LICENSE