Google Flights

io.github.ThiagoJacobLannes由 GitHub 帳號 ThiagoJacobLannes 發布v0.1.0更新於 Nov 1, 2026

Search Google Flights prices, cheapest travel dates and airport codes.

概覽

AI 產生的概覽

搜尋 Google Flights 的機票價格、航班時刻與最便宜出發日期,並把城市或機場名稱解析成 IATA 代碼。

可以做什麼
  • 依出發地、目的地、日期、乘客人數、艙等、幣別、轉機次數與排序方式搜尋航班,回傳依價格排序的選項,含航空公司、起降時間、時長與 Google Flights 連結
  • 在日期區間內(最多 21 天)找出最便宜的出發日,類似價格日曆
  • 用離線機場資料把城市或機場名稱解析成 IATA 代碼
適用情境
適合讓助理不必開瀏覽器就能比較機票價格與時刻,或在某段日期範圍內找出最便宜的出發日。搜尋前查機場代碼時也派得上用場。
執行需求
以 stdio 在本機執行,通常透過 uvx 從 PyPI 啟動(需 Python 3.11+ 與 uv)。預設抓取方式不需 API 金鑰;設定 SERPAPI_KEY 會改用 SerpApi,提供航班編號、轉機細節與碳排放資訊。可選用 GOOGLE_FLIGHTS_DEFAULT_ORIGIN 與 GOOGLE_FLIGHTS_DEFAULT_CURRENCY。需要能連上 Google Flights 的網路。
安裝前請注意
預設資料來源直接抓取 Google Flights 內部搜尋介面,Google 一改動就可能失效;在歐盟/英國地區會自動送出 Cookie 同意視窗中的「全部拒絕」選項。來回航班結果給的是去程選項加上估算總價,而非單獨計價的回程航段。cheapest_dates 每天各執行一次搜尋,速度較慢。若設定 SERPAPI_KEY,該金鑰會存在用戶端設定中,查詢也會送往 SerpApi。選用的 HTTP 模式若要開放至 localhost 以外,需自行設定反向代理與驗證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Google Flights,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

google-flights-mcp

MCP server for searching Google Flights prices and schedules from Claude.

Two interchangeable data sources behind one interface (google_flights_mcp/providers/base.py):

  • fast-flights (default) — scrapes Google Flights' internal protobuf search API directly. No API key, works out of the box.
  • SerpApi — used automatically when a SERPAPI_KEY environment variable is set. Adds flight numbers, layover detail, and carbon emissions.

Tools

  • search_flights — origin (default LIS), destination, departure_date, optional return_date, passenger counts, cabin_class, currency (default EUR), max_stops, sort_by. Returns a price-ranked list: price, airline(s), departure/arrival times, duration, stops, and a Google Flights link.
  • cheapest_dates — cheapest day(s) to fly in a date window (max 21 days), price-calendar style. Runs one search per day — see "Known limitations" below.
  • airport_search — resolve a city or airport name ("Lisbon") to an IATA code (LIS), backed by the offline airportsdata package.

Known limitations

  • Round trips: for return_date searches, both providers return outbound flight options annotated with an estimated round-trip total price (paired with the cheapest matching return) — not a separately priced return leg. stops/duration/legs describe the outbound flight only. Open the result's booking_link on Google Flights to pick the exact return.
  • cheapest_dates: neither fast-flights nor SerpApi's Google Flights engine expose a real bulk price-calendar endpoint, so this runs one search_flights call per candidate day. Capped at a 21-day window to keep that bounded.
  • EU/UK cookie-consent wall: Google shows a cookie-consent interstitial to requests from those regions before returning real results. The fast-flights provider detects this and auto-submits "Reject all" (the privacy-preserving option) before retrying — see providers/fast_flights_provider.py if this ever needs updating for a change on Google's side.

Install

Quickest (needs uv): no clone needed, it runs straight from PyPI.

bash
claude mcp add google-flights -- uvx google-flights-search-mcp

For Claude Desktop, use "command": "uvx", "args": ["google-flights-search-mcp"].

From source:

Requires Python 3.11+ and uv.

bash
git clone https://github.com/ThiagoJacobLannes/google-flights-mcpcd google-flights-mcpuv sync --extra dev

On Windows, if you keep code in a cloud-synced folder (Google Drive, OneDrive), create the venv outside it — sync clients drop desktop.ini marker files into folders, which can crash packages on startup:

bash
uv venv C:\dev\google-flights-mcp-venvuv pip install --python C:\dev\google-flights-mcp-venv -e ".[dev]"

The command paths below assume that venv location; adjust to wherever yours lives.

Add to Claude Desktop

Merge claude_desktop_config.snippet.json into your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):

json
{  "mcpServers": {    "google-flights": {      "command": "C:\\dev\\google-flights-mcp-venv\\Scripts\\python.exe",      "args": ["-m", "google_flights_mcp.server"]    }  }}

Restart Claude Desktop after editing. To use SerpApi instead of the default scraper, add an env block:

json
{  "mcpServers": {    "google-flights": {      "command": "C:\\dev\\google-flights-mcp-venv\\Scripts\\python.exe",      "args": ["-m", "google_flights_mcp.server"],      "env": { "SERPAPI_KEY": "your-serpapi-key" }    }  }}

Get a key at serpapi.com (free tier available).

Other env vars: GOOGLE_FLIGHTS_DEFAULT_ORIGIN (default LIS), GOOGLE_FLIGHTS_DEFAULT_CURRENCY (default EUR).

Running over HTTP (for a remote connector)

bash
C:\dev\google-flights-mcp-venv\Scripts\python.exe -m google_flights_mcp.server --http

Or set MCP_TRANSPORT=streamable-http. Configure the bind address with MCP_HOST (default 127.0.0.1) and MCP_PORT (default 8000); the server listens at http://<host>:<port>/mcp. Put this behind whatever reverse proxy / auth you use for your other remote connectors before exposing it beyond localhost.

Smoke test

Real network call (no mocks) — searches LIS → GRU about a month out:

bash
C:\dev\google-flights-mcp-venv\Scripts\python.exe tools\google-flights-mcp\examples\smoke_test.py

Tests

bash
C:\dev\google-flights-mcp-venv\Scripts\python.exe -m pytest tools\google-flights-mcp\tests

These are unit tests against the provider abstraction (factory selection, passenger validation, the shared cheapest_dates day-loop, airport resolution) — no network access required.

來源:README.md,提交 d0d92f2

工具

3

search_flights

Search flight prices and options on Google Flights. Args: destination: Destination airport IATA code (e.g. "GRU"). If you only have a city name, call airport_search first. departure_date: Outbound date, YYYY-MM-DD. origin: Origin airport IATA code. Defaults to Lisbon (LIS) if omitted. return_date: Return date YYYY-MM-DD to search a round trip; omit for one-way. For round trips, each result's price is Google's estimated round-trip total for that outbound flight paired with its cheapest matching return — stops/duration/legs describe the outbound only. Open booking_link to pick the exact return flight. adults: Number of adult passengers (default 1). children: Number of child passengers (default 0). infants: Number of lap infants, under 2 with no own seat (default 0). cabin_class: "economy" | "premium" | "business" | "first". currency: ISO currency code. Defaults to EUR. max_stops: Maximum stops to allow (0 = nonstop only, 1 = up to one stop, etc.). Omit to allow any number of stops. sort_by: "price" (default, ascending) or "duration" (ascending).

輸入參數adultsorigininfantssort_bychildrencurrencymax_stopscabin_classdestination必填return_datedeparture_date必填

cheapest_dates

Find the cheapest day(s) to fly within a date window (price-calendar style). Runs one search per candidate departure day in the window (capped at 21 days — neither of this server's data sources expose a real bulk price-calendar endpoint) and returns each day's cheapest fare, sorted by price ascending. Args: destination: Destination airport IATA code. start_date: First candidate departure date, YYYY-MM-DD. end_date: Last candidate departure date, YYYY-MM-DD (inclusive; max 21 days after start_date). origin: Origin airport IATA code. Defaults to Lisbon (LIS). trip_length: Nights for a round trip, applied to every departure day in the window. Omit to price one-way fares. adults, children, infants: Passenger counts (see search_flights). cabin_class: "economy" | "premium" | "business" | "first". currency: ISO currency code. Defaults to EUR. max_stops: Maximum stops to allow. Omit to allow any.

輸入參數adultsorigininfantschildrencurrencyend_date必填max_stopsstart_date必填cabin_classdestination必填trip_length

版本歷史

1
  1. v0.1.0最新Nov 1, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分