Skip to main content
Glama

aemet-client monorepo

Tools for working with AEMET OpenData, the public API of Spain's State Meteorological Agency.

Package

Description

npm

aemet-client

Typed TypeScript SDK + CLI for AEMET OpenData. Used in production at snowy.es.

npm version

aemet-mcp

Model Context Protocol server: plug AEMET into Claude Desktop, Cursor, Windsurf or any MCP client. Forecasts, warnings, live observations, climate history and beach forecasts. Runs locally over stdio.

npm version

Related MCP server: Weather MCP Server

Develop

Requires Node.js ≥ 20.18 and pnpm ≥ 10.

pnpm install
pnpm -r build
pnpm -r test
pnpm -r typecheck
pnpm lint

To work on a single package:

pnpm --filter aemet-client test
pnpm --filter aemet-mcp dev

The E2E suite (pnpm --filter aemet-client test:e2e) hits the real AEMET API and is skipped unless AEMET_API_KEY is set. CI runs it behind a repository secret.

Release

  • aemet-client is released by pushing a tag v<x.y.z> or aemet-client-v<x.y.z>. The release workflow checks the tag matches packages/aemet-client/package.json before publishing to npm via Trusted Publishing (OIDC, no token).

  • aemet-mcp is released by pushing a tag aemet-mcp-v<x.y.z> using the same Trusted Publishing setup. pnpm publish rewrites the workspace:^ dependency on aemet-client to a real semver range.

See CONTRIBUTING.md for development guidelines.

License

MIT © Jorge Carrera

Available Tools

8 tools
get_air_qualityBackground air pollution at an AEMET EMEP/VAG rural stationA

Returns the latest reading of AEMET's background pollution network (EMEP/VAG/CAMP): 13 rural reference stations that measure the regional baseline of O3, NO, NO2, SO2 and PM10, plus temperature, humidity, pressure, wind, radiation and precipitation. This is BACKGROUND pollution, measured far from towns and roads on purpose. It does NOT answer 'how is the air in Madrid/Barcelona today': urban air quality is measured by the city and regional networks, not by AEMET, and this tool must not be used as a proxy for it.

Inputs: station, location.

get_beach_forecastBeach forecast for a Spanish beachA

Returns the AEMET beach forecast for the next three days: sky, wind and waves for morning and afternoon, plus maximum temperature, water temperature, thermal sensation and maximum UV index. Covers the 591 beaches AEMET forecasts during the bathing season. Accepts a beach name (accents optional), optionally narrowed by municipality, or the 7-digit AEMET beach code.

Inputs: location (required), days, municipality.

get_climate_historyHistorical climate records from the nearest AEMET climatological stationA

Finds the AEMET climatological station closest to the requested location and returns its measured history. mode='range' returns daily records (temperature, precipitation, wind, humidity, sunshine) between two dates; AEMET serves at most 6 months (186 days) per call, so longer histories need several calls. Ranges longer than 31 days are condensed into one line per month (mean max/min, total precipitation, rainy days, extremes) instead of one line per day. mode='normals' returns the station's long-term monthly averages. Use this for past weather and climate questions, not for forecasts.

Inputs: location (required), to, from, mode.

get_forecastWeather forecast for a Spanish municipalityA

Returns the AEMET forecast for any of Spain's 8000+ municipalities. Accepts a name (with or without accents) or INE code. Daily granularity returns temperature min/max, sky state, precipitation probability and wind for each day. Hourly returns the next ~40h.

Inputs: location (required), days, granularity.

get_maritime_forecastMaritime forecast for Spanish coastal waters and high seasA

Returns the AEMET maritime bulletin for a sea area: sea state, wind, visibility, warnings and the validity period. Two products are covered: coastal waters (8 bulletins, one per stretch of the Spanish coast, each split into per-province zones and carrying the marine warnings) and high seas (3 bulletins covering the Atlantic north of 30N, the Atlantic south of 35N and the Mediterranean). Areas can be named the way people and the media name them, or given as AEMET codes.

Inputs: area (required), product.

get_mountain_forecastMountain bulletin for a Spanish mountain areaA

Returns the AEMET mountain bulletin for one of Spain's nine mountain areas (Picos de Europa, the three Pyrenean areas, the two Iberian System areas, Guadarrama and Somosierra, Sierra de Gredos, Sierra Nevada). Written for mountaineers and skiers: sky state, precipitation, storms, temperature and wind as forecaster prose, plus the freezing and -10 °C levels, free-atmosphere winds at 1500 and 3000 m, and minimum and maximum temperatures with thermal sensation at named refuges, passes and resorts. mode='forecast' covers today (day 0) to day 3; mode='past' summarises the last 24 hours. These bulletins are year-round and cover the mountain range as a whole, so use them instead of get_forecast for anything above the valley floor.

Inputs: area (required), day, mode.

get_nearest_observationLatest real-time observation from the nearest AEMET weather stationA

Finds the AEMET weather station closest to the requested location and returns its most recent reading (temperature, humidity, wind, precipitation, pressure). Useful for 'what's the weather right now' style questions.

Inputs: location (required).

get_warningsActive CAP weather warnings for a Spanish regionA

Returns the most recent CAP (Common Alerting Protocol) weather warnings issued by AEMET for the given autonomous community, or for the whole country ('esp'). Severity follows the CAP standard: Minor, Moderate, Severe, Extreme.

Inputs: area (required), language, minSeverity.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool maps to a distinct AEMET data product, from observations and municipal forecasts to warnings, climate history, and air quality. The only potential overlap is among the specialized forecast tools (beach, mountain, maritime) and the general get_forecast, but the descriptions clearly specify when to use each.

    Naming Consistency5/5

    All tools follow the same get_<noun> snake_case pattern, making the set highly predictable. There are no mixed conventions, vague verbs, or irregular casing.

    Tool Count5/5

    Eight tools is well-scoped for a national weather service server. Each tool represents a meaningful, non-redundant dataset and the count is neither bloated nor too thin.

    Completeness4/5

    The server covers the major AEMET public-facing products: current observations, forecasts, warnings, climate history, specialized forecasts, and air quality. Minor gaps such as radar/satellite imagery or more granular station metadata exist, but agents can still answer a wide range of weather and climate questions.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that allows retrieving meteorological and climate data from Spain's State Meteorological Agency (AEMET) API directly from Claude AI and other MCP-compatible clients.
      9
      5
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server built with the mcp-framework to provide weather-related tools and data to AI clients. It enables integration of weather capabilities and custom tools into the MCP ecosystem for use with platforms like Claude Desktop.
      9 npm
      -
    • F
      license
      A
      quality
      D
      maintenance
      Lightweight MCP server that exposes tools for system information and weather lookup, designed for agent integration via stdio.
      1
      -