mcp-weather-server
Provides current weather conditions and 5-day forecasts for any city worldwide using the OpenWeatherMap API.
README
MCP Weather Server
A Model Context Protocol (MCP) server that provides weather information and forecasts using the OpenWeatherMap API.
Features
- š¤ļø Get current weather conditions for any city
- š Get 5-day weather forecasts
- š”ļø Temperature, humidity, wind speed, and atmospheric pressure
- āļø Weather descriptions and conditions
- š Works with cities worldwide
Tools Available
get_weather
Get current weather conditions for a specified location.
Parameters:
location(required): City name (e.g., "London", "Jakarta", "New York")
Example: "What's the weather in Jakarta?"
get_weather_forecast
Get a 5-day weather forecast for a specified location.
Parameters:
location(required): City namedays(optional): Number of days to forecast (1-5, default: 5)
Example: "What's the 5-day forecast for London?"
Prerequisites
- Python 3.7+
- OpenWeatherMap API key (free tier available)
- Claude Desktop application
Installation
-
Clone the repository:
git clone https://github.com/your-username/mcp-weather-server.git cd mcp-weather-server -
Create a virtual environment:
python -m venv .venv .venv\Scripts\activate # On Windows # or source .venv/bin/activate # On macOS/Linux -
Install dependencies:
pip install -r requirements.txt -
Get an API key:
- Sign up at OpenWeatherMap
- Get your free API key
-
Set up environment variables:
- Copy
.env.exampleto.env - Add your API key to the
.envfile:OPENWEATHER_API_KEY=your_api_key_here
- Copy
Configuration
Claude Desktop Setup
-
Locate your Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
- Windows:
-
Add the weather server configuration:
{ "mcpServers": { "weather": { "command": "path/to/your/project/.venv/Scripts/python.exe", "args": ["path/to/your/project/minimal_weather_server.py"], "env": { "OPENWEATHER_API_KEY": "your_api_key_here" } } } } -
Restart Claude Desktop
Testing
Test the server independently:
python test_minimal.py
Or test specific functionality:
python debug_server.py
Usage Examples
Once configured with Claude Desktop, you can ask natural language questions:
- "What's the weather in Jakarta?"
- "Get me the current weather for London"
- "What's the 5-day forecast for Tokyo?"
- "How's the weather in Singapore today?"
- "Show me the weather forecast for Bandung"
Project Structure
mcp-weather-server/
āāā minimal_weather_server.py # Main MCP server
āāā simple_weather_server.py # Alternative simple server
āāā weather_server.py # Original MCP library version
āāā test_minimal.py # Test script
āāā debug_server.py # Debug utilities
āāā requirements.txt # Python dependencies
āāā .env.example # Environment template
āāā .env # Environment variables (not in git)
āāā .gitignore # Git ignore rules
āāā README.md # This file
API Reference
This server uses the OpenWeatherMap API to fetch weather data.
Troubleshooting
Common Issues
-
"API key not found" error:
- Ensure your
.envfile containsOPENWEATHER_API_KEY=your_actual_key - Verify the API key is valid and active
- Ensure your
-
"Server disconnected" in Claude:
- Check that file paths in the config are correct
- Ensure Python executable path is accurate
- Restart Claude Desktop after config changes
-
"Location not found" error:
- Try using different city name variations
- Include country name for ambiguous cities (e.g., "London, UK")
Debug Steps
-
Test the server independently:
python test_minimal.py -
Check server logs in Claude Desktop
-
Verify API key permissions at OpenWeatherMap
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- OpenWeatherMap for providing the weather API
- Anthropic for Claude and the MCP specification
- MCP community for protocol documentation and examples
Support
If you encounter any issues or have questions:
- Check the troubleshooting section
- Review OpenWeatherMap API docs
- Open an issue on GitHub
Made with ā¤ļø for the MCP community
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.