Weather MCP Tool

by SaintDoresh
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Enables secure storage and loading of the OpenWeatherMap API key through environment variables, keeping sensitive data out of the codebase.

  • Offers a comprehensive tutorial on setting up and using the Weather MCP Tool with Claude Desktop, published on the Medium platform.

  • Requires Python 3.10+ as the runtime environment for the MCP server that processes weather data requests.

Claude Desktop용 날씨 MCP 도구

OpenWeatherMap API를 사용하여 실시간 날씨 데이터, 예보 및 과거 날씨 정보를 제공하는 MCP(Model Context Protocol) 도구로, 특히 Claude Desktop을 위해 설계되었습니다.

지도 시간

이 도구를 설정하고 사용하는 방법에 대한 자세한 가이드는 포괄적인 Medium 튜토리얼을 확인하세요. 튜토리얼: Weather MCP 도구와 함께 Claude Desktop을 사용하여 전 세계 실시간 날씨 데이터에 액세스

특징

  • 모든 위치의 실시간 날씨 상황
  • 날씨 예보(최대 5일)
  • 과거 날씨 데이터(지난 5일)
  • 대기질 정보
  • 날씨 경보 및 경고
  • 위치 검색 기능

설정

  1. Python 3.10 이상이 설치되어 있는지 확인하세요.
  2. 종속성 설치:

지엑스피1

  1. OpenWeatherMap 에서 API 키 받기(무료 계층 이용 가능)
    • 참고: 새 API 키를 활성화하는 데 최대 24시간이 걸릴 수 있습니다.
  2. API 키에 대한 환경 변수 설정(권장 방법):
    • 프로젝트 디렉토리에 .env 파일을 만듭니다.
    • API 키를 GXP2 파일에 추가하세요.
    • 민감한 데이터가 커밋되는 것을 방지하려면 .gitignore 파일에 .env 추가하세요.
  3. 환경 변수를 사용하도록 main.py 업데이트합니다.
    # 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")

Claude Desktop과 통합

  1. Claude Desktop에서 MCP 설정에 다음을 추가하여 MCP 설정을 구성하세요.
{ "mcpServers": { "weather-mcp": { "command": "py", "args": ["-3.13", "C:\\Path\\To\\Your\\Weather-MCP-ClaudeDesktop\\main.py"] } } }
  1. 경로를 main.py 파일의 전체 경로로 바꾸세요.
  2. 다음을 사용하여 서버를 실행합니다.
py -3.13 main.py
  1. Claude Desktop을 사용하는 동안 서버를 계속 실행하세요

사용 가능한 도구

1. 현재 날씨 가져오기

특정 지역의 실시간 날씨 상황을 확인하세요:

{ "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. 날씨 예보 받기

특정 지역의 날씨 예보를 받으세요:

{ "location": { "name": "London", "country": "GB", "lat": 51.5074, "lon": -0.1278 }, "forecast": [ { "datetime": "2025-03-16T15:00:00", "temperature": { "temp": 18.2, "feels_like": 17.8, "min": 17.5, "max": 19.1 }, "weather_condition": { "main": "Rain", "description": "light rain", "icon": "10d" }, "wind": { "speed": 4.2, "deg": 180 }, "clouds": 75, "humidity": 82, "pressure": 1010, "visibility": 8000, "pop": 0.4 } // ... more forecast items ], "days": 5 }

3. 공기질 얻기

특정 위치의 대기 질 데이터를 받으세요:

{ "location": { "name": "Beijing", "country": "CN", "lat": 39.9042, "lon": 116.4074 }, "air_quality_index": 3, "air_quality_level": "Moderate", "components": { "co": 250.34, "no": 0.5, "no2": 15.2, "o3": 140.8, "so2": 5.1, "pm2_5": 8.2, "pm10": 12.3, "nh3": 0.7 }, "timestamp": "2025-03-16T14:30:00" }

4. 역사적 날씨 얻기

특정 날짜의 과거 날씨 데이터를 가져옵니다.

{ "location": { "name": "Paris", "country": "FR", "lat": 48.8566, "lon": 2.3522 }, "date": "2025-03-14", "temperature": { "temp": 20.3, "feels_like": 19.8 }, "weather_condition": { "main": "Clouds", "description": "scattered clouds", "icon": "03d" }, "wind": { "speed": 2.8, "deg": 150 }, "clouds": 45, "humidity": 60, "pressure": 1012, "visibility": 10000, "sunrise": "2025-03-14T06:30:45", "sunset": "2025-03-14T18:15:22", "timestamp": "2025-03-14T12:00:00" }

5. 검색_위치

이름으로 위치 검색:

{ "results": [ { "name": "Tokyo", "state": "", "country": "JP", "lat": 35.6762, "lon": 139.6503 }, { "name": "Tokyo", "state": "Tokyo", "country": "JP", "lat": 35.6895, "lon": 139.6917 } // ... more results ] }

6. 날씨 알림 받기

특정 지역의 날씨 알림을 받으세요:

{ "location": { "name": "Miami", "country": "US", "lat": 25.7617, "lon": -80.1918 }, "alerts": [ { "sender": "NWS Miami", "event": "Heat Advisory", "start": "2025-03-16T12:00:00", "end": "2025-03-16T20:00:00", "description": "Heat index values between 105 and 110 expected", "tags": ["Extreme temperature value"] } // ... more alerts if any ], "alert_count": 1 }

샘플 쿼리

Claude Desktop에게 다음과 같은 질문을 할 수 있습니다.

  • "뉴욕의 현재 날씨는 어때요?"
  • "런던의 5일 날씨를 보여주세요"
  • "오늘 베이징의 공기 질은 어때요?"
  • "3월 14일 파리의 날씨는 어땠어요?"
  • "도쿄"라는 이름의 장소를 검색하세요
  • "마이애미에 대한 날씨 경보가 있나요?"
  • "시카고, 마이애미, 시애틀의 현재 날씨를 비교해보세요"
  • "베이징, 로스앤젤레스, 델리의 대기 질을 비교해 보세요"

오류 처리

모든 도구에는 적절한 오류 처리 기능이 포함되어 있으며 문제가 발생하면 오류 메시지를 반환합니다.

{ "error": "Failed to fetch current weather for InvalidLocation: Location not found" }

문제 해결

Claude Desktop에서 MCP 서버가 작동하지 않는 경우:

  1. 서버가 실행 중인지 확인하세요. 스크립트를 시작하면 출력이 표시되어야 합니다.
  2. 설정의 경로가 올바르고 절대적인지 확인하세요.
  3. Python 3.10 이상이 시스템 PATH에 있는지 확인하세요.
  4. 모든 종속성이 설치되었는지 확인하세요
  5. Claude Desktop을 다시 시작해 보세요.
  6. 오류 메시지가 있는지 로그를 확인하세요.

일반적인 API 문제

  • API 키 활성화 : 새로운 OpenWeatherMap API 키는 활성화하는 데 최대 24시간이 걸릴 수 있습니다.
  • 잘못된 API 키 오류 : 401 오류가 발생하는 경우 API 키가 올바르고 활성화되어 있는지 확인하세요.
  • 속도 제한 : 무료 계층은 분당 최대 60개의 통화를 허용하지만 사용량이 많을 경우 이 제한이 초과될 수 있습니다.

요금 제한

이 도구는 속도 제한이 있는 OpenWeatherMap API를 사용합니다. 무료 버전은 분당 최대 60회의 호출을 허용하며, 이는 개인 용도로는 충분한 수준입니다. 단, 요청이 매우 빈번하게 발생하는 경우 API에 의해 제한될 수 있습니다.

특허

MIT 라이센스

-
security - not tested
A
license - permissive license
-
quality - not tested

Claude Desktop용 OpenWeatherMap API에서 실시간 날씨 데이터, 예보 및 과거 날씨 정보를 제공하여 전 세계의 현재 상황, 예보, 대기 질 및 날씨 경보에 대한 자연어 쿼리를 지원합니다.

  1. Tutorial
    1. Features
      1. Setup
        1. Integration with Claude Desktop
          1. Available Tools
            1. 1. get_current_weather
            2. 2. get_weather_forecast
            3. 3. get_air_quality
            4. 4. get_historical_weather
            5. 5. search_location
            6. 6. get_weather_alerts
          2. Sample Queries
            1. Error Handling
              1. Troubleshooting
                1. Common API Issues
              2. Rate Limits
                1. License
                  ID: vh7tgzyyy2