Skip to main content
Glama

🌦️ Weather MCP RAG アシスタント

Model Context Protocol (MCP)、Retrieval-Augmented Generation (RAG)、LangChain、ChromaDB、Groq LLM、OpenWeather API を使用して構築された AI 搭載の天気アシスタントです。

このプロジェクトは、リアルタイムの天気データを取得するカスタム MCP ツールを公開し、それを RAG パイプラインと組み合わせて、文脈に応じた自然言語の天気インサイトを生成します。

🚀 主な機能

  • FastMCP を使用して構築されたカスタム MCP サーバー

  • OpenWeather API を使用したリアルタイムの天気取得

  • 文脈に応じた応答のための Retrieval-Augmented Generation (RAG) パイプライン

  • 天気コンテキストの保存と取得のための ChromaDB ベクターストア

  • all-MiniLM-L6-v2 を使用した Sentence Transformer 埋め込み

  • LangChain を通じた Groq ホスト型 LLM の統合

  • VS Code / GitHub Copilot との MCP ツール統合

  • さまざまな都市の動的な天気クエリをサポート

  • 環境変数を使用した安全な API キー管理

Related MCP server: Weather MCP Server

🧠 仕組み

User Query
    ↓
GitHub Copilot / MCP Client
    ↓
Weather MCP Server
    ↓
get_weather(location)
    ↓
OpenWeather API
    ↓
Weather Data Processing
    ↓
ChromaDB Vector Store
    ↓
RAG Retrieval
    ↓
Groq LLM
    ↓
Context-Aware Weather Response

🛠️ 技術スタック

言語: Python

AI / GenAI: LLM、RAG、プロンプトエンジニアリング、Sentence Transformers

フレームワーク: LangChain、FastMCP

ベクターデータベース: ChromaDB

LLM プロバイダー: Groq

外部 API: OpenWeather API

プロトコル: Model Context Protocol (MCP)

開発環境: VS Code、Git、GitHub

📂 プロジェクト構造

Weather-MCP-RAG-Assistant/
│
├── rag/
│   ├── embedding.py
│   ├── llm.py
│   ├── retriever.py
│   └── vector_store.py
│
├── services/
│   └── weather_service.py
│
├── utils/
│   └── parser.py
│
├── config.py
├── server.py
├── requirements.txt
├── env.example
├── .gitignore
└── README.md

⚙️ セットアップ

1. リポジトリをクローンする

git clone https://github.com/rudraniai/Weather-MCP-RAG-Assistant.git
cd Weather-MCP-RAG-Assistant

2. 仮想環境を作成する

python -m venv .venv

Windows でアクティベートする:

.venv\Scripts\activate

3. 依存関係をインストールする

pip install -r requirements.txt

4. 環境変数を設定する

サンプル環境ファイルをコピーする:

copy env.example .env

.env に認証情報を追加する:

OPENWEATHER_API_KEY=your_openweather_api_key
GROQ_API_KEY=your_groq_api_key
GROQ_MODEL=your_groq_model
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
CHROMA_DB_DIR=./chroma_db

API 認証情報は .gitignore を使用してバージョン管理の対象外にしています。

5. MCP サーバーを実行する

python server.py

🔌 MCP 設定

VS Code でローカル MCP サーバーを設定するには、次を使用します:

{
  "servers": {
    "weather-mcp": {
      "type": "stdio",
      "command": "python",
      "args": [
        "PATH_TO_PROJECT/server.py"
      ]
    }
  },
  "inputs": []
}

PATH_TO_PROJECTserver.py のローカルパスに置き換えてください。

設定後:

  1. VS Code のコマンドパレットを開きます。

  2. MCP: List Servers を選択します。

  3. weather-mcp を選択します。

  4. MCP サーバーを起動します。

  5. GitHub Copilot Chat を開き、要求されたら MCP ツールを許可します。

🎥 プロジェクトデモ

以下のデモは、カスタム weather-mcp MCP ツールが GitHub Copilot を通じて呼び出され、文脈に応じた天気情報を取得・生成する様子を示しています。

Weather MCP Demo

💬 使用例

Copilot に質問する:

Use the weather-mcp MCP tool to get the weather in Pune.

その他の例:

Use the weather-mcp MCP tool to get the weather in Mumbai.

Use the weather-mcp MCP tool to get the weather in Nagpur.

アシスタントが返す情報の例:

  • 現在の気温

  • 体感温度

  • 湿度

  • 風速と風向

  • 曇りの状態

  • 天気の概要

  • 利用可能な場合の大気質情報

🔐 セキュリティ

API キーなどの機密認証情報は、ローカルの .env ファイルに保存されます。

以下のファイル/ディレクトリは Git から除外されています:

.env
chroma_db/
__pycache__/
.vscode/

実際の API キーをリポジトリにコミットしないでください。

📌 学んだこと

このプロジェクトを通じて、以下の実践的な経験を得ました:

  • Model Context Protocol (MCP) を通じたツールの構築と公開

  • LLM ベースのアプリケーションへの外部 API の統合

  • RAG パイプラインの実装

  • 埋め込みとベクターデータベースの操作

  • 文脈取得のための ChromaDB の使用

  • LangChain とホスト型 LLM の接続

  • GitHub Copilot とのカスタム MCP サーバーの統合

  • 環境変数と API 認証情報の安全な管理

🔮 今後の改善点

  • 複数日間の天気予報の追加

  • 天気アラートと推奨事項の追加

  • 取得と文脈メモリの改善

  • 追加の天気・環境データソースの追加

  • Streamlit または FastAPI を使用したスタンドアロンの Web インターフェースの構築

  • Docker を使用したアプリケーションのコンテナ化

👩💻 著者

Rudrani Gulhane

B.Tech コンピュータサイエンス工学 — 人工知能および機械学習

AI/ML、生成 AI、RAG、LLM、AI エージェント、MCP ベースのアプリケーションに興味があります。

📄 ライセンス

このプロジェクトは、教育、ポートフォリオ、および実験目的で提供されています。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables AI agents to fetch real-time weather data for any location using the OpenWeatherMap API. Demonstrates how to build a simple MCP server that exposes weather information as a tool for LLMs.
    1
    GPL 3.0
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides real-time weather updates and city geocoding by integrating the Nominatim and Open-Meteo APIs. It enables users to retrieve current weather conditions for any location through natural language queries in MCP-compatible clients.
    15
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides weather data from OpenWeatherMap API through MCP tools and a REST API with OpenAPI support. Enables LLM agents to retrieve current weather, forecasts, and temperature ranges by city or coordinates.
    21
    MIT

View all related MCP servers

Related MCP Connectors

  • OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)

  • Open-Meteo MCP — weather forecast + historical reanalysis + sister APIs

  • WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rudraniai/Weather-MCP-RAG-Assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server