Google Flights MCP Server

Google Flights MCP Server

Enables MCP clients to search one-way, round-trip, and multi-city itineraries and retrieve fares, flight legs, carbon emissions and price history as structured JSON.

Category
访问服务器

README

Google Flights MCP Server

<!-- mcp-name: com.hasdata/google-flights -->

A hosted Model Context Protocol (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.

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

Glama score tool contract MCP Tools License

Contents

What you need

An MCP client and a HasData API key from the dashboard, free to create with no card, and the trial covers about 66 calls 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.

Field Value
URL https://mcp.hasdata.com/api/mcp?apis=google_travel_flights
Transport HTTP, streamable
Auth header x-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.

<details> <summary><b>Claude Code</b></summary>

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

</details>

<details> <summary><b>Claude Desktop</b></summary>

Settings, then Connectors, then Add custom connector, then paste https://mcp.hasdata.com/api/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:

{
  "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:

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

</details>

<details> <summary><b>Cursor</b></summary>

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

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

</details>

<details> <summary><b>Windsurf</b></summary>

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

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

</details>

<details> <summary><b>VS Code</b></summary>

.vscode/mcp.json in the workspace:

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

</details>

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

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.

Parameter Type Required Notes
departureId string yes IATA code such as JFK, or a location kgmid like /m/02_286. Comma-separate several airports
arrivalId string yes Same format as departureId
outboundDate string yes YYYY-MM-DD
type string roundTrip by default, oneWay, or multiCity with multiCityJson
returnDate string Required when type is roundTrip
travelClass string economy, premiumEconomy, business or first
stops string nonStop, oneStopOrFewer or twoStopsOrFewer
sortBy string topFlights default, plus price, duration, emissions, departureTime, arrivalTime
adults / children / infantsInSeat / infantsOnLap number Passenger mix
maxPrice / maxDuration / bags number Ceilings and carry-on count
includeAirlines / excludeAirlines string Comma-separated IATA airline codes, one or the other, not both
departureToken string Select an outbound option and fetch its return or next leg
bookingToken string Fetch booking options for a chosen itinerary
currency / gl / hl string Currency and the country and language of the search
deepSearch boolean Match 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.

{
  "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.

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 trial is 1,000 credits over 30 days with no card, which is about 66 flight searches. After that an active account keeps getting 100 credits topped up each day whenever its balance drops below 100, so a low-volume agent runs on the free tier indefinitely.

Paid plans start at $49 a month for 200,000 credits, which is about 13,000 searches. The unit price falls with volume, from $3.68 per 1,000 calls on the entry plan to $1.49 on Business, $1.25 on Growth and $1.12 on the largest high-volume plans.

Your plan also sets concurrency. The free trial allows 1 request at a time, Startup 15, Business 30, Growth 50, and the high-volume plans run from 200 to 1,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 API This server
Availability None since QPX Express closed in 2018 Maintained schema over the live results
Emissions data Not offered Per-itinerary, compared to the route average
Price history Not offered priceInsights with a typical range
Setup Nothing to set up, because it does not exist One key and one URL
Cost Not applicable Paid past the trial, 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 builder Google Flights API
Server documentation MCP server docs
All 57 tools in one server HasData/hasdata-mcp
Client walkthroughs MCP clients and integrations
Everything else we scrape Google Flights API and 54 more
Plans and credit costs Plans and credit costs
Keys and usage HasData dashboard

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.

# macOS and Linux
HASDATA_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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选