MCP ExplorerExplorer

Claude Openweather Mcp

@ChandekarDhruvinon a year ago
1 MIT
FreeCommunity
AI Systems
Claude Weather Agent enables live weather data access via MCP server using OpenWeather API.

Overview

What is Claude Openweather Mcp

claude-openweather-mcp is a project that enables Claude to interact with live weather data, including current conditions and forecasts, using the OpenWeather API through an MCP (Multi-Command Protocol) server.

Use cases

Use cases include providing users with current weather updates, offering 5-day weather forecasts, and integrating weather data into applications for enhanced user experience.

How to use

To use claude-openweather-mcp, clone the repository, install the required dependencies, set up your OpenWeather API key in a .env file, and start the MCP server by running the weather.py script.

Key features

Key features include a FastMCP server implemented in Python, weather tools for retrieving current weather and forecasts, API security through environment variables, and easy integration with Claude’s configuration.

Where to use

claude-openweather-mcp can be used in applications that require real-time weather information, such as chatbots, virtual assistants, or any software that benefits from weather data integration.

Content

🌦️ Claude Weather Agent (MCP-Enabled)

This project enables Claude to interact with live weather data (current + forecast) using the OpenWeather API via an MCP (Multi-Command Protocol) server.

It includes:

  • FastMCP server using Python
  • Weather tools (get_weather and get_forecast)
  • Environment variable-based API security
  • Easy integration with claude_desktop_config.py

🚀 How to Run the MCP Server

  1. Clone this repo and navigate into it:
git clone https://github.com/ChandekarDhruvin/claude-openweather-mcp.git
cd claude-weather-agent/weather
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file in the same directory as weather.py:
OPENWEATHER_API_KEY=your_openweather_api_key
  1. Start the MCP server manually (for testing):
python weather.py

🧠 Tools Exposed to Claude

Tool Parameters Description
get_weather city: str, country: str = "IN" Returns current weather conditions.
get_forecast city: str, country: str = "IN" Provides a 5-day forecast (around noon).

🛠️ Claude Integration: claude_desktop_config.py

Add the following to your Claude config to auto-start the MCP server:

{
  "mcpServers": {
    "weather": {
      "command": "C:\\path\\to\\uv.exe",
      "args": [
        "--directory",
        "C:\\path\\to\\weather\\folder",
        "run",
        "C:\\path\\to\\weather\\weather.py"
      ]
    }
  }
}

📝 Note: You must adjust the path to match your local Python virtual environment and directory structure.


📂 Project Structure

weather/
├── weather.py            # Main FastMCP server with weather tools
├── .env                  # Contains the OpenWeather API key
├── requirements.txt      # Dependencies
└── README.md             # You're reading it!

🔒 Environment Variables

Using python-dotenv, we securely load the OpenWeather API key from a .env file.

from dotenv import load_dotenv
import os

load_dotenv()
OPENWEATHER_API_KEY = os.getenv("OPENWEATHER_API_KEY")

✅ Requirements

Add this in your requirements.txt:

httpx
python-dotenv
fastmcp

Screenshot 2025-04-14 145544

User: What's the weather like in Mumbai today?
Claude: 
Current weather in Mumbai, IN:
Condition: Clear (clear sky)
Temperature: 32°C (Feels like 35°C)
Humidity: 58%
Wind Speed: 3.5 m/s

Reference

https://modelcontextprotocol.io/

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers