Skip to main content
Glama

🌦️ Weather MCP RAG 어시스턴트

Model Context Protocol(MCP), RAG(Retrieval-Augmented Generation), LangChain, ChromaDB, Groq LLM, OpenWeather API를 사용하여 구축된 AI 기반 날씨 어시스턴트입니다.

이 프로젝트는 실시간 날씨 데이터를 검색하는 커스텀 MCP 도구를 제공하며, 이를 RAG 파이프라인과 결합하여 상황에 맞는 자연어 날씨 인사이트를 생성합니다.

🚀 주요 기능

  • FastMCP를 사용하여 구축된 커스텀 MCP 서버

  • OpenWeather API를 사용한 실시간 날씨 검색

  • 상황에 맞는 응답을 위한 RAG(Retrieval-Augmented Generation) 파이프라인

  • 날씨 컨텍스트 저장 및 검색을 위한 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_PROJECT를 server.py의 로컬 경로로 바꾸세요.

구성 후:

  1. VS Code 명령 팔레트를 엽니다.

  2. MCP: List Servers를 선택합니다.

  3. weather-mcp를 선택합니다.

  4. MCP 서버를 시작합니다.

  5. GitHub Copilot Chat을 열고 요청 시 MCP 도구를 허용합니다.

🎥 프로젝트 데모

아래 데모는 GitHub Copilot을 통해 커스텀 weather-mcp MCP 도구가 호출되어 상황에 맞는 날씨 정보를 검색하고 생성하는 과정을 보여줍니다.

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 연결

  • 커스텀 MCP 서버와 GitHub Copilot 통합

  • 환경 변수 및 API 자격 증명의 안전한 관리

🔮 향후 개선 사항

  • 다일별 날씨 예보 추가

  • 날씨 경보 및 추천 기능 추가

  • 검색 및 상황별 메모리 개선

  • 추가 날씨 및 환경 데이터 소스 통합

  • Streamlit 또는 FastAPI를 사용한 독립형 웹 인터페이스 구축

  • Docker를 사용한 애플리케이션 컨테이너화

👩💻 작성자

Rudrani Gulhane

컴퓨터 공학 학사 — 인공지능 및 머신러닝

AI/ML, 생성형 AI, RAG, LLM, AI 에이전트, MCP 기반 애플리케이션에 관심이 있습니다.

📄 라이선스

이 프로젝트는 교육, 포트폴리오 및 실험 목적으로 제작되었습니다.

Related MCP Connectors

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.
    19 npm
    -
  • 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.
    11 npm
    MIT