Skip to main content
Glama

Open Weather Stations

CI license deps

A zero-dependency directory of publicly licensed weather & METAR stations with a typed JS API, CLI, REST/OpenAPI server, MCP server for AI agents, and a Python client. Station metadata ships offline; live observations come straight from official public feeds and always fall back gracefully to a bundled sample.

Explorer: https://shadojus.github.io/open-weather-stations/ (interactive world map, wind compass, live METAR).

  • Zero runtime dependencies – Node ≥ 22.5 (node:sqlite, node:http, node:test), Python ≥ 3.9 stdlib only.

  • Offline-first – a curated catalog (data/seed.json, ~130 stations) is bundled; build an indexed SQLite DB on demand.

  • Honest sourcing – every source carries license + attribution (data/SOURCES.json); live fetches are HTTPS-only against a strict host allowlist.

  • Four surfaces – library, CLI, HTTP/OpenAPI 3.1, MCP (stdio).

Quick start

npx @shadojus/open-weather-stations near 48.35 11.79 --radius 50
npx @shadojus/open-weather-stations station EDDM --live
npx @shadojus/open-weather-stations search munich --json
npx @shadojus/open-weather-stations sources
npx @shadojus/open-weather-stations serve --port 8787

CLI

Command

Description

near <lat> <lng> [--radius km] [--limit n] [--country CC] [--network id]

Nearest stations first, with distanceKm

station <id>

Metadata + latest observation (id, ICAO or WMO)

search [query…] [--country CC] [--network id] [--limit n]

Ranked text search

sources

Upstream sources, licenses, attribution

serve [--port 8787] [--host 127.0.0.1] [--trust-proxy]

Start the REST server

--mcp

Start the MCP server on stdio

Global flags: --json (machine output), --live (query upstream; falls back to sample), --db <file> (SQLite backend), -h, -v. Exit codes: 0 ok, 1 not found / runtime error, 2 usage error.

Library

import { createWeatherStations, stationsNear, getLatestObservation } from "@shadojus/open-weather-stations";

const near = stationsNear(48.35, 11.79, { radiusKm: 50 });          // [{ stationId: "EDDM", distanceKm: 0.51, … }]
const obs  = await getLatestObservation("EDDM", { live: true });    // { isLive: true, … } or { fallback: true, … }

const ws = createWeatherStations({ dbPath: "data/stations.sqlite" }); // optional SQLite backend

Types are included (src/index.d.ts). Parsers (parseMetarText, parseMetarObservation, parseDwdPoiCsv) are exported too.

REST server

npx @shadojus/open-weather-stations serve
curl 'http://localhost:8787/v1/stations/near?lat=48.35&lng=11.79&radiusKm=50'

Route

Description

GET /health

Liveness + backend + station count

GET /openapi.json

OpenAPI 3.1.0 document

GET /v1/sources

Sources, licenses, attribution

GET /v1/stations?q=&country=&network=&limit=

Search

GET /v1/stations/near?lat=&lng=&radiusKm=&limit=&country=&network=

Proximity

GET /v1/stations/:id

Station by id / ICAO / WMO

GET /v1/stations/:id/latest[?live=1]

Latest observation (sample, or live with fallback)

Behaviour: CORS *, SHA-256 ETag with conditional 304, Cache-Control: public, max-age=60 (live responses no-store), per-client rate limiting (default 120 req/min; IPv6 clients share a budget per /64) with 429 + Retry-After, errors as { "error": { "code", "message" } }. Binds to 127.0.0.1 by default; use --host 0.0.0.0 (and --trust-proxy behind a reverse proxy) to expose it.

MCP (AI agents)

{
  "mcpServers": {
    "weather-stations": { "command": "npx", "args": ["-y", "@shadojus/open-weather-stations", "--mcp"] }
  }
}

JSON-RPC 2.0 over stdio (protocolVersion: "2024-11-05"). Tools: search_stations, stations_near, get_station, latest_observation, list_sources.

Python

pip install shadojus-weather-stations   # stdlib only, Python >= 3.9
from shadojus_weather_stations import WeatherStations
ws = WeatherStations()
ws.near(48.35, 11.79, radius_km=50)
ws.latest("EDDM", live=True)

CLI: shadojus-weather-stations near 48.35 11.79 --json. See python/.

Related MCP server: weather_mcp

Data sources & licensing

Source

Coverage

License

Live

NOAA/NWS Aviation Weather Center (METAR)

Global

Public domain

yes

Deutscher Wetterdienst (DWD) Open Data

DE

CC BY 4.0

yes

NOAA NCEI GHCNh / ISD

Global

Public domain

catalog only

GeoSphere Austria TAWES

AT

CC BY 4.0

yes

MET Norway

NO

CC BY 4.0

yes

MeteoSwiss SwissMetNet

CH

CC BY 4.0

catalog only

When you redistribute observations from CC BY sources, keep the attribution string from GET /v1/sources. Live requests identify themselves with a descriptive User-Agent; please be a good citizen and cache (the server already does).

The code is MIT licensed (see LICENSE); the data keeps its original licenses above.

Building the SQLite database

npm run build:data                     # data/seed.json -> data/stations.sqlite (+ SHA-256 manifest)
node tools/build-data.mjs --dry-run    # validate only
node tools/build-data.mjs --refresh-live   # refresh sample observations from aviationweather.gov

When data/stations.sqlite exists it is picked up automatically.

Development

npm test                                          # node --test (53 tests: core, parsers, SQLite, HTTP, CLI, MCP)
python -m unittest discover -s python/tests       # Python client

No install step is needed – there is nothing to install.

Security notes

  • Outbound requests are HTTPS-only and restricted to the allowlisted hosts in src/sources/http.mjs, with timeouts.

  • Station ids are validated ([A-Za-z0-9._:-]{1,64}); query parameters are range-checked; the server is read-only.

  • The Explorer escapes all data before rendering and loads no third-party scripts, fonts or CDNs.

Contributing

Add stations to data/seed.json (verified coordinates, official id, source network, license) and mirror to docs/stations.json; npm test checks catalog consistency.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides real-time weather data by exposing a get_current_weather tool via MCP, using the Open-Meteo API over stdio JSON-RPC.
      1
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to retrieve current weather conditions and 3-day forecasts for cities through standardized MCP tools over stdio.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Provides Open-Meteo weather tools that return both structured forecast data for the model and a weather card (image link or text) for the user, plus geocoding of place names to coordinates. Requires no API key and works over stdio or streamable HTTP.
      2
      Mozilla Public 2.0