Skip to main content
Glama
Google Flights MCP Server

Google Flights MCP Server

by HaroldLeo

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

Python Version MCP License


Related MCP server: Google Flights MCP Server

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_KEY is 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

  1. Create a new Space at huggingface.co/new-space with Docker SDK

  2. Push this repository to the Space

  3. (Optional) Add SERPAPI_API_KEY as 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

Available Tools

9 tools
generate_google_flights_urlA
Generate a Google Flights search URL that opens in the browser.
Creates search URLs using natural language queries.

Args:
    origin: Origin airport code (e.g., "SFO").
    destination: Destination airport code (e.g., "JFK").
    departure_date: Departure date (YYYY-MM-DD format).
    return_date: Return date for round-trip (YYYY-MM-DD format, optional).
    adults: Number of adult passengers (default: 1).
    children: Number of children (default: 0).
    seat_type: Fare class - economy/premium_economy/business/first (default: "economy").

Returns:
    JSON with the Google Flights URL.

Example Args:
    {"origin": "SFO", "destination": "JFK", "departure_date": "2025-07-20"}
    {"origin": "SFO", "destination": "JFK", "departure_date": "2025-07-20", "return_date": "2025-07-27"}

Inputs: origin (required), destination (required), departure_date (required), return_date, +3 more. Returns: result

get_multi_city_flightsA
Fetches multi-city/multi-stop itineraries for complex trip planning.

⚠️  IMPORTANT: Multi-city flight scraping is not fully supported by the underlying fast-flights
library. This function will generate a valid Google Flights URL with your search parameters,
but may not be able to parse the results. If parsing fails, you'll receive a direct link to
view the flights on Google Flights.

💡 RECOMMENDATION FOR AI AGENTS: Instead of using this function, consider using the
get_one_way_flights() function multiple times (once for each leg of the journey) and
combining the results. This approach is more reliable and provides detailed flight
information for each segment, which you can then present together as a complete itinerary.

Args:
    flight_segments: JSON string of flight segments. Each segment should have "date", "from", and "to" fields.
                    Example: '[{"date": "2025-07-01", "from": "SFO", "to": "NYC"}, {"date": "2025-07-05", "from": "NYC", "to": "MIA"}, {"date": "2025-07-10", "from": "MIA", "to": "SFO"}]'
    adults: Number of adult passengers (default: 1).
    seat_type: Fare class (e.g., "economy", "business", default: "economy").
    return_cheapest_only: If True, returns only the cheapest option (default: False).

Example Args:
    {"flight_segments": '[{"date": "2025-07-01", "from": "SFO", "to": "NYC"}, {"date": "2025-07-05", "from": "NYC", "to": "MIA"}]'}

Inputs: flight_segments (required), adults, seat_type, return_cheapest_only, +2 more. Returns: result

get_travel_datesB
Calculate suggested travel dates based on current date.
Helpful for planning future trips.

Args:
    days_from_now: Number of days from today for departure (default: 30).
    trip_length: Length of trip in days (default: 7).

Returns:
    JSON with suggested departure and return dates.

Example Args:
    {"days_from_now": 45, "trip_length": 10}

Inputs: days_from_now, trip_length. Returns: result

search_direct_flightsA
Search for direct flights only (no stops). Supports both one-way and round-trip.

Args:
    origin: Origin airport code (e.g., "SFO").
    destination: Destination airport code (e.g., "JFK").
    date: Departure date (YYYY-MM-DD format).
    is_round_trip: If True, search round-trip flights (default: False).
    return_date: Return date for round-trips (YYYY-MM-DD format, required if is_round_trip=True).
    adults: Number of adult passengers (default: 1).
    children: Number of children (2-11 years, default: 0).
    infants_in_seat: Number of infants in seat (under 2 years, default: 0).
    infants_on_lap: Number of infants on lap (under 2 years, default: 0).
    seat_type: Fare class - economy/premium_economy/business/first (default: "economy").
    return_cheapest_only: If True, returns only the cheapest flight (default: False).

Example Args:
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20"}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "is_round_trip": true, "return_date": "2025-07-27"}

Inputs: origin (required), destination (required), date (required), is_round_trip, +9 more. Returns: result

search_flights_by_airlineA
Search flights filtered by specific airlines or alliances.

💡 TIP: Default max_stops=2 provides more reliable scraping for round-trip searches.

Args:
    origin: Origin airport code (e.g., "SFO").
    destination: Destination airport code (e.g., "JFK").
    date: Departure date (YYYY-MM-DD format).
    airlines: Airline code(s) or alliance name. Can be either:
             - Single airline: "UA" or "AA" or "DL" (2-letter codes)
             - Multiple airlines: ["UA", "AA", "DL"] (JSON array)
             - Alliance: "STAR_ALLIANCE" or "SKYTEAM" or "ONEWORLD"
    is_round_trip: If True, search round-trip flights (default: False).
    return_date: Return date for round-trips (YYYY-MM-DD format).
    adults: Number of adult passengers (default: 1).
    seat_type: Fare class (default: "economy").
    max_stops: Maximum number of stops (0=direct, 1=one stop, 2=two stops, default: 2).
    return_cheapest_only: If True, returns only the cheapest flight (default: False).

Example Args:
    {"origin": "SFO", "destination": "TYO", "date": "2026-02-20", "airlines": "UA"}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "airlines": "["UA", "AA"]"}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "airlines": "STAR_ALLIANCE", "max_stops": 0}

Inputs: origin (required), destination (required), date (required), airlines (required), +8 more. Returns: result

search_flights_with_max_stopsB
Search flights with a maximum number of stops (0=direct, 1=one stop, 2=two stops).

Args:
    origin: Origin airport code (e.g., "SFO").
    destination: Destination airport code (e.g., "JFK").
    date: Departure date (YYYY-MM-DD format).
    max_stops: Maximum number of stops (0, 1, or 2).
    is_round_trip: If True, search round-trip flights (default: False).
    return_date: Return date for round-trips (YYYY-MM-DD format).
    adults: Number of adult passengers (default: 1).
    seat_type: Fare class (default: "economy").
    return_cheapest_only: If True, returns only the cheapest flight (default: False).

Example Args:
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "max_stops": 1}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "max_stops": 0, "is_round_trip": true, "return_date": "2025-07-27"}

Inputs: origin (required), destination (required), date (required), max_stops (required), +7 more. Returns: result

search_one_way_flightsA
Fetches available one-way flights for a specific date between two airports.
Can optionally return only the cheapest flight found.

Args:
    origin: Origin airport code (e.g., "DEN").
    destination: Destination airport code (e.g., "LAX").
    date: The specific date to search (YYYY-MM-DD format).
    adults: Number of adult passengers (default: 1).
    children: Number of children (2-11 years, default: 0).
    infants_in_seat: Number of infants in seat (under 2 years, default: 0).
    infants_on_lap: Number of infants on lap (under 2 years, default: 0).
    seat_type: Fare class - economy/premium_economy/business/first (default: "economy").
    return_cheapest_only: If True, returns only the cheapest flight (default: False).

Example Args:
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20"}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "adults": 2, "children": 1}
    {"origin": "SFO", "destination": "JFK", "date": "2025-07-20", "return_cheapest_only": true}

Inputs: origin (required), destination (required), date (required), adults, +7 more. Returns: result

search_round_trip_flightsA
Fetches available round-trip flights for specific departure and return dates.
Can optionally return only the cheapest flight found.

💡 TIP: Default max_stops=2 provides more reliable scraping. For direct flights only,
use search_direct_flights() with is_round_trip=True instead.

Args:
    origin: Origin airport code (e.g., "DEN").
    destination: Destination airport code (e.g., "LAX").
    departure_date: The specific departure date (YYYY-MM-DD format).
    return_date: The specific return date (YYYY-MM-DD format).
    adults: Number of adult passengers (default: 1).
    children: Number of children (2-11 years, default: 0).
    infants_in_seat: Number of infants in seat (under 2 years, default: 0).
    infants_on_lap: Number of infants on lap (under 2 years, default: 0).
    seat_type: Fare class - economy/premium_economy/business/first (default: "economy").
    max_stops: Maximum number of stops (0=direct, 1=one stop, 2=two stops, default: 2).
               Lower values = more reliable scraping. Set higher if needed, but may reduce reliability.
    return_cheapest_only: If True, returns only the cheapest flight (default: False).

Example Args:
    {"origin": "DEN", "destination": "LAX", "departure_date": "2025-08-01", "return_date": "2025-08-08"}
    {"origin": "DEN", "destination": "LAX", "departure_date": "2025-08-01", "return_date": "2025-08-08", "adults": 2, "children": 2}
    {"origin": "DEN", "destination": "LAX", "departure_date": "2025-08-01", "return_date": "2025-08-08", "max_stops": 0}

Inputs: origin (required), destination (required), departure_date (required), return_date (required), +9 more. Returns: result

search_round_trips_in_date_rangeA
Finds available round-trip flights within a specified date range.
Can optionally return only the cheapest flight found for each date pair.

⚠️ RATE LIMIT WARNING: This function makes multiple Google Flights scraping requests.
Each date pair combination = 1 request. The function is LIMITED to a MAXIMUM of 30
requests to prevent rate limiting and IP blocking.

Example request counts:
- 7 day range with 5-7 day stays: ~10-15 requests (Safe)
- 14 day range with no limits: ~105 requests (WILL BE REJECTED)
- 30 day range: ~465 requests (WILL BE REJECTED)

💡 TIP: Use min_stay_days and max_stay_days to reduce combinations.
Set return_cheapest_only=true for faster results.

Args:
    origin: Origin airport code (e.g., "DEN").
    destination: Destination airport code (e.g., "LAX").
    start_date_str: Start date of the search range (YYYY-MM-DD format).
    end_date_str: End date of the search range (YYYY-MM-DD format).
    min_stay_days: Minimum number of days for the stay (optional).
    max_stay_days: Maximum number of days for the stay (optional).
    adults: Number of adult passengers (default: 1).
    seat_type: Fare class (e.g., "economy", "business", default: "economy").
    max_stops: Maximum number of stops (0=direct, 1=one stop, 2=two stops, default: 2).
    return_cheapest_only: If True, returns only the cheapest flight for each date pair (default: False).
    max_results: Maximum number of results to return (default: 10). Set to 0 or -1 for unlimited.
    offset: Number of results to skip (for pagination, default: 0).
    compact_mode: If True, return only essential fields (saves ~40% tokens, default: False).
    limit: Maximum number of date pairs to process (for pagination, default: 20).

Example Args:
    {"origin": "JFK", "destination": "MIA", "start_date_str": "2025-09-10", "end_date_str": "2025-09-20", "min_stay_days": 5}
    {"origin": "JFK", "destination": "MIA", "start_date_str": "2025-09-10", "end_date_str": "2025-09-20", "min_stay_days": 5, "return_cheapest_only": true}

Inputs: origin (required), destination (required), start_date_str (required), end_date_str (required), +9 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 9 tools

    Disambiguation3/5

    The tools have overlapping purposes that could cause confusion, such as search_one_way_flights and search_direct_flights for one-way trips, and search_round_trip_flights and search_direct_flights for round-trips. However, descriptions provide some guidance to differentiate them, like the tip in search_round_trip_flights suggesting to use search_direct_flights for direct flights. This overlap reduces clarity but is partially mitigated by the documentation.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with a verb_noun structure, such as generate_google_flights_url, get_multi_city_flights, and search_direct_flights. This uniformity makes the tool set predictable and easy to understand, with no deviations in naming conventions.

    Tool Count4/5

    With 9 tools, the count is reasonable for a flight search server, covering various search types and utilities. It is well-scoped but slightly heavy due to some overlapping tools, like multiple search functions that could potentially be consolidated, though each serves a distinct niche.

    Completeness5/5

    The tool set provides comprehensive coverage for flight search, including one-way, round-trip, multi-city, direct flights, airline filters, date range searches, and utilities like URL generation and date suggestions. There are no obvious gaps; it supports full lifecycle planning from search to results, with clear workflows and no dead ends.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables flight search and fare calendar exploration by interacting with Google Flights' API, supporting detailed filters for origin, destination, dates, cabin class, airlines, and more.
      6,847 PyPI
      3,490
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to search for real-time flights between airports using the SearchAPI.io Google Flights API, returning prices, schedules, airlines, and carbon emissions.
      -