SW

saintdoresh/weather-mcp-claudedesktop

Analytics & monitoring

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

11 stars 7 forks Качество 65 Тренд 8MIT

An MCP (Model Context Protocol) tool that provides real-time weather data, forecasts, and historical weather information using the OpenWeatherMap API, specifically designed for Claude Desktop.

Обзор

An MCP (Model Context Protocol) tool that provides real-time weather data, forecasts, and historical weather information using the OpenWeatherMap API, specifically designed for Claude Desktop. For a detailed guide on setting up and using this tool, check out our comprehensive Medium tutorial: Tutorial: Using Claude Desktop with Weather MCP Tool to Access Real-Time Weather Data Worldwide - Real-time weather conditions for any location - Weather forecasts (up to 5 days) - Historical weather data (last 5 days) - Air quality information - Weather alerts and warnings - Location search functionality 1. Ensure you have Python 3.10 or higher installed 3. Get an API key from OpenWeatherMap (free tier available) - Note: New API keys may take up to 24 hours to activate 4. Set up environment variables for API key (recommended method): - Create a .env file in the project directory - Add your API key to the file: - Add .env to your .gitignore file to prevent committing sensitive data 5.

README

Показан фрагмент оригинального README. Открыть оригинал.

Weather MCP Tool for Claude Desktop

An MCP (Model Context Protocol) tool that provides real-time weather data, forecasts, and historical weather information using the OpenWeatherMap API, specifically designed for Claude Desktop.

Tutorial

For a detailed guide on setting up and using this tool, check out our comprehensive Medium tutorial: Tutorial: Using Claude Desktop with Weather MCP Tool to Access Real-Time Weather Data Worldwide

Features

  • Real-time weather conditions for any location
  • Weather forecasts (up to 5 days)
  • Historical weather data (last 5 days)
  • Air quality information
  • Weather alerts and warnings
  • Location search functionality

Setup

  1. Ensure you have Python 3.10 or higher installed

  2. Install dependencies:

pip install -r requirements.txt
  1. Get an API key from OpenWeatherMap (free tier available)

    • Note: New API keys may take up to 24 hours to activate
  2. Set up environment variables for API key (recommended method):

    • Create a .env file in the project directory
    • Add your API key to the file:
    OPENWEATHER_API_KEY=your_openweathermap_api_key
    
    • Add .env to your .gitignore file to prevent committing sensitive data
  3. Update main.py to use the environment variable:

    # Add these imports at the top
    import os
    from dotenv import load_dotenv
    
    # Load environment variables
    load_dotenv()
    
    # Replace the API_KEY line with
    API_KEY = os.getenv("OPENWEATHER_API_KEY")
    

Integration with Claude Desktop

  1. Configure your MCP settings in Claude Desktop by adding the following to your MCP configuration:
{
  "mcpServers": {
    "weather-mcp": {
      "command": "py",
      "args": ["-3.13", "C:\\Path\\To\\Your\\Weather-MCP-ClaudeDesktop\\main.py"]
    }
  }
}
  1. Replace the path with the full path to your main.py file
  2. Run the server using:
py -3.13 main.py
  1. Keep the server running while using Claude Desktop

Available Tools

1. get_current_weather

Get real-time weather conditions for a location:

{
    "location": {
        "name": "New York",
        "country": "US",
        "lat": 40.7128,
        "lon": -74.006
    },
    "temperature": {
        "current": 25.6,
        "feels_like": 26.2,
        "min": 23.4,
        "max": 27.8
    },
    "weather_condition": {
        "main": "Clear",
        "description": "clear sky",
        "icon": "01d"
    },
    "wind": {
        "speed": 3.6,
        "deg": 220
    },
    "clouds": 5,
    "humidity": 65,
    "pressure": 1015,
    "visibility": 10000,
    "sunrise": "2025-03-16T06:12:34",
    "sunset": "2025-03-16T18:04:23",
    "timestamp": "2025-03-16T14:30:00"
}

2. get_weather_forecast

Get weather forecast for a location:

{
    "location": {
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "weather-mcp": { "command": "py", "args": ["-3.13", "C:\\Path\\To\\Your\\Weather-MCP-ClaudeDesktop\\main.py"] } } }