aemet-mcp
aemet-client monorepo
Tools for working with AEMET OpenData, the public API of Spain's State Meteorological Agency.
Package | Description | npm |
Typed TypeScript SDK + CLI for AEMET OpenData. Used in production at snowy.es. | ||
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. |
Quick links
Just want to use AEMET from code? →
packages/aemet-client/README.mdWant your LLM to answer Spanish weather questions? →
packages/aemet-mcp/README.mdSpanish docs →
packages/aemet-client/README.es.md
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 lintTo work on a single package:
pnpm --filter aemet-client test
pnpm --filter aemet-mcp devThe 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-clientis released by pushing a tagv<x.y.z>oraemet-client-v<x.y.z>. The release workflow checks the tag matchespackages/aemet-client/package.jsonbefore publishing to npm via Trusted Publishing (OIDC, no token).aemet-mcpis released by pushing a tagaemet-mcp-v<x.y.z>using the same Trusted Publishing setup.pnpm publishrewrites theworkspace:^dependency onaemet-clientto a real semver range.
See CONTRIBUTING.md for development guidelines.
License
MIT © Jorge Carrera
Available Tools
8 toolsget_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
Scored across 8 tools
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.
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.
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.
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
Related MCP Connectors
The official Model Context Protocol server for Ambee. It gives any MCP-compatible AI assistant — Claude, ChatGPT, Cursor, VS Code, Ollama, and more direct access to live air quality, pollen, and weather data. To get started, including information on signing up and obtaining your Ambee key, check out the Ambee documentation on https://docs.ambeedata.com
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Real-time planetary signal engine and Model Context Protocol (MCP) server for autonomous AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn 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.95MIT
- AlicenseBqualityBmaintenanceA Model Context Protocol server that enables AI assistants to fetch current weather, forecasts, and search for locations using WeatherAPI service through stdio communication.3MIT
- FlicenseNot gradedqualityDmaintenanceA 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-
- FlicenseAqualityDmaintenanceLightweight MCP server that exposes tools for system information and weather lookup, designed for agent integration via stdio.1-