Overview
What is MCP Weather Server?
A FastAPI-based weather server that integrates with Home Assistant using the Model Context Protocol (MCP). It uses OpenWeatherMap’s One Call API 3.0 to provide comprehensive weather information including current conditions, daily forecasts (up to 7 days), and hourly forecasts (up to 48 hours) for any location.
How to use MCP Weather Server?
Install Python 3.7+, obtain an OpenWeatherMap API key with One Call API 3.0 access, clone the repository, install dependencies (pip install -r requirements.txt), configure the API key via environment variable (OPENWEATHER_API_KEY) or config.yaml, optionally set units and location overrides, then run python server.py. The server exposes a legacy REST API at /api/... and an MCP SSE endpoint at /mcp/sse with tools current_weather, hourly_forecast, and daily_forecast.
Key features of MCP Weather Server
- MCP integration with Home Assistant via SSE transport
- Legacy REST API for current, daily, and hourly forecasts
- Configurable metric or imperial units (temperature, wind speed)
- Location resolution with city, “City, State” (US), and full “City, State, Country” formats
- Optional location overrides in
config.yamlfor ambiguous city names
Use cases of MCP Weather Server
- Retrieve current weather and forecasts for Home Assistant automations and dashboards
- Drive smart home decisions (e.g., adjust blinds, climate systems) based on daily or hourly weather data
- Provide weather context to AI agents via the Model Context Protocol
- Serve weather data over HTTP for other applications or integrations
FAQ from MCP Weather Server
What API key is required?
An OpenWeatherMap API key with access to the One Call API 3.0 is required. It can be set via the OPENWEATHER_API_KEY environment variable or in config.yaml under settings.api_key.
How do I switch between metric and imperial units?
Set units to "metric" (default) or "imperial" in config.yaml under settings. Metric uses Celsius and m/s; imperial uses Fahrenheit and mph.
How does the server resolve location names?
It checks overrides first, then resolves city names directly, “City, State” as US locations, and full “City, State, Country” as given. Examples: “London” → London, England, GB; “Portland, OR” → Portland, Oregon, US.
What are the forecast limits?
Daily forecasts are available for up to 7 days; hourly forecasts for up to 48 hours. These limits are enforced by the MCP tool parameters and REST API query string.
What transport and authentication are used?
The MCP endpoint uses Server-Sent Events (SSE) at /mcp/sse. No authentication is described for the server itself; API key is used solely to authenticate with OpenWeatherMap.