google-flights-mcp
Google Flights MCP — 让您的 agent 可以搜索整个日期范围内实时票价的工具,零广告
claude mcp add --transport http google-flights https://google-flights-mcp.flightpowers.com/mcp --header "x-rapidapi-key: YOUR_RAPIDAPI_KEY"托管服务。无需克隆,无需构建。已列入官方 MCP Registry 中,标识符为 com.flightpowers/google-flights-mcp。健康检查端点:/health。
需要 key 吗? 请先在 RapidAPI 上订阅 Google Flights Live API(提供免费额度),然后把您的 x-rapidapi-key 复制下来:https://rapidapi.com/mtnrabi/api/google-flights-live-appi
还没有 key? 先用免费服务器 —— 同样的搜索功能,无需注册:
claude mcp add --transport http google_flights-free https://google-flights-lulu.flightpowers.com/mcp
(服务由广告赞助:每条结果一条已明示的赞助卡片,扇出上限为 15,且无法渲染商家赞助卡片的客户端可能被进一步限制。)当广告、15 次搜索上限或这些客户端限制阻碍到您的使用体验时,再回到本页。
您的 agent 可具备
它提供的是两个工具,回答价格问题,而不是日期检索:
可以进行开放式提问。 比如“十月里去斯里兰卡最便宜的单程票”“5 月某个时间在罗马住 5 到 7 晚,从特拉维夫或拉纳卡出发”—— 每一个都只要一次工具调用。两个工具均接受出发日期范围、一个列表的目的地机场,/单向飞行需要固定返程。若有固定返程,也接受
nights夜晚数,而不是固定返回日,并在服务器内部展开。直接告诉你价高不高。 每个结果都包含 Google 针对该航线与时段给出的历史价格区间 ——
price_insights_low、price_insights_high,以及一个price_range_in_relation_to_other_periods的结论,值为low/typical/high。正因如此,agent 才能回答“209 美元在此航线属于常态,不要急着订”,而不只是报一个代码。直接可订票,而不只是浏览。 每个结果都含有一个外部
buy_link假向 Google Flights 订票页。可以查看花费。 每一条响应都携带
api_usage,显示本次调用消耗了多少上游请求、计划还剩多少,做到您可按这个报告查看(见费用报告(api_usage))。知道自己搜索了什么。 每条响应都带
search_coverage,模型可以被“诚实地说:回答是基于哪些日期、目的地得到的”。
注意: 结果是实时票价。差异性只保持几分钟 —— 绝不缓存或复用以往结果;重新搜索时,请注明数据获取的时间。
Related MCP server: Google Flights MCP Server
获取 key(免费版可用)
服务器自身不持有任何上游的凭据。每次搜索都被计入使用 您自己的 RapidAPI 订阅,所以 key 必须随请求一路携带。
订阅 Google Flights Live API: https://rapidapi.com/mtnab/api/google_flights-live-api>
复制好您的
api_key(名为x-rapidapi-key)。用下面三种方式中的任意一种,把 key 传给服务器。
如果没有 key,工具也不会静默失败,也不会产生花费 —— 工具直接随结果带 needs_api_key: true 并附注册链接和以上相应提示,好让模型把 peprue 用户。
三种传 key 的方式
方式 | 示例/操作 | 什么时候用 |
Header(推荐) | 添加一句请求头: | 凡是允许设 Header 的环境都可用。key 不进入 URL,也就不经过代理和访问日志。 |
Query 参数 | 例如 | 只支持填 URL 的托管平台(如 claude.ai 自定义连接器的)时用它。 |
客户端 API-key 字段 | 直接粘贴到客户端的“API key”栏 | 若工具让你在 Host 上加: |
以下规律生效:非空 key 最优先(左边起)。凡是 key 绝对不会进日志、不会在一条错误里被回显,也不会在 supply 结果里返回。
API 工具一览
工具 | 说明 |
| 实时单程票。输入:出发(IATA)、目的地:一字区/列表,和一个出发日期或日期区间;返回票价、航空公司、时长、转机次数、 |
| 实时往返票,以往返双程(paired legs) 计价,而非两个一方。输入:出发地、(或多个目的地)、出发日期或区间;以及 |
search_oneway_flights
search_oneway_flights(
from_airport: str, # origin IATA, e.g. "TLV"
to_airport: str | list[str], # destination IATA, or a list to compare
departure_date: str | None = None, # "YYYY-MM-DD"
departure_date_from: str | None = None,# first date of a range
departure_date_to: str | None = None, # last date of a range
max_stops: int | None = None, # 0 = non-stop only
airline_codes: list[str] | None = None,
exclude_airline_codes: list[str] | None = None,
departure_time_min: int | None = None, # hour, 0-23
departure_time_max: int | None = None,
arrival_time_min: int | None = None,
arrival_time_max: int | None = None,
currency: str = "usd",
max_price: int | None = None,
seat_type: int | None = None, # 1 economy, 2 premium economy, 3 business, 4 first
passengers: list[int] | None = None, # [adults, children, infants]
sort_by: str = "best", # "best" | "price" | "duration"
limit: int = 10, # results returned after merge + sort
max_searches: int | None = None, # cap the billed requests this call may make
use_fallback: bool = False, # slower, fewer empty results on hard routes
)search_roundtrip_flights
search_roundtrip_flights(
from_airport: str,
to_airport: str | list[str],
departure_date: str | None = None,
departure_date_from: str | None = None,
departure_date_to: str | None = None,
return_date: str | None = None, # use this OR nights, not both
nights: int | list[int] | None = None, # e.g. 7, or [5, 6, 7]
max_departure_stops: int | None = None,
max_return_stops: int | None = None,
departure_airline_codes: list[str] | None = None,
return_airline_codes: list[str] | None = None,
currency: str = "usd",
max_price: int | None = None,
seat_type: int | None = None,
passengers: list[int] | None = None,
sort_by: str = "best",
limit: int = 10,
max_searches: int | None = None,
use_fallback: bool = False,
)又注意:规则:sort_by 顺序由这一整服务在其已执行的所有搜索结果上进行合并套用,因此有几个组合被扩展其排序都可预期——快。
一个实际示例
用户: “我在特拉维夫,五天——一够一周——去 Cons this. 罗马或雅典的玩,5 月 1..”...
嗯——不多见了 Good Cà确认原文:
用户问题原 p:
“我在特拉维夫。从五月这半个月任意一天出发,去罗马或雅典,求最省的——周往返”
一次:
{
"name": "search_roundtrip_flights",
"arguments": {
"from_airport": "TLV",
"to_airport": ["FCO", "ATH"],
"departure_date_from": "2026-05-01",
"departure_date_to": "2026-05-15",
"nights": 7,
"sort_by": "price",
"limit": 5
}
}这组展开为 15 日 × 2 个目的地 =30 组合——恰为本次调用的上限。返回形状(字段真实,下面数仅示意,不是报价,自来之真跑调用):
{
"results": [
{
"from_airport": "Tel Aviv (TLV)",
"to_airport": "Rome (FCO)",
"departure_date": "2026-05-05",
"return_date": "2026-05-12",
"total_price": "$XXX",
"total_price_as_number": 0,
"total_duration_seconds": 0,
"total_stops": 0,
"price_range_in_relation_to_other_periods": "low",
"price_insights_low": 0,
"price_insights_high": 0,
"departure_flight_airline": "...",
"departure_flight_departure_description": "...",
"departure_flight_arrival_description": "...",
"departure_flight_duration": "...",
"departure_flight_stops": 0,
"departure_stops_info": [],
"return_flight_airline": "...",
"return_flight_departure_description": "...",
"return_flight_arrival_description": "...",
"return_flight_duration": "...",
"return_flight_stops": 0,
"return_stops_info": [],
"buy_link": "https://www.google.com/travel/flights?tfs=..."
}
],
"result_count": 5,
"search_coverage": {
"requested_combinations": 30,
"searched_combinations": 30,
"truncated": false,
"max_searches_per_request": 30,
"departure_dates_searched": ["2026-05-01", "..."],
"destinations_searched": ["ATH", "FCO"]
},
"api_usage": {
"requests_used_by_this_call": 30,
"plan_requests_remaining": 0,
"plan_requests_limit": 0,
"note": "This search used 30 of your RapidAPI plan's requests; ... remain in the current period. Each date and destination combination is one billed request."
}
}其余的响应 shape 也常见,全部正常:
这些日期没有班机。
results: []+message— Google 对极多航线/日结合确实没有任何票;这不是异常。可尝试贴近的日期、附近机场,或设use_fallback: true。部分搜索失败。 一种
partial数告诉你 个搜索中失败了几组,结果代表其余。区间太大。 看到
search_coverage.truncated: true加note—— 就会从整个窗口内均匀抽样(保留首尾),而非取头部 N 天。那样样本能代表全域。当您想容量增加可升max_searches,或收小听。没有 key / key 被拒回。
needs_api_key: true(支出零)并说明修复方法。常见:有效 RapidAPI Key 但未订阅此 API。额度用荆。
quota_exhausted: true跟随api_usage,还提「视出度和缩实际日期让剩余数量够用更久」。
用户看的费用(api_usage)
费用是您出自己的,因此可见记表条目。每条成功响应都带:
字段 | 含义 |
| 这 一次工具调用所耗的 上游计费请求数量。 |
| 本期 RapidAPI 计划还余多少。 |
| 你计划这些总数本来就。 |
| 一句汇总,模型在回答你之前很可以“直接告诉你” |
remaining / limit(计费还是上游返回才有,源没返回就跳过)note 也随之显示。模应 应该规则不多说只要你记住了这两句:一个日期 × 一个目的地 = 一次收费请求。。
调成本还可以这样微调(从直接到再细):每次调用某 max_searches(数字)上限。缩小日期区间、缩短目的地列表 「法由 to max_searches 做首级」
一次调用,干…相当于三十各斩
底层 REST 每次请求只能传一个 (origin,destination,date) 三组,如果用逐 day / 一个地夹就好决策调用的话:方案“最便宜 tore Sri Lanka anywhere October” → 会被拆成 31 独立 sub-task —— 模型也联 31 次询回、有 31 次失良机,而用户要查看自己信用卡以后可能才发现账单多少钱。
现在是一次调用。扇出电话在私侧服务器端分配给全国、实时负载、有上限、均匀抽样、buy_link 去重、合并、按您 sort_by 排序。并会在 完成后把整个目录以 search_coverage 与 api_usage 上报。
本服务(Paid) | 免费服务器 | |
每次调用 扇出上限 | 30(硬上限 60;可在每次传 | 15 |
广告 | 零 | 每一条带卡为广告 |
key | 要带上自己的 RapidAPI key | 无需 |
上报使用 | 每请求都 | n/a |
能被目录收录 | ✔ | ✘ |
本服务器不含任何广告。:这不像是“品味差”,而受平台规则入—— Anthropic 的商业模式和 OpenAI 的应用商店工具政策都禁在工具结果里的第三方广告;一个广告服务器可靠又可笑;而后面的可被列。
本地开发
git clone <this repo> && cd mcp_server_paid
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
cp example.env .env # fill it in; leave RAPIDAPI_KEY empty
set -a && . .env && set +a
.venv/bin/python -m src # streamable HTTP on http://localhost:8000/mcp设备本地进程就这么连:
claude mcp add --transport http google-flights-local http://localhost:8000/mcp --header "x-rapidapi-key: YOUR_RAPIDAPI_KEY"cts(124 条用例通过,已验):
.venv/bin/python -m pytest -q全部配置都在 example.env;每个都不解释。关注重点:
变量 | 默认值 | 为什么重要 |
|
| 每次调用的扇出上限。硬性上限为 60。 |
|
| 扇出的并发度。 |
|
| 连接池上限;serverless 实例共享文件描述符池。 |
|
| 与上游上限一致,因此本端绝不会先超时。 |
|
| 每次独立上游搜索请求返回的结果数量。 |
| RapidAPI listing | 未携带 key 的用户访问时,将该 URL 原样返回作为提示。 |
|
| 由 |
| (空) | 生产环境中请保持为空。 如果设置了该值,那么每个无 key 的调用方都会由该订阅提供服务,并将其费用计入该订阅。服务器在启动时会记录警告,而 |
| (空) | 设置后, |
| (空) | 为空时禁用文件输出;stdout 上的 |
操作路由:GET /health(公开、无需认证——注册中心会轮询它)、GET /metrics、GET /metrics/calls?hours=24。
部署目标是 Vercel,通过 api/index.py(一个 FastAPI 包装器,向 FastMCP 传入其 lifespan,并设置 stateless_http=True)部署。标准的 MCP 路径为 /mcp,不能带尾部斜杠。
绝不要提交真实密钥。example.env 附带的是占位符;请务必保持这样。
非关联声明
这是一个返回公开航班定价的独立 API。它与 Google 无关联、未经其认可或赞助。仅使用“Google Flights”来描述该公共数据源。票价由上游提供并提供,且随时变动,且不保证有效——购买前请务必在航空公司或预订网站上确认最终价格。
Available Tools
4 toolsfind_hotel_by_nameFlightPowers: find one hotel by nameARead-onlyInspect
FlightPowers single-property lookup: live Booking.com availability and pricing for one named property. Input: the hotel name a person would type (adding the city helps when a chain has many properties) plus check-in and check-out dates -- no internal property ID needed, the resolution is done for you. Returns the property's price, review score, room type and a booking link. Use it to check one specific hotel, or to track a single property's price over time.
price_as_seen_from prices the stay as a shopper resident in that country would see it. Gaps are real but usually modest and property-dependent, and rates move between calls, so call each country a few times on this same property before reporting a gap.
Rates go stale within minutes: never reuse an earlier result.
Requires the caller's own RapidAPI key for the Booking Live API. Get one (free tier available) at https://rapidapi.com/mtnrabi/api/booking-live-api, then pass it as an x-rapidapi-key header (preferred), a ?rapidapi_key= query parameter on the server URL, or your client's own API key field -- first non-empty wins. Usage counts against the caller's own RapidAPI plan, not ours; every response reports what it spent and what is left in api_usage.
Inputs: hotel_name (required), checkin_date (required), checkout_date (required), adults, +3 more. Returns: A completed hotel search. The hotels upstream reports no search-status header,…
search_hotelsFlightPowers: search hotelsARead-onlyInspect
FlightPowers hotel search: live Booking.com availability and nightly prices for a destination and date range. Input: a free-text destination the way a person would say it ("Rome", "Tokyo Shibuya"), plus check-in and check-out dates. Returns each property's price, review score, room type, location and a booking link.
Set price_as_seen_from to a two-letter country code to price the same stay the way a shopper resident in that country would see it, which no other travel tool here can do. Gaps are real but usually modest and property-dependent, and rates move between calls, so hold one named property fixed, call each country a few times, and never read one call per country as a gap.
Rates go stale within minutes: never reuse an earlier result, search again.
Requires the caller's own RapidAPI key for the Booking Live API. Get one (free tier available) at https://rapidapi.com/mtnrabi/api/booking-live-api, then pass it as an x-rapidapi-key header (preferred), a ?rapidapi_key= query parameter on the server URL, or your client's own API key field -- first non-empty wins. Usage counts against the caller's own RapidAPI plan, not ours; every response reports what it spent and what is left in api_usage.
Inputs: destination (required), checkin_date (required), checkout_date (required), adults, +5 more. Returns: A completed hotel search. The hotels upstream reports no search-status header,…
search_oneway_flightsFlightPowers: search one-way flightsARead-onlyInspect
FlightPowers one-way fare search: live prices read from Google Flights. Input: origin and destination IATA codes -- the destination may be several codes, as "BCN,LIS,ATH" or ["BCN","LIS","ATH"] -- plus either one departure date or a date range. Returns each flight's price, airline, duration, stops, a bookable buy_link, and Google's historical price range (price_insights_low / price_insights_high) so you can say whether a fare is actually a good deal.
Use it for any one-way fare question, including open-ended ones. For a flexible search make ONE call with a date range and/or several destinations -- do NOT call it once per date. 'Cheapest flight to Sri Lanka anywhere in October' is one call, not thirty.
Each date/destination combination is one billed request; the count and the plan's remaining quota come back in api_usage.
by_destination carries one entry per destination you asked for -- empty ones included, each with a reason -- so read it before telling a user a destination has no flights.
Requires the caller's own RapidAPI key for the Google Flights Live API. Get one (free tier available) at https://rapidapi.com/mtnrabi/api/google-flights-live-api, then pass it as an x-rapidapi-key header (preferred), a ?rapidapi_key= query parameter on the server URL, or your client's own API key field -- first non-empty wins. Usage counts against the caller's own RapidAPI plan, not ours; every response reports what it spent and what is left in api_usage.
Inputs: to_airport (required), from_airport (required), limit, sort_by, +16 more. Returns: A completed flight search. Read search_status before reading results: an empty…
search_roundtrip_flightsFlightPowers: search round-trip flightsARead-onlyInspect
FlightPowers round-trip fare search: live prices read from Google Flights, priced as paired legs rather than two separate one-ways. Input: origin and destination IATA codes -- the destination may be several codes, as "BCN,LIS,ATH" or ["BCN","LIS","ATH"] -- a departure date or range, and either a return date or a trip length in nights. Returns the total price for both legs, per-leg airline, stops and duration, and a single bookable buy_link for the trip.
Use it for any return-trip fare question. For a flexible search make ONE call: pass departure_date_from / departure_date_to for the outbound range and nights instead of return_date to compare trip lengths -- '5 to 7 nights in Rome sometime in May' is one call.
Each date/destination combination is one billed request; the count and the plan's remaining quota come back in api_usage.
by_destination carries one entry per destination you asked for -- empty ones included, each with a reason -- so read it before telling a user a destination has no flights.
Requires the caller's own RapidAPI key for the Google Flights Live API. Get one (free tier available) at https://rapidapi.com/mtnrabi/api/google-flights-live-api, then pass it as an x-rapidapi-key header (preferred), a ?rapidapi_key= query parameter on the server URL, or your client's own API key field -- first non-empty wins. Usage counts against the caller's own RapidAPI plan, not ours; every response reports what it spent and what is left in api_usage.
Inputs: to_airport (required), from_airport (required), limit, nights, +15 more. Returns: A completed flight search. Read search_status before reading results: an empty…
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a clearly distinct query type: one-way flights, round-trip flights, general hotel search, and specific hotel lookup. Even the two hotel tools are easy to differentiate because one is broad destination search and the other is single-property lookup.
Three tools follow the search_<subject> pattern: search_oneway_flights, search_roundtrip_flights, and search_hotels. find_hotel_by_name breaks the pattern by using find_ instead of search_, though it remains readable and predictable.
Four tools is a well-scoped set for a travel-search server. Each tool earns its place and the count avoids both bloat and thinness.
The core search workflows are covered: one-way flights, round-trip flights, hotel search, and named-hotel lookup. Obvious gaps include multi-city flight search and airport/place code resolution, but agents can work around these with external knowledge or by combining existing tools.
Maintenance
Related MCP Connectors
Flight Intelligence MCP — search, cheapest dates, multi-city, airline compare via Google Flights
Flight search, airfare analytics, flexible destinations
Mubboo Flights: all-in-one travel comparison and tickets platform. MCP tools for flight search.
Live flight prices and working booking links for AI agents and travel apps.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides live flight prices, booking links, and airport lookup via a hosted MCP server. Enables search for flights and direct booking URL retrieval.2MIT
- AlicenseAqualityBmaintenanceEnables 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.1283 npm160 PyPI4MIT
- AlicenseNot gradedqualityCmaintenanceEnables real-time one-way and round-trip flight searches from any MCP client without an API key or account, returning live fares, historical price insights, and bookable links supported by disclosed sponsored cards.2MIT
- AlicenseAqualityCmaintenanceEnables MCP clients to search flight prices, stops, durations, cheapest dates within a range, compare nearby airports, and retrieve booking deep links.42MIT