Skip to main content
Glama

aemet-mcp

MCP server that exposes public weather data from AEMET (Agencia Estatal de Meteorología, Spain) to AI agents and MCP-compatible clients.

Three tools, well-typed, backed by AEMET's official OpenData API:

  • get_municipality_forecast — daily forecast (up to 7 days) for a Spanish municipality, by INE code.

  • get_station_observation — last ~12h of hourly observation data (temperature, wind, precipitation…) from a weather station.

  • get_weather_warnings — active weather warnings (CAP alerts) for a region or all of Spain.

Prerequisites

Related MCP server: Weather MCP Server

Installation

No install needed — run it directly with npx:

npx -y @mmillan76/aemet-mcp

The server communicates over stdio, so it's meant to be launched by an MCP client rather than run standalone in a terminal.

Configuration

The server reads the API key from the AEMET_API_KEY environment variable. It exits with an error at startup if it's missing.

Claude Desktop / Claude Code

Add to your MCP client config (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "aemet": {
      "command": "npx",
      "args": ["-y", "@mmillan76/aemet-mcp"],
      "env": {
        "AEMET_API_KEY": "your-api-key-here"
      }
    }
  }
}

Any other MCP client that supports stdio servers works the same way — point it at npx -y @mmillan76/aemet-mcp with AEMET_API_KEY set in the environment.

Local development

git clone https://github.com/mmillan76/aemet-mcp.git
cd aemet-mcp
npm install
cp .env.example .env   # fill in AEMET_API_KEY
npm run build

Test tool calls interactively with the MCP Inspector:

npx @modelcontextprotocol/inspector node dist/index.js

(the Inspector reads AEMET_API_KEY from your shell environment, so export it — or source .env — before running the command above)

Notes on the AEMET API

AEMET OpenData uses a two-step pattern on every endpoint: the first request returns a JSON envelope with a datos URL, not the actual data; a second request to that URL returns the real payload. This server hides that detail — tools just return the final data. Rate limits apply per API key; if you hit them, the tool returns a clear error instead of retrying silently.

License

MIT — see LICENSE.

Available Tools

3 tools
get_municipality_forecastGet municipality forecastA

Get the daily weather forecast (up to 7 days) for a Spanish municipality from AEMET (Spanish State Meteorological Agency), identified by its INE code.

ParametersJSON Schema
NameRequiredDescriptionDefault
municipioCodeYesINE municipality code (5 digits), e.g. 28079 for Madrid. Look it up at https://www.ine.es/daco/daco42/codmun/codmunmapa.htm

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description takes on the burden of conveying safety and behavior. It clearly indicates a read-only operation ('Get') and discloses the forecast window (up to 7 days) and data source (AEMET). It does not mention potential limitations like response format or external dependencies, but for a simple read tool this is adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that covers the essential aspects without fluff. Every phrase adds value: action, resource, scope, source, and identifier.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity—one well-documented parameter and a clear read operation—the description is nearly complete. It covers the return type (daily forecast), time window, and data source. It lacks explicit differentiation from siblings, but the sibling names in the context signal provide that information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents the sole parameter with 100% coverage, including format (5 digits), an example (28079 for Madrid), and a lookup URL. The description only adds 'INE code' which is redundant with the schema, providing no additional semantic meaning beyond the structured data.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the verb ('Get'), the resource ('daily weather forecast'), and the scope ('Spanish municipality from AEMET', 'up to 7 days'). It differentiates itself from sibling tools (station observation, weather warnings) by focusing on forecast for a municipality by INE code.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for municipality weather forecasts and mentions the 7-day limit, but it does not explicitly state when to use this tool versus get_station_observation or get_weather_warnings. No exclusions or alternative instructions are provided, leaving the choice to the agent based solely on tool names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_station_observationGet station observationA

Get the last ~12 hours of hourly conventional observation data (temperature, wind, precipitation, etc.) for a specific AEMET automatic weather station.

ParametersJSON Schema
NameRequiredDescriptionDefault
idemaYesAEMET automatic weather station indicator (idema), e.g. 3195 for Madrid-Retiro. Find station codes in the AEMET station catalogue.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description provides some behavioral context by disclosing the time window (~12 hours) and data types (temperature, wind, etc.). It does not mention potential error responses, data availability limitations, or return format details, which would increase transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured sentence that front-loads the verb and resource, then adds specific detail. It is concise and every word adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity (one parameter, no output schema), the description is largely complete: it explains what data is returned and for which time period. It could be enhanced by stating that the result is a list of hourly observations, but this is implied by 'hourly... data.'

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a clear description of the idema parameter including example. The description adds no extra parameter semantics beyond what the schema already provides, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Get' and identifies the resource clearly: hourly conventional observation data for a specific AEMET station. It distinguishes this tool from siblings (forecast, warnings) by focusing on observed data over a defined time window.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly indicates that this is for past observation data (last ~12 hours) for a specific station, which implicitly differentiates it from forecast and warning tools. However, it does not explicitly mention when not to use it or name alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_weather_warningsGet weather warningsA

Get the latest active weather warnings (CAP alerts) issued by AEMET for a Spanish region or the whole country: severity level, phenomenon, affected zone and validity.

ParametersJSON Schema
NameRequiredDescriptionDefault
areaYesAEMET area code: 'esp' for all of Spain, or a 2-digit CCAA code (e.g. 61 for Andalucía). Warnings are returned as CAP (Common Alerting Protocol) alerts converted to JSON.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so description carries full burden. It discloses that warnings are latest and active, and includes AEMET issuance, but does not explicitly state read-only nature, pagination, or behavior when no warnings exist. For a simple 'get' operation, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence that is front-loaded with the core action and resource, and includes useful details without digression. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Tool has one parameter, no annotations, no output schema, but the description plus schema describe input and output adequately (CAP alerts converted to JSON is in schema). It could mention output format in description, but overall it is sufficiently complete for a simple lookup tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with detailed description of the 'area' parameter including pattern and example. The main description's note about 'Spanish region or the whole country' adds a tiny bit of context but does not go beyond schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States verb 'Get' + resource 'latest active weather warnings (CAP alerts) issued by AEMET for a Spanish region or the whole country', and lists content fields (severity, phenomenon, affected zone, validity). Clearly distinguishes from sibling tools focused on forecasts and observations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context: use for active warnings for a Spanish region or the whole country. Does not explicitly mention alternatives or exclusions, but the scope is well-defined and siblings differ in purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 3 tool updatesv0.1.1
    • First observedget_municipality_forecast
    • First observedget_station_observation
    • First observedget_weather_warnings

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a clearly distinct data type: forecasts for municipalities, observations from stations, and weather warnings. No overlap in purpose or resource.

Naming Consistency5/5

All tool names follow the identical pattern 'get_' followed by a specific data type (municipality_forecast, station_observation, weather_warnings). This is consistent and predictable.

Tool Count5/5

Three tools is well-scoped for a weather data server, covering the core data types without unnecessary bloat. Each tool has a clear and distinct purpose.

Completeness4/5

The tool set covers the primary weather data types (forecast, observation, warnings) for the AEMET domain. Minor gaps might include historical data or air quality, but the core surface is complete for typical use.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers