Skip to main content
Glama

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 verification

How 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=EUR

The 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

Info

3

Repeated outbound/inbound FlightData directions

Info

8

Repeated passenger types

Info

9

Cabin/seat class

Info

12

Maximum fare filter

Info

13

Baggage filters

Info

19

Round trip or one way

FlightData

2

Travel date

FlightData

4

Selected physical flight legs

FlightData

5

Maximum stops

FlightData

6

Airline filters

FlightData

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:

  1. searches and parses the available outbound directions;

  2. embeds one selected outbound in field 4 of the outbound FlightData;

  3. requests the repriced inbound choices for that selection;

  4. pairs each inbound with that outbound and keeps Google's combined total;

  5. embeds every physical leg from both directions in a booking tfs token.

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: fli

Install and run

cd google-flights-proto-mcp
uv sync --all-extras
uv run google-flights-proto-mcp

For streamable HTTP MCP:

uv run google-flights-proto-mcp-http

The default endpoint is http://127.0.0.1:8010/mcp/. HTTP clients must send:

Accept: application/json, text/event-stream

Set 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/chrome

If 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 at shortlist[].verification.verified_price when verified is 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 price amount;

  • 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 4

The 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,FR

These 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.

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.py

The 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, reranks exactly three options per weekend, 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-run

Run one real refresh:

GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json \
  uv run python scripts/refresh_google_sheet.py

For 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.plist

Inspect 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.plist

The 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:

  • up to three realistic options per weekend, with a hard €250 return ceiling;

  • 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/deals endpoints;

  • an optional token-protected POST /api/refresh endpoint.

Run it locally without starting background Google searches:

FLI_REFRESH_ENABLED=false uv run google-flights-proto-web

Then 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

FLI_REFRESH_ENABLED

true

Enable the background worker

FLI_REFRESH_ON_STARTUP

true

Start a refresh after boot

FLI_REFRESH_INTERVAL_SECONDS

3600

Refresh interval

FLI_REFRESH_WORKERS

2

Concurrent Google requests

FLI_REFRESH_RETRY_PASSES

6

Maximum retry passes

FLI_REFRESH_RETRY_DELAY_SECONDS

10

Linear retry backoff

FLI_ADMIN_TOKEN

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/refresh

The 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 tools
build_protobuf_search_urlBuild Google Flights Protobuf URLA
Read-only

Build a real tfs protobuf search URL without making a network request.

ParametersJSON Schema
NameRequiredDescriptionDefault
requestYesOne Google Flights search and the controls used by the ranking pipeline.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The readOnlyHint annotation already indicates no side effects, and the description reinforces this with 'without making a network request.' It adds useful behavioral context by clarifying that the tool performs local construction only, which is meaningful beyond the annotation alone.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence with no filler. It front-loads the core action and resource, then adds the most important behavioral qualifier: no network request.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists and the input schema fully documents the request object, the description only needs to convey the tool's high-level purpose and side-effect profile. 'Build a real tfs protobuf search URL without making a network request' does exactly that, leaving no significant gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, including a well-described nested request object with defaults, ranges, and field-level descriptions. The description itself adds no parameter-level meaning, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Build') and resource ('tfs protobuf search URL') and adds the critical distinction that it does not make a network request. This clearly differentiates the tool from siblings such as discover_and_rank_complete and search_and_verify_top, which imply actual searching and verification.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'without making a network request' clause signals that this tool is for pure URL construction rather than executing a flight search, which gives an agent clear situational context. It does not explicitly name alternative tools, but the distinction from the sibling tools is strongly implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

discover_and_rank_completeDiscover and Rank Complete ItinerariesB
Read-only

Use protobuf+HTTP to pair full itineraries, rank them, and return top 1-3.

ParametersJSON Schema
NameRequiredDescriptionDefault
requestYesOne Google Flights search and the controls used by the ranking pipeline.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, and the description adds the protobuf+HTTP transport and the top-1-3 return behavior, which is modest extra context. It does not explain ranking criteria, external-call semantics, or failure behavior, but the read-only annotation lowers the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single efficient sentence that front-loads the core action and result. It contains no filler, though 'Use protobuf+HTTP' is terse and could be more descriptive without becoming bloated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity—a large nested request, an output schema, and two sibling tools—the description omits important context about what 'complete itineraries' means, how ranking works, and when to select this over the siblings. The output schema covers return structure, but behavioral and selection context are lacking.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with the nested request object documented as 'One Google Flights search and the controls used by the ranking pipeline.' The description adds no parameter-level detail, so it does not exceed the baseline established by the rich schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a concrete outcome ('pair full itineraries, rank them, and return top 1-3') and hints at a distinct mechanism ('protobuf+HTTP'), which helps separate it from the URL-building and verification siblings. However, 'pair' is jargon and not explained, so it stops short of a fully self-contained purpose statement.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus build_protobuf_search_url or search_and_verify_top, and no mention of prerequisites or exclusions. The word 'Use' implies a general directive, but the description does not provide selection conditions or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_and_verify_topSearch and Verify Top ItinerariesB
Read-only

Run protobuf → HTTP → pairing → ranking → top 1-3 → Playwright verification.

ParametersJSON Schema
NameRequiredDescriptionDefault
requestYesOne Google Flights search and the controls used by the ranking pipeline.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, so the read-only safety profile is established. The description adds the pipeline stages and the notable Playwright verification step, but it does not explain what verification entails, potential latency, or whether browser automation could have observable side effects. With annotations covering the main safety burden, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely compact, with no filler words, and the arrows convey a clear execution order. It is front-loaded and efficient, though the internal jargon makes it less immediately readable than a plain-language sentence.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of the request object and the existence of an output schema, the description provides only a pipeline synopsis. It omits when to call the tool, what 'verification' actually validates, and how results are returned. Annotations and schema fill some gaps, but the description is incomplete for a tool this rich.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the request object is described as a Google Flights search with ranking controls. The tool description adds no parameter-level meaning beyond the schema; 'top 1-3' maps loosely to top_n, but the schema already documents that. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a concrete pipeline—protobuf to HTTP to pairing/ranking to top 1-3 to Playwright verification—and the title clarifies the resource: top itineraries. It is specific enough to distinguish this from the siblings at a high level, though it does not explicitly contrast with discover_and_rank_complete or state the final return value.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit statement about when to use this tool versus build_protobuf_search_url or discover_and_rank_complete. The 'top 1-3' mention weakly implies small result sets, but no when/when-not conditions or alternative routing are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedbuild_protobuf_search_url
    • First observeddiscover_and_rank_complete
    • First observedsearch_and_verify_top

TDQS

B3.4/5.0

Scored across 3 tools

Disambiguation3/5

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.

Naming Consistency4/5

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.

Tool Count4/5

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.

Completeness4/5

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

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A remote MCP server that searches Google Flights for flight information and airport codes. It enables users to find flights, locate airports, and generate travel dates through natural language interactions.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables flight search and fare calendar exploration by interacting with Google Flights' API, supporting detailed filters for origin, destination, dates, cabin class, airlines, and more.
    3,138
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Enables 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.
    4
    1
    MIT