Skip to content

pradeepjc/weather-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather AI Agent

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.

How it works

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.

Available tools

Tool Description
get_current_weather Current conditions for any city (temp, humidity, wind, etc.)
get_weather_forecast Multi-day forecast up to 7 days

Prerequisites

Setup

1. Clone the repo

git clone https://github.com/pradeepjc/weather-ai.git
cd weather-ai

2. Create and activate a virtual environment

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate

3. Install dependencies

pip install anthropic mcp httpx python-dotenv

4. Add your API key

Create a .env file in the project root:

ANTHROPIC_API_KEY=sk-ant-...

Running

source venv/bin/activate
python agent.py

Example 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...

Project structure

weather-ai/
├── agent.py           # AI agent — Claude + MCP client
├── weather_server.py  # MCP server — weather tools
├── .env               # Your API key (not committed)
└── README.md

About

Conversational weather agent powered by Claude AI and MCP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages