Skip to main content
Glama
README.md
# eu261-metar-engine

<p>
  <a href="https://www.npmjs.com/package/eu261-metar-engine"><img src="https://img.shields.io/npm/v/eu261-metar-engine?color=1f6feb" alt="npm version"></a>
  <a href="https://registry.modelcontextprotocol.io/v0/servers?search=eu261-metar-engine"><img src="https://img.shields.io/badge/MCP%20Registry-io.github.gsailing19%2Feu261--metar--engine-111827" alt="Official MCP Registry"></a>
  <a href="https://github.com/gsailing19/eu261-metar-engine/actions"><img src="https://github.com/gsailing19/eu261-metar-engine/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-2ea043" alt="MIT License"></a>
  <a href="https://cavoko.com"><img src="https://img.shields.io/badge/live-cavoko.com-d97706" alt="Live at cavoko.com"></a>
</p>

Zero-LLM, zero-PII, deterministic TypeScript compensation calculator for **Regulation (EC) No 261/2004**, **UK261**, and **Regulation (EU) 2026/2202**, paired with a free **NOAA AviationWeather + Iowa Environmental Mesonet (IEM ASOS)** historical METAR weather excuse auditor and **MCP Server (`eu261-mcp`)**.

Built for [Cavoko](https://cavoko.com) under the MIT License.

## Features

- **1,988+ Commercial Airports (OurAirports CC0)**: Instant offline IATA/ICAO lookup, EU/EEA/CH/UK jurisdiction tagging (including EU outermost regions), and WGS-84 Vincenty great-circle distance (`ECJ C-559/16 Bossen`).
- **Exact Regulation Transition (`2027-10-23`)**:
  - `flightDate < 2027-10-23` -> **EC 261/2004** with national 1–6 year limitation periods (non-retroactive).
  - `flightDate >= 2027-10-23` -> **Regulation (EU) 2026/2202** (adopted 2026-09-16, published 2026-10-02, preserves 3-hour threshold €250/€400/€600, uniform 9-month claim deadline, 30-day mandatory airline response).
  - **UK261** (£220 / £350 / £520, 6-year limitation in England/Wales, 5 years in Scotland).
- **Free Historical & Live METAR Fact-Checking (`$0/mo`)**:
  - Decodes raw ICAO METAR winds, gusts, visibility (meters & statute miles), ceilings, RVR, and severe phenomena (`TS`, `FZRA`, `FG`, `+SN`, `VA`, `SQ`).
  - Automatically queries NOAA AviationWeather (<40h) and Iowa Environmental Mesonet ASOS (>40h, decades of archive) with polite 1.1s throttling.
- **4-Language DIY Claim Letters (`en`, `de`, `es`, `pl`)**: Deterministic templates citing exact case law (`C-559/16 Bossen`, `C-452/13 Henning`, `C-402/07 Sturgeon`, `C-549/07 Wallentin-Hermann`) and raw METAR logs with zero PII collection.
- **Built-in MCP Server (`eu261-mcp`)**: Listed in the Official MCP Registry (`io.github.gsailing19/eu261-metar-engine`). Connect **Grok Build**, **Grok Bot**, Claude Desktop, Cursor, Codex CLI, or any MCP host directly to deterministic EU261 + METAR tools.

## Quick Start

```ts
import { evaluateCompensation, auditRouteMetar, generateDiyClaimLetter } from "eu261-metar-engine";

const verdict = evaluateCompensation({
  departureCode: "STN",
  arrivalCode: "MAD",
  operatingCarrierIata: "FR",
  flightDate: "2026-07-15",
  disruptionType: "delay",
  arrivalDelayMinutes: 215,
});

const metarAudit = await auditRouteMetar("STN", "MAD", "2026-07-15", {
  scheduledHourUtc: 12,
});

const letter = generateDiyClaimLetter({
  locale: "en",
  verdict,
  flightNumber: "FR5992",
  metarAudit,
  airlineCitedWeather: true,
});
```

## MCP Server (`eu261-mcp`)

Published on npm (`eu261-metar-engine`) and listed in the **Official MCP Registry** as `io.github.gsailing19/eu261-metar-engine`.

### Grok Build / Codex CLI (`~/.grok/config.toml` or `~/.codex/config.toml`)

```toml
[mcp_servers.eu261]
command = "npx"
args = ["-y", "eu261-metar-engine"]
```

### Claude Desktop / Cursor / JSON MCP Hosts

```json
{
  "mcpServers": {
    "eu261-mcp": {
      "command": "npx",
      "args": ["-y", "eu261-metar-engine"]
    }
  }
}
```

Tools exposed:
- `evaluate_flight_compensation`
- `audit_airport_weather_metar`
- `generate_diy_claim_letter`
- `lookup_airport_or_airline`

## Live Web App & Regulatory Guides

Try the zero-email interactive checker, historical METAR weather evidence cards, and 4-language (EN / DE / ES / PL) airline rejection guides live at **[cavoko.com](https://cavoko.com)**:

- Live checker: https://cavoko.com
- EC 261/2004 vs Regulation (EU) 2026/2202 transition table: https://cavoko.com/eu-2026-2202
- DIY vs claim agencies comparison: https://cavoko.com/compare

## Disclaimer

This library is an automated informational verification tool based on public regulations and official METAR archives. It does not constitute formal legal advice.