Weather MCP Server ๐ค๏ธ
A Model Context Protocol (MCP) server that provides weather information tools. This server enables AI assistants like Claude to fetch real-time weather data, forecasts, and compare weather across different cities.
Features
Current Weather: Get real-time weather information for any city
Weather Forecast: Get weather predictions for up to 10 days (based on API plan)
Weather Comparison: Compare weather conditions between two cities
Supports both Celsius (metric) and Fahrenheit (imperial) units
Prerequisites
Python 3.8 or higher
WeatherAPI.com API key (free tier available)
Installation
Clone the repository
git clone https://github.com/Abhishek3689/Weather_MCP_Server.git cd weather-mcp-serverInstall dependencies
pip install -r requirements.txtSet up environment variables
Create a
.envfile in the project root:WEATHER_API_KEY=your_api_key_hereGet your free API key from WeatherAPI.com
Usage
๐ Running The Server (Important!) ๐ If you double-click or run the file, you will NOT see results.
MCP servers do not show output directly.
They wait for Claude to connect to them.
But you can still start the server manually to ensure itโs working:
You would see somthing like this it means server is running correclty
Integration with Claude Desktop
To use this server with Claude Desktop, add the following to your Claude Desktop configuration:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json
Note : for 'command' write absolute location instead of only "python" by checking using in command prompt
you will see somthing like this
After updating the config, restart Claude Desktop.
Available Tools
1. Get Current Weather
city: City name (e.g., 'London', 'New York', 'Tokyo')
units: 'metric' for Celsius or 'imperial' for Fahrenheit
Example:
2. Get Weather Forecast
city: City name
days: Number of forecast days (1-10)
units: Temperature units
Example:
3. Compare Weather
city1: First city name
city2: Second city name
units: Temperature units
Example:
Project Structure
API Information
This project uses the WeatherAPI.com service:
Free tier: 1,000,000 calls/month
3-day forecast on free plan
Real-time weather data
Historical weather data
Example Output
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Troubleshooting
"WEATHER_API_KEY environment variable not set"
Make sure you've created a
.envfile with your API keyOr set the environment variable in your system/Claude config
"HTTP Error: 401"
Check that your API key is valid
Ensure the API key is correctly set in your
.envfile
"Only X days available"
Free tier of WeatherAPI.com provides 3-day forecasts
Upgrade to a paid plan for extended forecasts
Support
If you encounter any issues or have questions:
Open an issue on GitHub
Check the WeatherAPI.com documentation
Review the MCP documentation
Author
Project Link: https://github.com/Abhishek3689/Weather_MCP_Server
Acknowledgments
FastMCP - Framework for building MCP servers
WeatherAPI.com - Weather data provider
Anthropic - Claude AI and MCP protocol