mcp-open-meteo

AiondaDotCom/mcp-open-meteo

3.2

If you are the rightful owner of mcp-open-meteo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Open-Meteo Weather Server provides comprehensive access to weather data using the Open-Meteo API, offering a range of weather-related information including forecasts, historical data, and air quality.

MCP Open-Meteo Weather Server

A comprehensive Model Context Protocol (MCP) server that provides access to weather data from the Open-Meteo API. This server offers current weather, forecasts, historical data, air quality information, and marine weather conditions.

Features

  • Weather Forecast: Get current weather and forecast data for any location (up to 16 days)
  • Historical Weather: Access historical weather data for any date range
  • Air Quality: Current and forecast air quality data including PM2.5, PM10, and other pollutants
  • Marine Weather: Wave height, direction, and period for coastal and ocean locations
  • Location Search: Search for locations by name to get coordinates
  • Comprehensive Data: Access to 100+ weather variables
  • Multiple Units: Support for different temperature, wind speed, and precipitation units
  • Timezone Support: Automatic or manual timezone specification
  • Free to use (Open-Meteo API doesn't require API keys)

Installation

npm install
npm run build

Usage

With MCP Client

Add this server to your MCP client configuration:

{
  "servers": {
    "open-meteo": {
      "command": "node",
      "args": ["path/to/mcp-open-meteo/dist/cli/stdio.js"]
    }
  }
}

Development

Run in development mode:

npm run dev

Run tests:

npm test

Tools

get-weather-forecast

Get current weather and forecast data for a location.

Parameters:

  • latitude (number, required): Latitude coordinate (-90 to 90)
  • longitude (number, required): Longitude coordinate (-180 to 180)
  • forecast_days (number, optional): Number of forecast days (1-16, default: 7)
  • hourly (string[], optional): Hourly weather variables to include
  • daily (string[], optional): Daily weather variables to include
  • current (string[], optional): Current weather variables to include
  • timezone (string, optional): Timezone (default: auto)
  • temperature_unit (string, optional): celsius|fahrenheit (default: celsius)
  • wind_speed_unit (string, optional): kmh|ms|mph|kn (default: kmh)
  • precipitation_unit (string, optional): mm|inch (default: mm)

Example:

{
  "latitude": 52.52,
  "longitude": 13.41,
  "forecast_days": 3
}

get-historical-weather

Get historical weather data for a specific location and date range.

Parameters:

  • latitude (number, required): Latitude coordinate (-90 to 90)
  • longitude (number, required): Longitude coordinate (-180 to 180)
  • start_date (string, required): Start date in YYYY-MM-DD format
  • end_date (string, required): End date in YYYY-MM-DD format
  • hourly (string[], optional): Hourly weather variables to include
  • daily (string[], optional): Daily weather variables to include
  • timezone (string, optional): Timezone (default: auto)
  • temperature_unit (string, optional): celsius|fahrenheit (default: celsius)
  • wind_speed_unit (string, optional): kmh|ms|mph|kn (default: kmh)
  • precipitation_unit (string, optional): mm|inch (default: mm)

Example:

{
  "latitude": 52.52,
  "longitude": 13.41,
  "start_date": "2024-01-01",
  "end_date": "2024-01-07"
}

get-air-quality

Get current and forecast air quality data for a specific location.

Parameters:

  • latitude (number, required): Latitude coordinate (-90 to 90)
  • longitude (number, required): Longitude coordinate (-180 to 180)
  • forecast_days (number, optional): Number of forecast days (1-5, default: 1)
  • hourly (string[], optional): Air quality variables to include
  • domains (string, optional): Air quality forecast domain (auto|cams_global|cams_europe, default: auto)

Example:

{
  "latitude": 52.52,
  "longitude": 13.41,
  "forecast_days": 2
}

get-marine-weather

Get marine weather conditions for coastal and ocean locations.

Parameters:

  • latitude (number, required): Latitude coordinate (-90 to 90)
  • longitude (number, required): Longitude coordinate (-180 to 180)
  • forecast_days (number, optional): Number of forecast days (1-7, default: 7)
  • hourly (string[], optional): Marine weather variables to include
  • daily (string[], optional): Daily marine weather variables to include

Example:

{
  "latitude": 54.0,
  "longitude": 6.0,
  "forecast_days": 3
}

search-locations

Search for locations by name to get coordinates.

Parameters:

  • name (string, required): Location name to search for
  • count (number, optional): Maximum number of results (1-100, default: 10)
  • language (string, optional): Language for results (default: en)

Example:

{
  "name": "Berlin",
  "count": 5
}

Available Weather Variables

Current Weather

  • temperature_2m: Air temperature at 2 meters
  • relative_humidity_2m: Relative humidity at 2 meters
  • apparent_temperature: Feels-like temperature
  • precipitation: Precipitation amount
  • weather_code: WMO weather interpretation code
  • cloud_cover: Total cloud cover
  • wind_speed_10m: Wind speed at 10 meters
  • wind_direction_10m: Wind direction at 10 meters
  • pressure_msl: Sea level pressure

Hourly Variables

Includes all current weather variables plus:

  • dewpoint_2m: Dew point temperature
  • precipitation_probability: Probability of precipitation
  • rain: Rain amount
  • showers: Shower amount
  • snowfall: Snowfall amount
  • visibility: Visibility distance
  • wind_gusts_10m: Wind gusts
  • And many more...

Daily Variables

  • temperature_2m_max: Maximum daily temperature
  • temperature_2m_min: Minimum daily temperature
  • precipitation_sum: Total daily precipitation
  • wind_speed_10m_max: Maximum daily wind speed
  • sunrise: Sunrise time
  • sunset: Sunset time
  • uv_index_max: Maximum UV index
  • And more...

Examples

Get Weather for Berlin

{
  "tool": "get-weather-forecast",
  "parameters": {
    "latitude": 52.52,
    "longitude": 13.41,
    "forecast_days": 5,
    "current": ["temperature_2m", "weather_code", "wind_speed_10m"],
    "daily": ["temperature_2m_max", "temperature_2m_min", "precipitation_sum"]
  }
}

Search for London

{
  "tool": "search-locations",
  "parameters": {
    "name": "London",
    "count": 3
  }
}

Data Sources

This server uses the Open-Meteo API, which provides:

  • Global weather forecasts up to 16 days
  • Historical weather data from 1940
  • High-resolution data from multiple weather models
  • No API key required
  • Free for non-commercial use

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Development

Project Structure

src/
ā”œā”€ā”€ server/
│   ā”œā”€ā”€ tools/          # MCP tools implementation
│   ā”œā”€ā”€ types/          # TypeScript type definitions
│   ā”œā”€ā”€ utils/          # Utility functions
│   └── config/         # Configuration constants
ā”œā”€ā”€ cli/
│   └── stdio.ts        # CLI entry point
tests/                  # Test files
docs/                   # Documentation

Adding New Tools

  1. Create a new tool file in src/server/tools/
  2. Export the tool from src/server/tools/index.ts
  3. Register the tool in src/server/index.ts
  4. Add tests in tests/unit/tools/

Running Tests

npm test                # Run all tests
npm run test:watch      # Run tests in watch mode
npm run test:coverage   # Run tests with coverage