google-flights-proto-mcp
This server provides MCP tools for building Google Flights protobuf search URLs, discovering and ranking complete paired itineraries, and verifying top booking options.
build_protobuf_search_url: creates a
tfssearch URL offline from origin/destination, dates, cabin, passengers, airlines, and many filters (price, stops, baggage, layovers, time windows).discover_and_rank_complete: performs browser-impersonating HTTP discovery, pairs outbound and return options, ranks full itineraries, and returns top 1–3 exact booking links with discovery-price labels.
search_and_verify_top: runs the full pipeline through Playwright, verifying the itinerary details, rendered total, required-taxes notice, provider handoff, and exposes a verified price only when all checks pass.
Supports extensive search controls: round-trip/one-way, cabin class, adult/child/infant counts, airline allowlists, stop limits, price caps, checked/carry-on bags, emission preference, layover/duration limits, and departure-time windows.
Accepts either IATA codes, date ranges, and ranking settings (
top_n,max_outbounds_to_expand,max_return_options_per_outbound).
Provides Google Flights search and itinerary verification, including round-trip flight pairing, ranking, exact booking URL generation, and Playwright-based price verification.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@google-flights-proto-mcp find cheap round-trip flights from Lisbon to Berlin next month and verify the top result"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Flights Protobuf MCP
Reverse engineered Google Flights and coded a lil smth to help plan my flights across Europe!
A standalone MCP server for this deliberately bounded pipeline:
protobuf tfs query
-> browser-impersonating HTTP discovery
-> outbound/return pairing
-> deterministic ranking
-> top 1-3 exact /booking?tfs= links
-> Playwright price + itinerary verificationHow the protobuf reverse-engineering works
Google Flights does not expose a supported public shopping API. Its web UI
stores the search state in the tfs query parameter used by URLs such as:
https://www.google.com/travel/flights/search?tfs=<URL_SAFE_BASE64>&hl=en&gl=PT&curr=EURThe tfs value is a serialized Protocol Buffers message encoded with URL-safe
Base64 and stripped of trailing = padding. The schema in
flights.proto is inferred from
the web application; it is not published or guaranteed by Google.
The encoder follows this path:
SearchRequest
-> Info protobuf
-> FlightData for each direction
-> airports, dates, stops, airlines and time filters
-> passengers, cabin, baggage, trip type and maximum price
-> SerializeToString()
-> URL-safe Base64 without padding
-> /travel/flights/search?tfs=...Important inferred fields include:
Message | Field | Meaning used here |
| 3 | Repeated outbound/inbound |
| 8 | Repeated passenger types |
| 9 | Cabin/seat class |
| 12 | Maximum fare filter |
| 13 | Baggage filters |
| 19 | Round trip or one way |
| 2 | Travel date |
| 4 | Selected physical flight legs |
| 5 | Maximum stops |
| 6 | Airline filters |
| 13 / 14 | Origin and destination airports |
The schema was reconstructed by changing one Google Flights control at a
time, decoding the resulting Base64 tokens, comparing protobuf wire tags, and
then validating the inferred type and field number by generating a new URL.
Unknown booking-only fields retain neutral names such as marker_one; the
project does not claim semantics that have not been demonstrated.
Why complete itinerary pairing takes two searches
A return fare cannot safely be produced by adding the cheapest outbound and cheapest inbound. Google reprices the trip after the outbound is selected. This project therefore:
searches and parses the available outbound directions;
embeds one selected outbound in field 4 of the outbound
FlightData;requests the repriced inbound choices for that selection;
pairs each inbound with that outbound and keeps Google's combined total;
embeds every physical leg from both directions in a booking
tfstoken.
This creates a deep link for one complete itinerary instead of a generic route/date search. Search-page prices are still discovery quotes until the Playwright verifier confirms the rendered total and provider handoff.
HTTP discovery is not an API
The fast discovery layer requests the normal Google Flights HTML using a
browser-compatible TLS fingerprint. It extracts the embedded ds:1 data from
AF_initDataCallback, parses both the top and other-flight groups, and rejects
consent pages, CAPTCHA responses, malformed payloads, and airport
substitutions. There is no stable JSON endpoint involved.
Google can change the protobuf schema, the embedded array layout, consent handling, or anti-automation policy at any time. The parsers are defensive, but this integration requires monitoring and should not be treated as a contracted production API. Use it responsibly and comply with Google's terms and applicable law.
The original public demonstration of this general tfs protobuf technique is
the AWeirdDev/flights project. This
repository reimplements the schema and adds complete itinerary pairing,
ranking, explicit verification states, MCP tools, the semester scanner, and
the Railway dashboard.
Related MCP server: google-flights-mcp
Install and run
cd google-flights-proto-mcp
uv sync --all-extras
uv run google-flights-proto-mcpFor streamable HTTP MCP:
uv run google-flights-proto-mcp-httpThe default endpoint is http://127.0.0.1:8010/mcp/. HTTP clients must send:
Accept: application/json, text/event-streamSet HOST and PORT to change the bind address. Browser discovery prefers an
installed Chrome/Chromium automatically. Override it with:
export GOOGLE_FLIGHTS_MCP_BROWSER_EXECUTABLE=/path/to/chromeIf Google rotates its EU consent cookie, set
GOOGLE_FLIGHTS_MCP_SOCS_COOKIE. The default is a consent-choice cookie, not
an account/session credential.
MCP tools
build_protobuf_search_url: builds a search URL without network access.discover_and_rank_complete: fast HTTP discovery, full round-trip pairing, ranking, and top 1-3 exact booking links. Its prices are explicitly marked as discovery prices.search_and_verify_top: the full pipeline. A price is verified only atshortlist[].verification.verified_pricewhenverifiedis true.
The discovered_price is Google Flights' HTTP shopping price for a fully
paired itinerary. It must never be relabelled as browser-verified. Exact
booking URLs pin dates, airports, passengers, cabin, airlines, and flight
numbers in protobuf; they do not freeze inventory or price.
Ranking
Ranking operates only on completed itinerary pairs:
50% total price
25% useful time at the destination
15% total flight time
10% stops
The initial outbound list is trimmed by price/stops/duration only to bound HTTP fan-out. That preliminary trim is not presented as the final ranking.
Verification contract
Playwright opens the exact /travel/flights/booking?tfs=... page and requires:
the rendered
Lowest total priceamount;the encoded passenger count and cabin;
all encoded flight legs and dates;
Google's required-taxes-and-fees notice;
a same-priced booking option and a successful provider handoff that repeats the same total.
On any mismatch or anti-automation challenge, verified_price remains null.
Even a provider-confirmed price can change before purchase, and optional
baggage or payment charges may still apply.
Fast weekend price scanner (no MCP, no Playwright)
For broad destination discovery, use the search-page scanner directly:
uv run python scripts/search_weekend_prices.py --top 5 --workers 4The scanner defaults to one adult. Override it explicitly with --adults N
when a different passenger count is needed.
It reads config/semester_2026.json, generates one
/travel/flights/search?tfs=<protobuf> URL per airport/weekend, fetches the
embedded Google search results, rejects alternate-airport substitutions, and
writes ranked JSON and CSV files under outputs/.
Useful overrides:
uv run python scripts/search_weekend_prices.py \
--weekend '25–28 Sep' \
--destinations BCN,FNC,NCE,MAD \
--max-stops 1 \
--max-price 500 \
--airlines U2,VY,FRThese are live Google search-page quotes, not checkout-verified prices. The scanner records anti-automation failures separately and never converts a blocked query into a false “no flights” result.
Travel windows can include an availability_note plus earliest outbound and
return hours. Exam-day windows use a realistic airport buffer: an assessment
ending at 19:30 does not permit a 21:00 departure.
When Friday has no exam, the corresponding search window starts at 23:00 on
Thursday so a useful extra evening flight is eligible without assuming the
traveller is free earlier that day.
Bucket-list deal ranking
After scanning the bucket-list airport universe, compare every destination with its own median quote across the semester windows and build the coverage-first plan:
uv run python scripts/rank_bucket_deals.pyThe output calls this baseline semester_window_median. It is an auditable
comparison within this scan, not Google's historical “typical price” signal.
Hourly Google Sheet refresh on macOS
scripts/refresh_google_sheet.py runs the bucket-airport scan for one adult,
retries transient failures, recalculates route medians, ranks every eligible
option, publishes the top three per weekend to the Sheet, and overwrites only
the values in 3 per Weekend!A2 and
3 per Weekend!A5:N43. Existing formatting and conditional-format rules are
preserved. The last good Sheet remains untouched if the scan is incomplete.
The default retry policy uses two workers and paced backoff because a complete
104-destination scan across 13 windows makes 1,352 Google searches and can
encounter HTTP 429 responses.
The job uses the official Google Sheets API for workbook writes. Create a
Google Cloud service account, enable the Google Sheets API, download its JSON
key outside this repository, and share the workbook with the service account's
client_email as an editor. Then test without changing the Sheet:
GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json \
uv run python scripts/refresh_google_sheet.py --dry-runRun one real refresh:
GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json \
uv run python scripts/refresh_google_sheet.pyFor an hourly macOS job, copy
com.kasperhong.fli-sheet-refresh.plist.example to
/Users/kasperhong/Library/LaunchAgents/com.kasperhong.fli-sheet-refresh.plist,
change the credentials path if needed, and load it:
launchctl bootstrap gui/$(id -u) \
/Users/kasperhong/Library/LaunchAgents/com.kasperhong.fli-sheet-refresh.plistInspect the log at outputs/hourly-refresh.log. To reload after editing the
plist, boot it out first and then bootstrap it again:
launchctl bootout gui/$(id -u) \
/Users/kasperhong/Library/LaunchAgents/com.kasperhong.fli-sheet-refresh.plistThe hourly rows remain Google search-page quotes. Provider-checkout Playwright verification is intentionally not run across the full route universe each hour; that should be limited to the current top one to three candidates.
Railway website
The Railway-ready FastAPI dashboard serves the last successful snapshot immediately and refreshes prices in the background. It includes:
every realistic option found under the hard €250 return ceiling, with the top three shown by default, a global Top 3 / All options switch, and per-weekend expansion;
exact one-adult protobuf Google Flights links;
hourly scanning, median recalculation, and reranking;
atomic snapshot publishing so blocked scans never replace good data;
/healthz,/api/status, and/api/dealsendpoints;an optional token-protected
POST /api/refreshendpoint.
Run it locally without starting background Google searches:
FLI_REFRESH_ENABLED=false uv run google-flights-proto-webThen open http://127.0.0.1:8000.
For Railway, deploy this directory as the service root. Railway detects the
included Dockerfile, starts the server on its injected PORT, and checks
/healthz. Add a persistent volume mounted at /data so successful snapshots
survive deployments. Use one replica; multiple replicas would each run their
own scanner.
Optional Railway variables:
Variable | Default | Purpose |
|
| Enable the background worker |
|
| Start a refresh after boot |
|
| Refresh interval |
|
| Concurrent Google requests |
|
| Maximum retry passes |
|
| Linear retry backoff |
| unset | Enables authenticated manual refresh |
Manual refresh, when FLI_ADMIN_TOKEN is configured:
curl -X POST -H "X-Refresh-Token: YOUR_TOKEN" \
https://YOUR-DOMAIN/api/refreshThe website intentionally labels prices as search-page quotes. Hosting does not turn them into checkout-verified fares, and Railway datacenter IPs may be rate-limited more often than a residential connection.
Available Tools
3 toolsbuild_protobuf_search_urlBuild Google Flights Protobuf URLARead-only
Build a real tfs protobuf search URL without making a network request.
Inputs: request (required). Returns: object
discover_and_rank_completeDiscover and Rank Complete ItinerariesBRead-only
Use protobuf+HTTP to pair full itineraries, rank them, and return top 1-3.
Inputs: request (required). Returns: object
search_and_verify_topSearch and Verify Top ItinerariesBRead-only
Run protobuf → HTTP → pairing → ranking → top 1-3 → Playwright verification.
Inputs: request (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
build_protobuf_search_url is clearly distinct as a URL builder, but discover_and_rank_complete and search_and_verify_top overlap heavily since both perform the same core search and ranking flow, differing only in the verification step. The descriptions help, but an agent could easily pick the wrong one when it only needs unverified results.
All tool names use snake_case and begin with a verb, which is a solid pattern. The minor inconsistency is that build_protobuf_search_url uses a simple verb_noun structure while the other two use verb_and_verb_complement, making the set slightly uneven but still readable.
Three tools is a reasonable size for a focused flight-search server that exposes a small pipeline: build URL, run search and ranking, then optionally verify. Each tool has a real purpose, though the set is slightly thin if broader flight-search operations were intended.
The tools cover the main workflow from URL construction through ranking and verification, so most end-to-end flight search needs are addressed. Minor gaps exist such as no tool to view raw intermediate protobuf/HTTP responses, but agents can work around this by chaining the available tools.
Maintenance
Related MCP Connectors
Flight search MCP server providing search, pagination, and itinerary details for AI assistants.
Flight Intelligence MCP — search, cheapest dates, multi-city, airline compare via Google Flights
Real-time Google Flights fares for agents. Three things people do with this server. Scan for deals: one call takes a date range and a list of destination airports, expands every combination server side, and returns each fare with Google's own low, typical or high verdict. Put live search in your app: flat JSON with a bookable link on every result, and round trips priced as paired legs. Run a 24/7 AI travel agent: add the server, sign in with Google, and schedule it. No ads, no sponsored content. You bring your own RapidAPI key, so every search is billed to your plan and never to anyone else's. Add https://flights.flightpowers.com/mcp , click Sign in, sign in with Google, and paste your RapidAPI key once on the page that opens. Scripts and clients without a sign-in button send the key as x-rapidapi-key on the same URL.
Search and compare flight offers through a cache-aware Streamable HTTP MCP server for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables 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 PyPI3,490MIT
- AlicenseAqualityBmaintenanceEnables real-time flight fare searches across date ranges and multiple destinations, with historical price insights and booking links. Provides one-way and round-trip search tools through MCP.41MIT
- AlicenseAqualityCmaintenanceEnables searching Google Flights and getting structured, price-sorted flight options locally through MCP clients like Claude or Codex, with no API key or central server required.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search Google Flights for trips, filter for Starlink-equipped flights, enforce connection rules, compare fare premiums, and manage saved search presets through MCP tools.MIT