Metadata-Version: 2.5
Name: india-flights-mcp
Version: 0.1.0
Summary: MCP server for Indian domestic flight search, day-of-travel status, airline policy RAG and travel preferences
Project-URL: Repository, https://github.com/rkZ-10/travel-assistant
Project-URL: Documentation, https://github.com/rkZ-10/travel-assistant/blob/master/docs/mcp-server.md
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: fastembed>=0.8
Requires-Dist: httpx>=0.28
Requires-Dist: mcp<3,>=2.2
Requires-Dist: numpy>=2.1
Requires-Dist: onnxruntime>=1.20
Requires-Dist: pdfplumber>=0.11
Requires-Dist: platformdirs>=4
Requires-Dist: pydantic>=2.10
Requires-Dist: python-dotenv>=1.0
Requires-Dist: pyyaml>=6
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# india-flights-mcp

<!-- mcp-name: io.github.rkZ-10/india-flights-mcp -->

An [MCP](https://modelcontextprotocol.io) server for **Indian domestic flights**: live fares, day-of-travel
flight status, airline fare rules and DGCA passenger rights with citations, and your saved travel preferences.
It runs on your own computer, over stdio, with your own free API keys. Use it from Claude Desktop, Claude Code or any
other MCP client.

A personal portfolio project, not affiliated with any airline, Google, SerpApi, AirLabs or DGCA. Source and full
documentation: [github.com/rkZ-10/travel-assistant](https://github.com/rkZ-10/travel-assistant).

## What it does

| Tool | Backed by | Use it for |
|---|---|---|
| `search_flights` | Google Flights via SerpApi | Fares on a future date: one-way or round trip, class, nonstop, airlines, max price. Prices in INR |
| `get_booking_options` | SerpApi | Sellers and fare types for one itinerary, with a link to book on the seller's site |
| `get_flight_status` | AirLabs (optional) | Delay, gate and terminal for a flight in the next ~12 hours |
| `get_route_departures` | AirLabs (optional) | What's leaving on a route in the next ~12 hours |
| `get_api_usage` | local | API calls used this month against your budget |
| `search_policies` | local index | Baggage, fare types, change and cancellation fees, refunds, DGCA compensation: cited passages with the date each page was captured, and which airlines aren't covered |
| `list_policy_sources` | local | Which policy pages are indexed, when they were captured, and how to add the rest |
| `get_travel_preferences` / `update_travel_preferences` | local | Your defaults: home airport, airlines to prefer or avoid, stops, departure window, budget… |

It also offers a `plan_trip` prompt, and tells the model how to use the tools well: answer fare rules only from the
cited passages, say when an airline isn't covered, never invent prices or fees, and save preferences only with your
agreement. Nothing is booked: booking links open the seller's own site.

## Install

You need [uv](https://docs.astral.sh/uv/getting-started/installation/) (it fetches Python 3.12+ if needed). Nothing
else to install: `uvx india-flights-mcp` downloads and runs the server. To check it installs:

```shell
uvx india-flights-mcp --version
```

Run without options, it waits for an MCP client on stdin; your client starts it for you (below).

(`pip install india-flights-mcp` also works; it provides the same `india-flights-mcp` command plus `travel-mcp`
and `travel-rag`.)

## API keys (free plans)

| Variable | Needed for | Get one | Free plan (at the time of writing) |
|---|---|---|---|
| `SERPAPI_KEY` (needed) | `search_flights`, `get_booking_options` | [serpapi.com](https://serpapi.com) | ~250 searches a month |
| `AIRLABS_API_KEY` (optional extra) | `get_flight_status`, `get_route_departures` | [airlabs.co](https://airlabs.co) | ~1,000 requests a month |

**AirLabs is optional.** Without `AIRLABS_API_KEY` the two live-status tools aren't offered at all, and the server
tells the model live status isn't available. Everything else works the same. Add the key later to turn them on.

The server counts your calls and **stops at 90 % of each monthly budget**, so a free plan isn't overrun. Results are
cached (searches 20 minutes, status 5 minutes), and cached answers are free; `get_api_usage` shows what's left. On a
bigger plan, raise the budgets with `SERPAPI_MONTHLY_BUDGET` and `AIRLABS_MONTHLY_BUDGET`. Without `SERPAPI_KEY`, the
search tools say so when called and the rest keep working.

Keys go in the `env` block of your MCP client's config (below). They're only sent to SerpApi and AirLabs.

## Claude Desktop

**One-click bundle:** download `india-flights-mcp-<version>.mcpb` from the
[releases page](https://github.com/rkZ-10/travel-assistant/releases) and open it (or **Settings → Extensions →
Advanced settings → Install Extension…**). Claude asks for your SerpApi key and, optionally, your AirLabs key, and
installs the Python dependencies itself; the first start takes a minute.

**Or by config:** open **Settings → Developer → Edit Config** and add this to `claude_desktop_config.json`, then fully quit and reopen
Claude:

```json
{
  "mcpServers": {
    "india-flights": {
      "command": "uvx",
      "args": ["india-flights-mcp"],
      "env": {
        "SERPAPI_KEY": "your-serpapi-key",
        "AIRLABS_API_KEY": "your-airlabs-key"
      }
    }
  }
}
```

No AirLabs key? Leave out the `AIRLABS_API_KEY` line (and the comma before it).

If Claude reports it can't find `uvx`, put its full path in `command` (run `where uvx` on Windows or `which uvx` on
macOS and Linux to find it).

## Claude Code

```shell
claude mcp add india-flights --scope user \
  --env SERPAPI_KEY=your-serpapi-key --env AIRLABS_API_KEY=your-airlabs-key \
  -- uvx india-flights-mcp
```

Without an AirLabs key, drop `--env AIRLABS_API_KEY=...`. `--scope user` makes it available in every project; leave it out to add it to the current project only. Check it
with `claude mcp list`.

## First run: build the policy index

Fare-rule and refund answers come from a local index of official airline pages and DGCA rules. It starts empty.
Build it once:

```shell
uvx --from india-flights-mcp travel-rag ingest
uvx --from india-flights-mcp travel-rag sources
```

The first `ingest` downloads the embedding model, **about 70 MB**, which then runs locally (no API key, nothing
sent anywhere). The first install of the server itself is also a few hundred MB of dependencies (ONNX Runtime, NumPy).
Re-run `ingest` every month or two; answers warn when a page was captured more than 60 days ago.

## Which airlines are covered

| Airline | How its pages get into the index |
|---|---|
| Akasa Air, Alliance Air, DGCA rules | Fetched automatically by `ingest` |
| IndiGo (4 pages), Air India (2), Air India Express (2), SpiceJet (1) | **Saved by hand from a browser**: these sites block automated clients, disallow them in robots.txt, or build the page with JavaScript |
| Star Air, Fly91 | Not covered yet. The server says so instead of guessing |

### Saving the browser-only pages

`save-pages` walks you through them, one at a time:

```shell
uvx --from india-flights-mcp travel-rag save-pages
```

For each page that's missing or older than 60 days, it opens the page **in your own browser** and tells you the
file name and how to save it. Then it waits for the file to appear in your Downloads folder, checks it, and files it
in your policy pages folder under the right name. You do the visiting and saving; the tool never fetches these pages
itself and never drives the browser.

How to save each one (press **Ctrl+S**, or **Cmd+S** on a Mac):

- most pages: **"Webpage, HTML only"**;
- Air India Express's baggage FAQ: **"Webpage, Complete"** (the page is built by JavaScript; the `_files` folder
  that comes with it is moved too);
- Air India Express's fees: the PDF itself (its download button), not a printout.

Each saved file is checked with the same tests `ingest` uses. A bot-check page, a cookie wall or an empty
JavaScript shell is rejected with the reason, and you can retry or skip. Your previous copy is kept until a new one
passes. When it's done, it prints a summary and indexes what you saved.

| Option | Use |
|---|---|
| `--all` | Re-save every hand-saved page, even fresh ones |
| `--only ID [ID ...]` | Just these pages (ids from `travel-rag sources`) |
| `--downloads DIR` | Your browser saves somewhere other than `~/Downloads` |
| `--timeout SEC` | How long to wait for each file (default 300) |
| `--no-ingest` | Don't index afterwards; run `travel-rag ingest` yourself |

`travel-rag sources` lists every page with its status and suggests `save-pages` when some are missing or stale.
You can also save a page by hand: `sources` prints the exact file path for each one.

`ingest` fetches only the automatic sources. It identifies itself honestly as `india-flights-mcp`, respects
robots.txt, and never pretends to be a browser. Saved pages stay on your computer.

The DGCA refund rules in the index are the 2019 version, which DGCA revised in March 2026. Answers flag this.

## Where your data is stored

Everything stays in a per-user folder:

| System | Folder |
|---|---|
| Windows | `%LOCALAPPDATA%\india-flights-mcp` |
| macOS | `~/Library/Application Support/india-flights-mcp` |
| Linux | `~/.local/share/india-flights-mcp` (or `$XDG_DATA_HOME/india-flights-mcp`) |

It holds the API cache and monthly call counts (`travel_mcp.sqlite3`), the policy index (`policies.sqlite3`), the
embedding model (`models/`), your preferences (`preferences.json`, with a change log), and the policy pages folder
(`rag/`: `snapshots/` from `ingest`, `manual/` for pages you save). Set `TRAVEL_MCP_DATA_DIR` to use a different
folder, or `TRAVEL_MCP_RAG_DIR` to move just the policy pages. Delete the folder to start fresh.

## Limits

- Fares come from Google Flights through SerpApi and can differ from the airline's own site. A search price usually
  means the airline's basic fare; the exact fare type shows when you book.
- Flight status covers roughly the next 12 hours only.
- Policy answers are only as current as the pages you captured, and only cover the airlines listed above.

## More

- [MCP server documentation](https://github.com/rkZ-10/travel-assistant/blob/master/docs/mcp-server.md): tools, quotas,
  validation, configuration
- [Policy index (RAG)](https://github.com/rkZ-10/travel-assistant/blob/master/docs/rag.md): sources, extraction,
  retrieval, freshness
- [Developing from a checkout](https://github.com/rkZ-10/travel-assistant/blob/master/docs/setup.md)
- [Issues](https://github.com/rkZ-10/travel-assistant/issues)

MIT licence.
