Weather MCP Server
A free, production-ready Model Context Protocol (MCP) server for accessing weather data using the OpenWeatherMap API.
๐ค๏ธ Overview
This MCP server provides comprehensive weather information through a standardized interface, enabling AI assistants to access real-time weather data, forecasts, air quality information, and more.
โจ Features
๐ ๏ธ Tools (7 Available)
get_current_weather - Get current weather for any location
get_forecast - Get 5-day weather forecast with 3-hour intervals
search_location - Search for locations and get coordinates
get_weather_by_coordinates - Get weather by latitude/longitude
get_air_quality - Get air quality index and pollutant data
compare_weather - Compare weather across multiple cities
get_weather_alerts - Get severe weather alerts (note: requires paid tier)
๐ Resources (4 Available)
weather://current- Current weather dataweather://forecast- Weather forecastsweather://alerts- Weather alerts and warningsweather://history- Historical weather data
๐ Quick Start
Prerequisites
Free API Key from OpenWeatherMap:
Sign up at https://openweathermap.org/api
Go to API keys section
Copy your API key (free tier includes 1000 calls/day)
Python 3.10+
Installation
Configuration
Run the Server
๐ก Usage Examples
With Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
Then ask Claude:
"What's the weather in Paris?"
"Compare weather between New York, London, and Tokyo"
"Give me a 5-day forecast for Seattle"
"What's the air quality in Beijing?"
With Cursor IDE
Create .cursor/config.json:
Programmatic Usage
๐ง Tool Details
get_current_weather
Get current weather conditions for a location.
Parameters:
location(required): City name, e.g., "London,UK", "New York,NY,US"units(optional): "metric" (Celsius), "imperial" (Fahrenheit), or "standard" (Kelvin)
Returns:
get_forecast
Get 5-day weather forecast with 3-hour intervals.
Parameters:
location(required): City nameunits(optional): Temperature unitsdays(optional): Number of days (1-5, default 5)
Returns:
search_location
Search for a location and get its coordinates.
Parameters:
query(required): Location name to searchlimit(optional): Max results (default 5)
Returns:
get_weather_by_coordinates
Get weather for specific coordinates.
Parameters:
latitude(required): Latitudelongitude(required): Longitudeunits(optional): Temperature units
get_air_quality
Get air quality index and pollutant levels.
Parameters:
latitude(required): Latitudelongitude(required): Longitude
Returns:
compare_weather
Compare current weather across multiple cities.
Parameters:
locations(required): Array of city names (2-5 cities)units(optional): Temperature units
Returns: Comparison of weather data for all locations.
๐ API Limits
Free Tier (OpenWeatherMap)
Calls per day: 1,000
Calls per minute: 60
Features included:
Current weather
5-day forecast
Geocoding
Air pollution data
Caching
The server automatically caches responses for 10 minutes to reduce API calls.
๐ Supported Units
metric: Temperature in Celsius, wind speed in m/s
imperial: Temperature in Fahrenheit, wind speed in mph
standard: Temperature in Kelvin, wind speed in m/s
๐ Security
API key stored in environment variable (never in code)
HTTPS-only communication with OpenWeatherMap
Input validation for all parameters
Rate limiting awareness
๐ Troubleshooting
"API key not configured" error
"401 Unauthorized" error
Verify your API key is correct
Check if API key is activated (can take a few hours after signup)
Ensure you're using the free tier correctly
Rate limit errors
The free tier allows 60 calls/minute and 1000/day. The server caches responses for 10 minutes to help avoid limits.
๐ Resources
OpenWeatherMap API Docs: https://openweathermap.org/api
Free API Signup: https://openweathermap.org/price
MCP Specification: https://modelcontextprotocol.io
OpenWeatherMap Weather Codes: https://openweathermap.org/weather-conditions
๐งช Testing
๐ฏ Example Queries
Ask your AI assistant:
Current Weather:
"What's the weather like in Tokyo?"
"Is it raining in Seattle right now?"
"What's the temperature in Miami?"
Forecasts:
"Give me a 3-day forecast for Paris"
"Will it rain in London this week?"
"What's the weather going to be like tomorrow in NYC?"
Comparisons:
"Compare the weather in Sydney, London, and New York"
"Which is warmer: Dubai or Bangkok?"
Air Quality:
"What's the air quality in Delhi?"
"Is the air quality good in Los Angeles?"
Location Search:
"Find all cities named Portland"
"Search for Springfield locations"
๐ป Development
Project Structure
Adding Custom Tools
๐ License
MIT License - Free to use, modify, and distribute
๐ค Contributing
Contributions welcome! Please:
Fork the repository
Create a feature branch
Add tests
Submit a pull request
โญ Features Coming Soon
Historical weather data
Weather maps
UV index information
Marine weather data
Agricultural weather data
๐ Support
Issues: GitHub Issues
OpenWeatherMap Support: https://openweathermap.org/faq
MCP Community: https://modelcontextprotocol.io
Built with โค๏ธ using OpenWeatherMap Free API
Get started in 5 minutes with free weather data for your AI!