Skip to main content
Glama

🌤️ Weather MCP サーバー & Cursor 用チャットボットインターフェース

Cursor 向けに実装された、シンプルで完全な Python プロジェクトです。Model Context Protocol (MCP) ウェザーサーバーを Cursor IDE で利用でき、さらにウェザーエージェントと対話するための チャットボット Web UI も備えています。


🌟 特徴

  • 🌐 MCP サーバー (weather_mcp_server.py): FastMCP を stdio トランスポートで使用。Cursor や他の MCP クライアントに天気ツールを公開します。

  • ⚡ 無料のリアルタイム天気 (weather_service.py): Open-Meteo を利用。API キー不要。世界中の任意の都市に対応。

  • 🤖 ウェザーエージェント (agent.py): 自然なクエリ(「東京の天気」、「ロンドンの5日間予報」、「パリの大気質」)をツール呼び出しに変換します。

  • 💻 モダンなチャットボット UI (static/ と app.py): ダークモード、グラスモーフィズムの Web インターフェース。視覚的な天気カード、予報テーブル、ツール実行バッジを備えています。

  • 🔌 Cursor 統合 (.cursor/mcp.json): Cursor 設定用の事前構成済み JSON。


Related MCP server: bridgemcp-server-weather

📁 プロジェクト構成

weather-mcp-chatbot/
│── .cursor/
│   └── mcp.json               # Cursor MCP configuration
│── weather_service.py         # Free Open-Meteo weather & geocoding integration
│── weather_mcp_server.py      # MCP Server (stdio transport for Cursor)
│── agent.py                   # Weather agent NLP & tool caller
│── app.py                     # FastAPI web server & chat endpoint
│── static/
│   ├── index.html             # Chatbot UI
│   ├── style.css              # Modern dark-mode styling
│   └── app.js                 # Chatbot frontend logic
│── test_mcp.py                # Automated test suite
│── requirements.txt           # Python dependencies
└── README.md                  # Documentation & quickstart

🚀 クイックスタート

1. 依存関係のインストール

pip install -r requirements.txt

2. Web チャットボット UI を実行

python app.py

ブラウザを開いて、次の URL にアクセスしてください: http://127.0.0.1:8000

3. 自動テストを実行

python test_mcp.py

🔌 Cursor との接続方法

Cursor は Python MCP サーバーに直接接続して、Cursor Chat / Composer 内でリアルタイムの天気データを提供できます。

オプション A: .cursor/mcp.json を使用(推奨)

  1. Cursor でこのプロジェクトディレクトリを開きます:

    File -> Open Folder -> weather-mcp-chatbot
  2. プロジェクト内の .cursor/mcp.json ファイルは Cursor によって自動的に検出されます。

オプション B: Cursor 設定で追加

  1. Cursor で 設定 を開きます(Ctrl + , または Cmd + ,)。

  2. 機能 -> MCP サーバー に移動します。

  3. 新しい MCP サーバーを追加 をクリックします:

    • 名前: weather

    • タイプ: command (stdio)

    • コマンド: python C:\Users\admin\.gemini\antigravity\scratch\weather-mcp-chatbot\weather_mcp_server.py

  4. 保存 をクリックし、緑色のステータスインジケーターを確認します。

Cursor Chat での使用方法:

Cursor Composer または Chat で、次のように質問できます:

  • 「東京の現在の天気は?」

  • 「@weather を使ってベルリンの5日間予報を確認して」

  • 「パリの大気質は?」

Cursor は MCP ツール(get_current_weather、get_weather_forecast、get_air_quality)を呼び出して、ライブデータを取得します!


🛠️ 公開されている MCP ツール

ツール名

パラメータ

説明

get_current_weather

city: str, units: str = "metric"

リアルタイムの気温、天候、湿度、風速、気圧

get_weather_forecast

city: str, days: int = 5, units: str = "metric"

日ごとの最高/最低気温と降水確率を含む複数日予報

get_air_quality

city: str

大気質指数(US & EU AQI)、PM2.5、PM10、オゾン濃度

Related MCP Connectors

Related MCP Servers