Weather-MCP-ClaudeDesktop is an MCP (Model Context Protocol) tool designed specifically for Claude Desktop, providing real-time weather data, weather forecasts, and historical weather information through the OpenWeatherMap API.
Purpose
The tool is designed to enable Claude Desktop users to query weather-related data for any location worldwide through natural language, including real-time weather conditions, future forecasts, historical weather, air quality, weather alerts, and location search.
Main Capabilities
- Real-time weather conditions: Get the current weather for any location.
- Weather forecasts: Provide up to 5 days of weather forecasts.
- Historical weather data: Query historical weather from the past 5 days.
- Air quality information: Get air quality data for a specified location.
- Weather alerts and warnings: Get weather alerts for a specified location.
- Location search functionality: Search for locations by name.
Usage
- Environment requirements: Ensure Python 3.10 or later is installed.
- Install dependencies: Install the dependencies required by the project.
- Obtain an API key: Get an API key from OpenWeatherMap (the free tier is available). Note: New API keys may take up to 24 hours to activate.
- Set environment variables (recommended method):
- Create a .env file in the project directory.
- Add the API key to the file: OPENWEATHER_API_KEY=your_openweathermap_api_key
- Add .env to the .gitignore file to prevent committing sensitive data.
- Update main.py to use environment variables:
- Add the imports at the top: import os and from dotenv import load_dotenv
- Load environment variables: load_dotenv()
- Replace the API_KEY line with: API_KEY = os.getenv("OPENWEATHER_API_KEY")
- Integrate with Claude Desktop: Add the corresponding settings in Claude Desktop's MCP configuration, replacing the path with the full path to the main.py file.
- Run the server: Start the server, and when using Claude Keep the server running during Desktop.
Available tools
- get_current_weather: Get real-time weather conditions for a location.
- get_weather_forecast: Get the weather forecast for a location.
- get_air_quality: Get air quality data for a location.
- get_historical_weather: Get historical weather data for a specific date.
- search_location: Search for a location by name.
- get_weather_alerts: Get weather alerts for a location.
Users can ask Claude Desktop questions such as:
- "What's the weather like in New York right now?"
- "Show the 5-day forecast for London"
- "How is the air quality in Beijing today?"
- "What was the weather like in Paris on March 14?"
- "Search for a location named 'Tokyo'"
- "Are there weather alerts in Miami?"
- "Compare the current weather in Chicago, Miami, and Seattle"
- "Show an air quality comparison for Beijing, Los Angeles, and Delhi"
All tools include appropriate error handling and will return an error message if something goes wrong.
Use cases
Suitable for individual users who need to quickly get global weather information, compare weather, or query historical weather or air quality in Claude Desktop.
Limitations
- Requires Python 3.10 or later.
- Requires an OpenWeatherMap API key; a new key may take up to 24 hours to activate.
- Subject to OpenWeatherMap API rate limits: the free tier allows up to 60 calls per minute, and frequent requests may be throttled.
- Historical weather data is limited to the past 5 days, and forecasts are limited to 5 days.
- The MCP server must remain running to use it.
Troubleshooting
If the MCP server does not work in Claude Desktop:
- Make sure the server is running (you should see output when starting the script).
- Verify that the path in the settings is correct and absolute.
- Make sure Python 3.10+ is in the system PATH.
- Check that all dependencies are installed.
- Try restarting Claude Desktop.
- Check the logs for error messages.
Common API issues:
- API key activation: A new OpenWeatherMap API key may take up to 24 hours to activate.
- Invalid API key error: If you receive a 401 error, verify that the API key is correct and activated.
- Rate limits: The free tier allows up to 60 calls per minute, and heavy use may exceed this.