HasData Google Flights

com.hasdata由 hasdata.com 發布官方發布者v1.0.7更新於 Oct 24, 2026

Google Flights itineraries with fares, legs, carbon emissions and price history, as JSON.

發布方自己的服務:HasData Airbnb

已驗證Streamable HTTP可網頁執行位置與生活網頁搜尋與抓取

概覽

AI 產生的概覽

由 HasData 託管的 MCP 伺服器,讓助理以 JSON 形式搜尋 Google Flights 行程,取得票價、航段、碳排放與價格歷史。

可以做什麼
  • 依航線與日期搜尋單程、來回及多城市行程,可依艙等、轉機次數、航空公司、乘客組成、價格與時長上限、貨幣與地區篩選。
  • 讀取每筆行程的票價、總時長、含航空公司、航班號、機型與機場時刻的航段,以及與該航線平均值比較的碳排放。
  • 查詢價格歷史與價格洞察,包括最低價、常見價格區間與價格水準。
  • 回傳所選行程的 departureToken 或 bookingToken,取得回程或後續航段以及訂位選項。
  • 以資源形式讀取固定參數值(行程類型、貨幣、艙等、排序、轉機等),不消耗額度。
適用情境
適合讓助理比較航班選項、依艙等、轉機或航空公司篩選、搭配價格歷史判斷票價是否划算,或比較碳排放,且不想使用 Google 帳號或官方 Google Flights API 的情境。
執行需求
需要 HasData API 金鑰(在 HasData 控制台建立):遠端端點透過 x-api-key 標頭傳送,npm 或 PyPI 的 stdio 啟動器則透過 HASDATA_API_KEY 環境變數提供。npm 套件需要 Node.js,Python 套件可用 uvx 執行。需能連線至託管端點。
安裝前請注意
每次成功的航班呼叫消耗 15 點額度,來回行程需兩次呼叫;免費額度為每月 1,000 點,付費方案每月 59 美元起。金鑰錯誤在連線時不會被發現,只會在第一次工具呼叫時報錯。此服務讀取公開的 Google Flights 結果,平台條款可能限制自動存取,合規責任由使用者承擔。它不提供訂位或付款,只回傳訂位權杖供你使用。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 HasData Google Flights,將其新增到工作區。
  2. 連接 x-api-key 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/com.hasdata%2Fgoogle-flights/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "hasdata-google-flights": {
      "type": "http",
      "url": "https://mcp.hasdata.com/mcp?apis=google_travel_flights",
      "headers": {
        "x-api-key": "<YOUR_API_KEY>"
      }
    }
  }
}

README

Google Flights MCP Server

A hosted Google Flights MCP server that gives Claude, Cursor, Windsurf and any other MCP client one Google Flights tool. Search one-way, round-trip and multi-city itineraries with fares, flight legs, carbon emissions and price history, all as structured JSON, with no Google account and no retired travel API to work around.

1,000 free credits every month, no card required, which is about 66 flight searches.

https://mcp.hasdata.com/mcp?apis=google_travel_flights

[Glama score] [tool contract] [MCP] [Tools]

Contents

What you need

An MCP client and a HasData API key from the dashboard, free to create with no card, and the free tier covers about 66 calls a month at the 15-credit rate. This is a remote server, so the simplest path is a URL and an x-api-key header, with no container to run and no Google account anywhere in the flow. A client that only speaks stdio reaches it through a thin launcher, published as @hasdata/google-flights-mcp on npm and hasdata-google-flights-mcp on PyPI, shown below.

Quick start

The server URL is the same for every client. We run it hands-on in Claude Code and Claude Desktop. The other blocks follow each client's own documented format for a remote server.

FieldValue
URLhttps://mcp.hasdata.com/mcp?apis=google_travel_flights
TransportHTTP, streamable
Auth headerx-api-key: HASDATA_API_KEY

Clients with OAuth support can add the same URL as a connector and sign in without putting a key in a config file.

Claude Code
bash
claude mcp add --transport http google-flights "https://mcp.hasdata.com/mcp?apis=google_travel_flights" \  --header "x-api-key: HASDATA_API_KEY"
Claude Desktop

Settings, then Connectors, then Add custom connector, then paste https://mcp.hasdata.com/mcp?apis=google_travel_flights and sign in.

For the config-file route, Claude Desktop loads only local (stdio) servers, so it reaches a remote server through a stdio launcher. The @hasdata/google-flights-mcp package is that launcher, and it reads the key from the environment. Add this to claude_desktop_config.json:

json
{  "mcpServers": {    "google-flights": {      "command": "npx",      "args": ["-y", "@hasdata/google-flights-mcp"],      "env": { "HASDATA_API_KEY": "YOUR_KEY" }    }  }}

For Python instead of Node, swap the launcher for the PyPI package, which uvx runs without a manual install:

json
{  "mcpServers": {    "google-flights": {      "command": "uvx",      "args": ["hasdata-google-flights-mcp"],      "env": { "HASDATA_API_KEY": "YOUR_KEY" }    }  }}
Cursor

~/.cursor/mcp.json for every project, or .cursor/mcp.json for one:

json
{  "mcpServers": {    "google-flights": {      "url": "https://mcp.hasdata.com/mcp?apis=google_travel_flights",      "headers": { "x-api-key": "HASDATA_API_KEY" }    }  }}
Windsurf

~/.codeium/windsurf/mcp_config.json. Windsurf calls the field serverUrl, not url:

json
{  "mcpServers": {    "google-flights": {      "serverUrl": "https://mcp.hasdata.com/mcp?apis=google_travel_flights",      "headers": { "x-api-key": "HASDATA_API_KEY" }    }  }}
VS Code

.vscode/mcp.json in the workspace:

json
{  "servers": {    "google-flights": {      "type": "http",      "url": "https://mcp.hasdata.com/mcp?apis=google_travel_flights",      "headers": { "x-api-key": "HASDATA_API_KEY" }    }  }}

Example prompts

Prompts, not code. Paste one in and the agent picks the tool itself. Each is annotated with the calls it takes, because every successful call costs 15 credits.

Find one-way flights from JFK to London Heathrow on September 15, sorted by price, and give me the three cheapest with airline and carbon estimate.

One call, 15 credits. Fares, legs and emissions all come back together.

Same route but non-stop only, in business class, and tell me which option has the lowest emissions.

One call, 15 credits. Cabin and stops are filters on the one request.

Is $295 a good price for JFK to LHR right now, given the price history?

One call, 15 credits. The response carries priceInsights with a typical range and a price level.

Round trip JFK to LHR, out September 15 back September 22, cheapest fare.

Two calls, 30 credits. Google returns outbound options first, then the return leg is a second call keyed by the option you pick.

A round trip is two calls by design. The first returns outbound itineraries each with a departureToken, and you pass that token back to get the matching return flights. One-way and the price check are a single call each.

Tools

ToolWhat it returns
hasdata_google_travel_flights_getGoogleFlightsPer-itinerary price, currency, total duration, stops, flight legs with airline, flight number, aircraft, departure/arrival airports and times, CO2 emissions, plus…. 15 credits a call

One tool, read-only. The sample below is trimmed from a real call, and fares move constantly. Read it as a shape. The tool name links to its endpoint reference, which carries the full parameter list.

The sample is the payload, not the whole response. A tools/call result carries one text block, and that text is itself JSON holding url, status, text and json, with the scraped data under json. From a raw JSON-RPC response the path is result.content[0].text, parsed, then .json. A chat client unwraps that for you and code talking to the endpoint directly does not.

Get Google Flights results

hasdata_google_travel_flights_getGoogleFlights

Itineraries for a route and date, with fares, legs, emissions and price history.

ParameterTypeRequiredNotes
departureIdstringyesIATA code such as JFK, or a location kgmid like /m/02_286. Comma-separate several airports
arrivalIdstringyesSame format as departureId
outboundDatestringyesYYYY-MM-DD
typestringroundTrip by default, oneWay, or multiCity with multiCityJson
returnDatestringRequired when type is roundTrip
travelClassstringeconomy, premiumEconomy, business or first
stopsstringnonStop, oneStopOrFewer or twoStopsOrFewer
sortBystringtopFlights default, plus price, duration, emissions, departureTime, arrivalTime
adults / children / infantsInSeat / infantsOnLapnumberPassenger mix
maxPrice / maxDuration / bagsnumberCeilings and carry-on count
includeAirlines / excludeAirlinesstringComma-separated IATA airline codes, one or the other, not both
departureTokenstringSelect an outbound option and fetch its return or next leg
bookingTokenstringFetch booking options for a chosen itinerary
currency / gl / hlstringCurrency and the country and language of the search
deepSearchbooleanMatch what Google shows in a browser, slower to return

The reference also documents includeConnections, excludeConnections, layoverDuration, outboundTimes, returnTimes, showHidden, lessEmissions and multiCityJson.

Results split into bestFlights and otherFlights. Each itinerary carries price, type, totalDuration in minutes, a flights array of legs, a carbonEmissions object, and a bookingToken. Each leg holds the departureAirport and arrivalAirport (each with id, name and local time), duration, airline, flightNumber, airplane, legroom, travelClass, an extensions array, and oftenDelayedByOver30Min on legs Google flags. A non-stop itinerary has one leg, a connection has several.

carbonEmissions is in grams, not kilograms. thisFlight: 433000 is 433 kg. differencePercent compares it to typicalForThisRoute, so a negative number is a greener-than-average flight.

json
{  "price": 295,  "type": "One way",  "totalDuration": 415,  "flights": [    {      "departureAirport": { "id": "JFK", "name": "John F. Kennedy International Airport", "time": "2026-09-15 8:15" },      "arrivalAirport": { "id": "LHR", "name": "Heathrow Airport", "time": "2026-09-15 20:10" },      "duration": 415,      "airline": "Virgin Atlantic",      "flightNumber": "VS 26",      "airplane": "Boeing 787",      "travelClass": "Economy"    }  ],  "carbonEmissions": { "thisFlight": 367000, "typicalForThisRoute": 419000, "differencePercent": -12 },  "bookingToken": "W1t7..."}

priceInsights sits alongside the itineraries with lowestPrice, a typicalPriceRange, a priceLevel such as typical, and a priceHistory of [timestamp, price] points. airports echoes the resolved departure and arrival airports with city and country.

Prompts and resources

The server ships one prompt, a ready-made workflow a client can offer instead of making the user compose a tool call.

PromptWhat it does
google_flightsCompare flight options between two airports.

Alongside them the server exposes 7 resources, one per parameter whose accepted values are a fixed list. Reading one is cheaper than learning the vocabulary from a rejected call, and it costs no credits. Each URI is hasdata://google_travel_flights/<parameter>.

ParameterValuesWhat it selects
type3Specifies the type of flight. Options: - roundTrip (default) - oneWay - multiCity (requires multiCityJson for flight details) For round trips, retrieve return flight details with a separate request using departureToken.
gl245The two-letter country code for the country you want to limit the search to.
hl159The two-letter language code for the language you want to use for the search.
currency71Parameter defines the currency of the returned prices
travelClass4The travel class for the flight (Economy, Premium Economy, Business, or First).
sortBy6Sort the flight results based on price, departure time, arrival time, etc.
stops3Restrict the number of stops (layovers) in the flight itinerary.

Both lists are served without an API key, so a client can read them before a user has signed up.

Errors and failure paths

Your client almost never sees an HTTP error code from a tool call. The MCP layer answers 200 and puts the failure inside the result, with isError set to true and the reason as text. The agent reads a message where you might expect a status line.

A wrong key surfaces as tool output, not as a failed connection. tools/list accepts any non-empty key and returns the tool, so the client completes its handshake and shows green. The first tool call then comes back with isError: true and the text HasData API error: 401 Unauthorized. Watch for that string, because nothing earlier in the flow reports the problem.

A missing key is the one real HTTP error. Authorization runs before any tool, and the connection itself fails with 401. CORS headers are present, and a browser client reads the status and not an opaque network failure.

An argument that breaks the tool's schema is rejected before it becomes a scrape. The server answers with isError: true and the text MCP error -32602: Input validation error, naming the offending field. A roundTrip without a returnDate, or includeAirlines together with excludeAirlines, is caught here.

A route with no flights on the date returns a successful result with the itinerary arrays empty, not an error. requestMetadata.status still reads ok. Test for the flights before you rank them.

A bad airport code returns 400 with requestMetadata.status set to error. Use IATA codes or kgmids, not city names.

Results that carry data also carry a requestMetadata.id worth quoting in support.

Pricing, free tier and limits

Every Google Flights call costs 15 credits per successful call. Response size does not change the price, and the deep search costs the same as a standard one.

The free tier is 1,000 credits every month with no card, which is about 66 flight searches. It renews with the billing cycle, so a low-volume agent runs on the free tier indefinitely.

Paid plans start at $59 a month for 200,000 credits, which is about 13,000 searches. The unit price falls with volume, from $4.42 per 1,000 calls on the entry plan to $1.79 on Basic and $1.25 across the Growth tiers. Current figures live on the pricing page.

Your plan also sets concurrency. The free tier allows 5 requests at a time, Startup 5, Basic 15, and the Growth tiers run from 50 to 500. Handle the overflow case defensively in anything unattended.

A request that comes back non-200 is not billed. A round trip is two calls, so budget for it.

Tool selection

The apis query parameter decides which tools your agent sees. Fewer tools means less context spent on tool definitions, and fewer chances for the model to reach for the wrong one.

?apis=google_travel_flights          the one tool in this repo?apis=google_travel                   add Google Hotels?apis=google_travel_flights,airbnb    flights plus Airbnb stays

The parameter takes provider names like google_travel and individual API names like google_travel_flights. Misspelled names are ignored. If every name is wrong the request fails with 400, and the body lists both what it did not recognise and every valid value. Drop the parameter and the same endpoint exposes all 57 HasData tools.

How it compares

Google retired its QPX Express flight API in 2018 and never replaced it, so there is no official Google Flights API. The remaining routes are scraping the public results or licensing raw GDS fare data, which is heavy and expensive. This server reads the same results the site shows and returns them as JSON.

Official Google APIThis server
AvailabilityNone since QPX Express closed in 2018Maintained schema over the live results
Emissions dataNot offeredPer-itinerary, compared to the route average
Price historyNot offeredpriceInsights with a typical range
SetupNothing to set up, because it does not existOne key and one URL
CostNot applicablePaid past the free tier, 15 credits a call

What this server does not do. No booking and no payment. It reads fares, legs and the tokens Google itself uses to move to booking, and hands the booking step back to you.

FAQ

Is there an official Google Flights API?

No. Google closed QPX Express in 2018 and has not shipped a replacement. Every option reads the same public results the website serves. This one is maintained by HasData and returns them as structured JSON.

What is a Google Flights MCP server?

A server that exposes Google Flights as a tool an AI client can call. The client sends a tool call over the Model Context Protocol, the server fetches the itineraries and returns structured JSON, and the model works with the result. This one exposes a single tool and runs remotely.

Why is a round trip two calls?

Google returns outbound options first, each with a departureToken. You pick one and pass its token back to get the return flights that pair with it. That mirrors how the site works, and it is why a round trip costs 30 credits.

Are the carbon numbers in kilograms?

No, grams. thisFlight: 433000 means 433 kg, and differencePercent compares it to the route average.

What is deep search?

A slower mode that returns exactly what Google Flights shows in a browser. Leave it off for speed, turn it on when you need parity with the site.

Can I use this together with other HasData APIs?

Yes. The apis parameter takes a list, and ?apis=google_travel adds Google Hotels alongside flights. Drop the parameter and you get everything.

Compliance and personal data

HasData accesses publicly available data only. A platform's terms may restrict automated access, and you are responsible for your own compliance.

HasData links

Product page and request builderGoogle Flights API
Server documentationMCP server docs
Every HasData tool in one serverHasData/hasdata-mcp
Client walkthroughsMCP clients and integrations
Everything else we scrapeGoogle Flights API and 54 more
Plans and credit costsPlans and credit costs
Keys and usageHasData dashboard
Node launcher on npm@hasdata/google-flights-mcp
Python launcher on PyPIhasdata-google-flights-mcp

Development

This repository is configuration and documentation for a remote server. There is no build step and nothing to containerize.

The tests in test/ assert the tool contract, the part that can break without a commit here. They check that ?apis=google_travel_flights returns exactly one tool, that it still declares its required parameters, that the name has not changed, and that the key in use is actually accepted. That last check calls the tool for real and costs 15 credits, which is the price of a canary that can fail for the right reason.

bash
# macOS and LinuxHASDATA_API_KEY=your_key_here npm test
# Windows PowerShell$env:HASDATA_API_KEY="your_key_here"; npm test

The same suite runs in CI on every push and once a week on a schedule, because the upstream tool list can change without anyone touching this repository. A failure means the tool list moved, the key stopped working, or the endpoint was unreachable, and the assertion message says which.

Contributing

Corrections to the parameter table and the response sample are the most useful contribution, because those are the parts that drift. Include the call you made and the response you got. Pull requests from forks run the suite without a key, and the live checks skip instead of going red.

License

MIT. See LICENSE.

來源:README.md,提交 b058b2a

工具

0
SourceWeft 尚未讀取此伺服器的工具。

版本歷史

3
  1. v1.0.7最新Sep 24, 2026
  2. v1.0.6Sep 22, 2026
  3. v1.0.5Sep 16, 2026

評分

已滿足適用檢查項的 85%

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

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Hasdata 整合