Weather MCP Server
Enables AI assistants to fetch real-time weather data, forecasts up to 10 days, and compare weather conditions between cities using WeatherAPI.com with support for both Celsius and Fahrenheit units.
README
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-server -
Install dependencies
pip install -r requirements.txt -
Set 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:
python weather_server_mcp.py
You would see somthing like this it means server is running correclty
╭──────────────────────────────────────────────────────────────────────────────╮
│ │
│ ▄▀▀ ▄▀█ █▀▀ ▀█▀ █▀▄▀█ █▀▀ █▀█ │
│ █▀ █▀█ ▄▄█ █ █ ▀ █ █▄▄ █▀▀ │
│ │
│ FastMCP 2.13.1 │
│ │
│ │
│ 🖥 Server name: Weather Server │
│ │
│ 📦 Transport: STDIO │
│ │
│ 📚 Docs: https://gofastmcp.com │
│ 🚀 Hosting: https://fastmcp.cloud │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
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
{
"mcpServers": {
"weather": {
"command": "python",
"args": [
"weather_server_mcp.py"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Note : for 'command' write absolute location instead of only "python" by checking using in command prompt
where python
you will see somthing like this
C:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe
After updating the config, restart Claude Desktop.
Available Tools
1. Get Current Weather
get_current_weather(city: str, units: str = "metric")
- city: City name (e.g., 'London', 'New York', 'Tokyo')
- units: 'metric' for Celsius or 'imperial' for Fahrenheit
Example:
get_current_weather("London", "metric")
2. Get Weather Forecast
get_forecast(city: str, days: int = 3, units: str = "metric")
- city: City name
- days: Number of forecast days (1-10)
- units: Temperature units
Example:
get_forecast("Paris", days=5, units="metric")
3. Compare Weather
compare_weather(city1: str, city2: str, units: str = "metric")
- city1: First city name
- city2: Second city name
- units: Temperature units
Example:
compare_weather("Tokyo", "New York", "metric")
Project Structure
weather-mcp-server/
├── weather_server_mcp.py # Main MCP server implementation
├── requirements.txt # Python dependencies
├── .env # Environment variables (not committed)
├── .gitignore # Git ignore file
└── README.md # This file
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
Current Weather in London, United Kingdom
📍 Location: 51.52, -0.11
🌡️ Temperature: 15°C
🤔 Feels Like: 14°C
☁️ Condition: Partly cloudy
💧 Humidity: 72%
🔽 Pressure: 1013.0 hPa
💨 Wind Speed: 15.1 kph
☁️ Cloudiness: 25%
👁️ Visibility: 10.0 km
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 key - Or 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。