A conversational weather agent powered by Claude and MCP (Model Context Protocol). Ask it anything about the weather and it fetches live data from the free Open-Meteo API — no API key required for weather data.
You (terminal) ←→ agent.py (Claude AI) ←→ weather_server.py (MCP server)
↓
Open-Meteo Weather API
agent.py— the AI brain. Launches the MCP server, discovers its tools, and runs an agentic loop with Claude.weather_server.py— an MCP server exposing two weather tools to Claude.
| Tool | Description |
|---|---|
get_current_weather |
Current conditions for any city (temp, humidity, wind, etc.) |
get_weather_forecast |
Multi-day forecast up to 7 days |
- Python 3.10+
- An Anthropic API key
1. Clone the repo
git clone https://github.com/pradeepjc/weather-ai.git
cd weather-ai2. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate3. Install dependencies
pip install anthropic mcp httpx python-dotenv4. Add your API key
Create a .env file in the project root:
ANTHROPIC_API_KEY=sk-ant-...
source venv/bin/activate
python agent.pyExample session:
=======================================================
🌦 Weather Agent — powered by Claude + Open-Meteo
=======================================================
Ask me anything about the weather!
Type 'quit' or 'exit' to stop.
You: What's the weather like in Tokyo?
🔧 Calling tool: get_current_weather({'city': 'Tokyo'})
Agent: Currently in Tokyo, Japan it's 18°C (feels like 16°C) with partly cloudy skies...
weather-ai/
├── agent.py # AI agent — Claude + MCP client
├── weather_server.py # MCP server — weather tools
├── .env # Your API key (not committed)
└── README.md