Skip to main content

Flight reconnaissance MCP server: search, price calendar, layover scoring, carbon emissions, weighted optimal-path ranking. Pluggable providers (SerpApi + RapidAPI Sky-Scrapper) with automatic monthly-quota fallback.

Project description

flights-mcp

A flight-reconnaissance MCP server with one provider, one key, no KYC.

  • Search flights with full pricing, every segment, every carrier, every layover
  • Per-day price calendar (cheapest dates)
  • Layover-quality scoring (connection-time risk, terminal change, overnight, airport reputation)
  • Weighted multi-criteria ranking → "find the optimal flight path"
  • Airport autocomplete

The one API you need

Provider Free tier Signup
RapidAPI Sky-Scrapper 100 requests / month https://rapidapi.com/apiheya/api/sky-scrapper

Steps:

  1. Sign up at https://rapidapi.com/auth/sign-up (just email).
  2. Visit https://rapidapi.com/apiheya/api/sky-scrapper and click Subscribe to Test.
  3. Pick the Basic (Free) plan — no card required.
  4. Copy X-RapidAPI-Key from the code-snippets panel.

Quick start

git clone <repo> flights-mcp
cd flights-mcp
python -m venv .venv
.venv\Scripts\activate
pip install -e .
copy .env.example .env
# open .env and paste your RAPIDAPI_KEY
python -m flights_mcp                       # stdio MCP server

Wire it into your MCP client

Claude Desktop

Edit claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/; Windows: %APPDATA%\Claude\):

{
  "mcpServers": {
    "flights": {
      "command": "python",
      "args": ["-m", "flights_mcp"],
      "env": {
        "PYTHONPATH": "C:/path/to/flights-mcp/src",
        "RAPIDAPI_KEY": "your_rapidapi_key_here"
      }
    }
  }
}

Full example: examples/claude_desktop_config.json.

Cursor / Continue / Cline / generic MCP clients

Most clients accept the mcp.json form. The ${RAPIDAPI_KEY} placeholder there is not a real key — the client substitutes it from your shell env or its secret store at launch. Real keys live in .env (gitignored) or your client's secret store.

Tools

Tool Purpose
search_airports City/airport → IATA, name, country
search_flights Search w/ full segments, carriers, durations, layovers, prices
cheapest_dates Per-day price calendar across upcoming dates
analyze_layovers Score each layover: MCT, terminal change, overnight, airport quality
rank_options Multi-criteria weighted scoring on a set of offer IDs
find_optimal_path One-shot: search + rank + return top N with rationale
compare_offers Side-by-side comparison table

Ranking model

Each criterion is normalised to [0, 1] across the candidate set (1 = best), then combined with caller-tunable weights:

Criterion Default Meaning
price 0.40 Lower total → higher score
duration 0.25 Shorter total travel time → higher
stops 0.15 Non-stop > 1 stop > 2 stops
layover_quality 0.15 Connection time, terminal change, overnight, airport reputation
seat_quality 0.05 Best-effort: cabin class signal from search results

Override per call:

find_optimal_path(
  origin="SFO", destination="SIN", departure_date="2026-07-04",
  weight_price=0.10, weight_layover_quality=0.40, weight_duration=0.30
)

Weights are auto-normalised, so any positive numbers work.

Layover heuristics

analyze_layovers and the layover_quality criterion penalise:

Connection length Penalty
< 45 min heavy — below most carriers' Minimum Connection Time
45–60 min moderate (tight)
60–180 min none (sweet spot)
180–360 min small (long wait)
> 360 min moderate (very long)

Plus penalty for overnight and terminal-change layovers. Small bonus for premium hubs (SIN, HKG, ICN, DOH, DXB, ZRH, AMS, CPH, HEL, MUC, FRA, ATL…); small penalty for delay-prone hubs (EWR, LGA, ORD, PHL, MIA, FCO, MAD).

Project layout

flights-mcp/
├── README.md
├── mcp.json                       # MCP manifest — env-var placeholders only
├── pyproject.toml
├── .env.example                   # one signup URL, one key
├── src/flights_mcp/
│   ├── __main__.py                # python -m flights_mcp
│   ├── server.py                  # FastMCP server, 7 tools
│   ├── config.py
│   ├── models.py                  # Airport / FlightOffer / Itinerary / Segment / Layover
│   ├── ranking.py                 # weighted multi-criteria scoring
│   ├── cache.py
│   └── providers/
│       ├── base.py
│       └── rapidapi.py            # Sky-Scrapper client + normaliser
├── examples/
│   ├── claude_desktop_config.json
│   └── sample_queries.md
└── tests/test_ranking.py

Development

pip install -e ".[dev]"
$env:PYTHONPATH = "src"
pytest                                       # Windows PowerShell
# PYTHONPATH=src pytest                      # macOS / Linux
python tests\_live_smoke.py                  # live RapidAPI call (uses one quota credit)

Security note

API keys live in .env (gitignored) or your MCP client's secret store. The mcp.json in this repo contains only ${VAR_NAME} placeholders — never literal keys.

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flight_recon_mcp-0.1.1.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flight_recon_mcp-0.1.1-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file flight_recon_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: flight_recon_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for flight_recon_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e456b3206a92a232980f47beb86f22e07f5ee6528a12ef002f441960cf689811
MD5 1d914476cdb94c7dabb83c3d19e45081
BLAKE2b-256 a265cbb277a462fe98fa66707add62480a05adc67cd67b2abd238e08d344adf6

See more details on using hashes here.

File details

Details for the file flight_recon_mcp-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flight_recon_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 089a7b8f801bd663927f1a8c0d3c2436495d092810938db23819cdcb449fac12
MD5 9a97810504e392c2eef301c7ee9151f0
BLAKE2b-256 c81135ceea4cac05c13c0f68f09a582a9a60752398551fde247a2840e8c14d59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page