Flight Planner
by menonpg
README.md
# Flight Planner (Claude + aviationweather.gov)
[](LICENSE)
A small chat-driven flight-planning app. You describe the trip (route, aircraft, flight level, departure time) and Claude pulls weather from **aviationweather.gov**, takes screenshots of the **Graphical Forecast for Aviation (GFA)** at your altitude, computes a nav log, and writes up a briefing you can save.
It works best as an **MCP server for Claude Code**: about twenty aviation tools (weather, GFA screenshots, a GFS route-weather profile with a per-point VFR check, POH-based nav log, weight and balance, fuel stops, radio plan) plus HTML briefing reports with a takeoff-time slider. A separate `/airfare` command compares airline fares in your own Chrome browser for trips that don't suit a small airplane.
> ⚠️ Planning aid only. It does **not** replace an official briefing (1800wxbrief.com), NOTAMs/TFRs, your POH/AFM, or PIC judgment. It has no NOTAM/TFR data.
## Option A: use it from Claude Code (no API key; uses your Claude Code / Enterprise login)
The tools are also an MCP server (`flightplanner/mcp_server.py`, registered in `.mcp.json`).
```bash
git clone https://github.com/menonpg/flightplanner-mcp.git && cd flightplanner-mcp
./run.sh --setup-only # first time: creates .venv, installs deps + headless Chromium
claude # in this folder; approve the "flightplanner" MCP server when asked
```
Then ask in plain language, or use the shortcut:
```
/flightplan KDEN DBL KSLC in a TBM960 at FL280 departing 18Z
```
Defaults in `/flightplan` assume a VFR pilot and US Eastern times; edit `.claude/commands/flightplan.md` to match you (aircraft id, power setting, IFR/VFR).
### `/airfare`: airline fares across all carriers (browser-driven)
```
/airfare PIT ATL Wed Dec 16 morning nonstop, back Thu Dec 17 evening
```
Needs the [Claude in Chrome](https://claude.com/chrome) extension. Claude opens Google Flights in your own Chrome, then checks Southwest, Frontier, Spirit, Breeze, Allegiant and others on their own sites when they serve the route. It compares basic and regular economy, one-ways and round trips, and bag costs, and recommends a pick with booking links. It **only looks**: it never signs in, enters personal or payment details, or clicks purchase, and it stops if a site shows a CAPTCHA. No API keys.
Screenshots appear inline for Claude to read and are saved in `data/shots/`; briefings go to `data/plans/`.
## Option B: the web app (needs an API key)
### Quick start
```bash
export ANTHROPIC_API_KEY=sk-ant-... # get one at console.anthropic.com (or run `ant auth login`)
./run.sh # first run creates .venv and installs headless Chromium
open http://127.0.0.1:8000
```
Then type something like:
- *Plan KDEN to KSLC via DBL in a TBM 960 at FL280, departing 18Z. Full briefing.*
- *C172S KAPA to KCOS at 9500 VFR in 2 hours — what's the freezing level and icing risk?*
- *Show GFA temps and winds at FL180 over the Rockies, +6h.*
- *Save my aircraft N123AB: 170 kt TAS at 16 gph, climb 900 fpm at 110 kt / 24 gph, …*
## What Claude can use (tools)
| Tool | Source |
|---|---|
| `resolve_route`: airports, navaids, fixes → coordinates, legs, true courses | aviationweather.gov `/api/data/flightpath` |
| `get_metars`, `get_tafs`, `get_pireps` (filtered to ±3000 ft of your FL) | aviationweather.gov Data API |
| `get_route_advisories`: SIGMETs, G-AIRMETs (incl. freezing level), CWAs in your corridor and altitude band | aviationweather.gov Data API |
| `get_forecast_discussion` (AFD aviation section) | aviationweather.gov Data API |
| `get_airport_info`: elevation, magnetic variation, runways, frequencies | aviationweather.gov Data API |
| `capture_gfa_map`: screenshot of any GFA tab (obs, cigvis, clouds, pcpn, thunder, **temps**, **winds**, **turb**, **ice**, sigmet, gairmet, cwa, progchart, taf) at a flight level and forecast hour, zoomed to your route with the route drawn | aviationweather.gov/gfa (headless Chromium) |
| `capture_cross_section`: vertical cross-section along the route (temp, wind, turbulence, icing) | GFA Flight Path tool |
| `get_static_chart`: GFA clouds/surface PNGs by region, WPC prog charts | aviationweather.gov static products |
| `get_winds_temps_aloft`: numeric wind/temp/ISA deviation at your FL along the route | NOAA GFS via Open-Meteo (see note) |
| `compute_nav_log`: TC, WCA, MH, GS, ETE, fuel per leg, TOC/TOD, reserve, warnings (ceiling, O₂ 91.211, hemispheric altitude, fuel) | local calc |
| `route_weather_profile`: point-by-point weather the airplane flies through (cloud layers, freezing level, icing-risk layers, in-cloud at cruise, wind/temp, precip, terrain, surface wind), timed to your position; **works up to ~15 days ahead** for "Thursday or Friday?" questions | NOAA GFS via Open-Meteo |
| `get_comms_plan`: who to call, when (US Eastern), frequency and what to say for every step: briefing/filing, AWOS, clearance, CTAF/ground/tower, departure, expected Center & approach handoffs, Flight Service outlets, arrival weather, approach, tower/CTAF, ground, alternate, lost comms | FAA NASR 28-day data (downloaded and cached in `data/nasr/`) |
| `get_airport_comms`: every published frequency for an airport, AWOS/ASOS phone, tower hours | FAA NASR |
| `find_stops`: fuel / rest stops near the route (public, paved), with 100LL, runway, lights, tower/CTAF, attended at your ETA (FBO and restroom likely), landing fee, and VFR status there at your ETA; suggests a mid-route fuel stop and a rest stop about every hour | FAA NASR airport data |
| `build_briefing_report`: **local HTML report** saved to `data/reports/` and opened in your browser, and published to GitHub Pages if you turn that on (see Output). It has a **takeoff-time slider** (by default ±3 h, hourly, each hour rated green, amber or red), side view, stage-by-stage notes, a point-by-point VFR and icing table, fuel and rest stops, nav log and fuel from the POH, and the comms plan. It also saves its inputs as `report_args.json` | local |
| `refresh_reports`: rebuilds saved upcoming reports in place with the latest weather. The written verdict is kept, and the page shows when it was written | local |
| `list_aircraft`, `save_aircraft`, `save_flight_plan` | local files in `data/` |
**Winds aloft note:** aviationweather.gov discontinued its FD wind/temp tables when NAM was retired (`/api/data/windtemp` now returns an error). Numeric winds therefore come from NOAA's GFS model through Open-Meteo. Claude is told to cross-check them against the GFA winds screenshot.
**Times** are shown in US Eastern (for example "Thu Nov 26, 2:07 PM EST"), with Zulu added where ATC or filing needs it. Times you type without a zone are read as Eastern.
**Reliability:** calls to aviationweather.gov and to the GFS service retry on timeouts, 5xx errors and rate limits. If winds aloft still can't be fetched, the nav log is computed with zero wind and says so.
**VFR:** `route_weather_profile` checks every point for VFR: ceiling above ground, visibility, cloud clearance at your altitude, on top of a layer, under a layer, marginal, or IMC. Comms plans for VFR cover flight following, opening and closing the flight plan, and Class D entry.
**POH performance:** if `data/poh/<AIRCRAFT_ID>.json` exists (digitized POH Section 5 tables) and the aircraft profile has `"poh": "<ID>"`, the nav log uses the POH. It interpolates cruise TAS and fuel flow by altitude, temperature and % power, and takes climb and descent time, fuel and distance from the POH tables. `flightplanner/poh.py` does the lookup. POH data stays local and is gitignored.
**Your aircraft:** start from a typical profile, then ask Claude to save your own numbers (`save_aircraft`). For POH-accurate planning, have Claude digitize your POH's Section 5 performance tables into `data/poh/<ID>.json` (the format is documented in `flightplanner/poh.py`). Your POH is the manufacturer's copyrighted document, so keep it and its digitized tables local; `data/` is gitignored for that reason.
**Aircraft:** `flightplanner/aircraft.json` holds *typical* book numbers for C172S, PA-28-181, SR22, SR22T, BE58, TBM 960, King Air 350 and CJ3. Save your own POH numbers through the chat; they go to `data/my_aircraft.json`.
## Output
Refresh saved reports with new weather from a terminal with `.venv/bin/python -m flightplanner.refresh` (upcoming flights). Use `--all`, or pass folder paths, to choose which reports. In chat, ask "refresh my plans".
**Weather maps tab:** every report has a "Weather maps" tab drawn from NOAA GFS 0.25° grids, downloaded straight from NOMADS. There's no key or daily quota: it's one ~1 MB download per forecast hour, cached in `data/gfs_cache/`.
- **Layers:** flight category (ceiling and visibility), cloud at your altitude, rain/snow with isobars and model-diagnosed fronts, temperature at altitude and at the surface, freezing level, and wind at altitude.
- **Time:** the map follows the takeoff-time slider, and its own valid-time slider moves a ✈ marker along the route. Hover or tap for values.
- **Official fronts:** trips 3–7 days out also get the official WPC surface forecast chart, with forecasters' fronts.
- **Turning it off:** pass `weather_maps: false`.
**Open-Meteo limit:** the free GFS source has a daily request limit. Heavy scanning (many days × times × altitudes) can use it up, and requests then fail with a clear message until midnight UTC. Existing reports are left unchanged.
Everything stays on this computer unless you turn on GitHub Pages publishing.
**Update button and history (GitHub Pages):** published report pages that have saved inputs show **Update with latest weather**. It runs `.github/workflows/refresh.yml` on GitHub Actions, which rebuilds the briefing from its inputs on a `data` branch (keep the repo that holds it private if your inputs include POH data or trips you'd rather not share) and publishes it as a new version. The previous version is kept as `v-<time>.html`, and the page lists every version under "Prepared as of …".
- **With a token:** paste a fine-grained token once (Actions: read and write, this repo only) and one click starts the run. The token is stored in your browser only.
- **Without a token:** the button opens GitHub's Run workflow page.
- **All upcoming flights at once:** `gh workflow run refresh.yml`.
The written verdict and notes are kept as they were; the page header shows when they were written and when the weather data was fetched.
**GitHub Pages (optional):** create `data/publish.json` with `{"github_pages": {"enabled": true, "repo": "owner/name", "branch": "gh-pages"}}`. After that, every new report and every refresh is pushed to that branch, and you can publish by hand with `.venv/bin/python -m flightplanner.publish`. Only the report pages are published, never code, POH data or saved inputs. Pages carry `noindex` tags and the site has a `robots.txt`, but **anyone who has the link can read them**. On a personal account, Pages from a private repo needs GitHub Pro.
- HTML reports: `data/reports/<date>_<title>/index.html`, with an index of all of them at `data/reports/index.html` (also served at http://127.0.0.1:8000/reports/ by the web app)
- Screenshots: `data/shots/` (also shown in the right-hand panel; click to enlarge)
- Saved briefings: `data/plans/*.md` (linked in the UI)
## Configuration
| Env var | Default |
|---|---|
| `ANTHROPIC_API_KEY` | required, unless `ant auth login` was used |
| `FLIGHTPLANNER_MODEL` | `claude-opus-5-5` |
| `FLIGHTPLANNER_EFFORT` | `high` (`low`/`medium` are cheaper and faster) |
| `PORT` | `8000` |
The app calls the Claude Messages API with client-side tools (the agent loop runs in `flightplanner/agent.py`). It turns on server-side refusal fallbacks (`fallbacks: "default"`), so if the main model declines a request the API retries it on a fallback model.
## Layout
```
flightplanner/
server.py FastAPI app + websocket chat
mcp_server.py same tools as an MCP server for Claude Code
agent.py Claude conversation loop, system prompt
tools.py tool schemas + dispatch
awc.py aviationweather.gov Data API client
gfa.py GFA screenshots (Playwright), cross-sections, static charts
winds.py winds/temps aloft at a flight level along the route
navlog.py aircraft profiles, wind triangle, fuel, alternate fuel, regulatory checks, ET timeline
profile.py route weather profile from GFS vertical columns (multi-day)
comms.py communications plan from FAA NASR frequencies
nasr.py FAA NASR download/cache, ARTCC boundaries, sector/approach lookups
report.py local HTML briefing reports + index
timefmt.py US Eastern humanized times
static/index.html chat UI
```
## License
[MIT](LICENSE). Weather and airport data come from NOAA/NWS (aviationweather.gov, NOMADS GFS), the FAA (NASR) and Open-Meteo; check each source's terms for your use.
**Not for operational use without an official briefing.** Forecasts can be wrong, especially more than about three days out. Before every flight, get an official briefing (1800wxbrief.com or 1-800-WX-BRIEF), check NOTAMs and TFRs, and make the go/no-go decision yourself.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues