Skip to main content
Glama
darshan0548

weather-mcp

by darshan0548

weather-mcp

MCP (Model Context Protocol) サーバーで、AI アシスタント(Claude、Gemini CLI、または MCP 互換クライアント)が、生の数値を取得するだけでなく、ライブデータを使って実際の天気に関する質問に答えられるようにします。

Powered by Open-Meteo — 無料、API キー不要。

単なる生の天気 API ラッパーではない理由

多くの天気統合は単に temperature: 22°C を返すだけです。このサーバーはその上に推論レイヤーを追加するため、通常の API では直接答えられないことを質問できます。

  • get_weather("Bangalore") — 現在の状況と今日の予報

  • should_i_carry_umbrella("Mumbai") — 雨の確率だけでなく、理由付きで yes/no を回答

  • is_good_for_outdoors("Delhi") — 雨・風・気温をまとめて確認し、外に良い日かどうかを判断

  • compare_weather("Bangalore", "Delhi") — 2 つの都市を一度に比較

Related MCP server: Weather MCP Server

セットアップ

git clone https://github.com/darshan0548/weather-mcp.git
cd weather-mcp
python3 -m venv venv
source venv/bin/activate   # on Windows: venv\Scripts\activate
pip install -r requirements.txt

テストの実行

実際の API に対する簡単な動作確認(モックなし、API キー不要):

python test_weather.py

Claude Desktop への接続

Claude Desktop の設定ファイル(claude_desktop_config.json)に次を追加してください:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/absolute/path/to/weather-mcp/server.py"]
    }
  }
}

Gemini CLI への接続

~/.gemini/settings.json に次を追加してください:

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": ["/absolute/path/to/weather-mcp/server.py"]
    }
  }
}

クライアントを再起動し、「今日、チェンナイで念のための傘を持っていくべきですか?」 のように質問するだけです。

プロジェクト構造

weather_core.py     # talks to the Open-Meteo API, no MCP-specific code
weather_advice.py    # reasoning layer built on top of raw weather data
server.py            # MCP server — wires the above into tools
test_weather.py       # sanity tests against the real API

weather_core.py と weather_advice.py は意図的に分離されています。どちらも MCP 依存がまったくないため、単体でテストしたり再利用したりするのが簡単です。

コントリビューション

PR を歓迎しています。ツールを追加したい場合のアイデア:

  • 今日の概要だけでなく、1 時間ごとの予報の内訳

  • 大気質データ(Open-Meteo にも無料のエンドポイントがあります)

  • 複数日にわたる旅行プラン(今週、屋外イベントに最適な日)

  • 激しい天気警報

新しいツールが生データの上に推論を加える場合は weather_advice.py に、純粋なデータ取得の場合は weather_core.py に入れて、server.py に新しい @mcp.tool() として配線してください。

ライセンス

MIT — LICENSE を参照してください。

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to fetch current weather conditions and forecasts for any city using the Open-Meteo API. Provides temperature, precipitation, and hourly forecast data through natural language queries.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides real-time weather data via 12 tools (current weather, forecasts, air quality, umbrella advice, etc.) using Open-Meteo and FastMCP, enabling LLMs to answer weather-related queries.
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides live weather data (current conditions, forecasts) and city geocoding through Open-Meteo API, enabling AI assistants to answer weather queries without an API key.
    MIT