open-meteo-mcp

VincentSidot/open-meteo-mcp

3.1

If you are the rightful owner of open-meteo-mcp 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.

A Rust implementation of a Model Context Protocol (MCP) server that provides weather data from the Open-Meteo API.

Tools
7
Resources
0
Prompts
0

Open-Meteo MCP Server

A Rust implementation of a Model Context Protocol (MCP) server that provides weather data from the Open-Meteo API.

Overview

This MCP server exposes weather data tools that can be used by AI assistants like Claude Desktop. It provides access to current weather conditions, hourly forecasts, and geocoding services for any location on Earth.

Architecture

This project follows a modular Rust architecture:

  • src/main.rs - Entry point
  • src/server/ - Server implementation
  • src/api/ - API clients (Open-Meteo)
  • src/tools/ - Tool parameter definitions
  • src/models/ - Data models for API responses

Features

  • Current Weather: Get current weather conditions for a specific location
  • Hourly Forecast: Get hourly weather forecasts for up to 168 hours (7 days)
  • Daily Forecast: Get daily weather forecasts for up to 14 days
  • Air Quality: Get air quality data for a specific location
  • Weather History: Get historical weather data for a specific date range
  • Geocoding: Convert city names to GPS coordinates with country code filtering
  • Current Time: Get current system time to help understand time references like "tomorrow"
  • STDIO Transport: Compatible with Claude Desktop and other MCP clients
  • Structured Data: Returns weather data in both text and structured JSON formats

Tools

get_current_weather

Get current weather conditions for a specific location.

Parameters:

  • latitude (number, required): Latitude in decimal degrees
  • longitude (number, required): Longitude in decimal degrees

Example:

{
  "latitude": 40.7128,
  "longitude": -74.0060
}

get_hourly_forecast

Get hourly weather forecast for a specific location.

Parameters:

  • latitude (number, required): Latitude in decimal degrees
  • longitude (number, required): Longitude in decimal degrees
  • hours (integer, optional): Number of hours to forecast (default: 24, min: 1, max: 168)

Example:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "hours": 48
}

geocode_city

Convert a city name to GPS coordinates.

Parameters:

  • city (string, required): Name of the city to geocode
  • count (integer, optional): Number of results to return (default: 1, min: 1, max: 10)
  • country_code (string, optional): ISO-3166-1 alpha2 country code to filter results (e.g. "US" for United States, "DE" for Germany)

Example:

{
  "city": "New York",
  "count": 3
}

With country code filtering:

{
  "city": "Berlin",
  "country_code": "US"
}

get_current_time

Get current system time and date to help understand time references like "tomorrow".

Parameters:

  • utc (boolean, optional): If true, returns time in UTC instead of local time (default: false)

Example:

{
  "utc": true
}

get_daily_forecast

Get daily weather forecast for a specific location.

Parameters:

  • latitude (number, required): Latitude in decimal degrees
  • longitude (number, required): Longitude in decimal degrees
  • days (integer, optional): Number of days to forecast (default: 7, min: 1, max: 14)

Example:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "days": 7
}

get_air_quality

Get air quality data for a specific location.

Parameters:

  • latitude (number, required): Latitude in decimal degrees
  • longitude (number, required): Longitude in decimal degrees
  • hours (integer, optional): Number of hours of air quality data (default: 24, min: 1, max: 168)

Example:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "hours": 48
}

get_weather_history

Get historical weather data for a specific date range.

Parameters:

  • latitude (number, required): Latitude in decimal degrees
  • longitude (number, required): Longitude in decimal degrees
  • start_date (string, required): Start date in YYYY-MM-DD format
  • end_date (string, required): End date in YYYY-MM-DD format

Example:

{
  "latitude": 40.7128,
  "longitude": -74.0060,
  "start_date": "2023-01-01",
  "end_date": "2023-01-07"
}

Installation

  1. Clone this repository:

    git clone https://github.com/your-username/open-meteo-mcp.git
    cd open-meteo-mcp
    
  2. Build the project:

    cargo build --release
    
  3. Run the server:

    cargo run --release
    

Usage

The server communicates over STDIO, making it compatible with Claude Desktop and other MCP clients. When integrated with an MCP-compatible client, you can ask for weather information using natural language.

Example prompts:

  • "What's the current weather in New York City?"
  • "Give me a 48-hour weather forecast for London."
  • "What's the 7-day weather forecast for Tokyo?"
  • "What's the air quality like in Los Angeles today?"
  • "What was the weather like in Paris last week?"
  • "What are the GPS coordinates for Paris?"
  • "Find Berlin in the United States."
  • "What time is it? I need to know if it's tomorrow yet."
  • "I have to be at work by 9 a.m., and my commute takes 30 minutes. What is the best time to leave home in order to avoid rain?"

API Source

This server uses the Open-Meteo API, which provides free access to weather data and geocoding services without requiring an API key for non-commercial use.

License

This project is licensed under the MIT License - see the LICENSE file for details.