home / mcp / weather mcp server
Provides real-time weather data, forecasts, air quality, and alerts via MCP endpoints backed by OpenWeatherMap.
Configuration
View docs{
"mcpServers": {
"abhigit-trimble-weather-mcp-server": {
"command": "python",
"args": [
"server.py"
],
"env": {
"OPENWEATHER_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}You can access real-time weather data, forecasts, air quality, and more through a lightweight MCP server backed by the OpenWeatherMap API. This server gives you a standardized way to retrieve consistent weather information for any location, integrate it into AI assistants, and build weather-aware applications.
You connect to the Weather MCP Server using an MCP client of your choice. The server exposes a set of tools you can call to get current weather, forecasts, search for locations, fetch weather by coordinates, and more. Use the tools to power natural language queries like asking for current conditions in a city, getting a 5โday forecast, or comparing weather across multiple locations.
Practical usage patterns include: fetching current weather for a city you specify, obtaining a multi-city forecast for planning trips, looking up coordinates for a location, and checking air quality for wellness decisions. You can also request weather alerts when your app needs to warn users about severe conditions (note: some alert data may require a paid tier).
cd weather-mcp-server
pip install -e .Set your OpenWeatherMap API key as an environment variable. You can either export it in your shell or store it in a .env file.
# Set your API key in the environment
export OPENWEATHER_API_KEY="your_api_key_here"
# Or in a local .env file
echo "OPENWEATHER_API_KEY=your_api_key_here" > .envRun the MCP server with Python. The server uses the provided API key to authenticate requests to OpenWeatherMap.
python server.pyConfiguration and security are straightforward. The API key is kept in the environment and all inputs are validated to protect against invalid requests. The server communicates with OpenWeatherMap over HTTPS to keep data transmissions secure.
API usage is rate-limited by the OpenWeatherMap Free tier (1,000 calls per day, 60 calls per minute). The server caches responses for 10 minutes to reduce unnecessary API requests and help you stay within limits.
If you encounter issues, verify that the OPENWEATHER_API_KEY environment variable is set correctly and that you are using the Free tier as intended. Common problems include missing keys, authentication failures, or hitting rate limits.
The Weather MCP Server exposes a family of tools you can call from your MCP client to retrieve and compare weather information.
You can integrate these tools into your AI workflows to answer weather questions, plan trips, or monitor conditions across multiple locations. The server is designed to be simple to run locally or to connect to from an MCP client in your infrastructure.
Retrieve current weather conditions for a specified location. Parameters include location and optional units; returns current temperature, humidity, description, wind, pressure, visibility, and sunrise/sunset times.
Fetch a 5-day forecast with 3-hour intervals for a given location. Supports units and number of days up to five.
Search for a location by name and return possible matches with coordinates.
Get weather information for a specific latitude/longitude pair, with optional units.
Provide air quality index and pollutant concentrations for a location.
Compare current weather across multiple cities in a single call, with optional units.
Retrieve severe weather alerts for a specified region (availability may depend on paid tier).