weather-mcp

weather-mcp

Enables users to get real-time weather data and contextual natural-language insights for any city by combining OpenWeather API with a RAG pipeline and Groq LLM, and can be used via MCP clients like GitHub Copilot.

Category
Visit Server

README

šŸŒ¦ļø Weather MCP RAG Assistant

An AI-powered weather assistant built using Model Context Protocol (MCP), Retrieval-Augmented Generation (RAG), LangChain, ChromaDB, Groq LLM, and OpenWeather API.

The project exposes a custom MCP tool that retrieves real-time weather data and combines it with a RAG pipeline to generate contextual, natural-language weather insights.

šŸš€ Key Features

  • Custom MCP server built using FastMCP
  • Real-time weather retrieval using OpenWeather API
  • Retrieval-Augmented Generation (RAG) pipeline for contextual responses
  • ChromaDB vector store for storing and retrieving weather context
  • Sentence Transformer embeddings using all-MiniLM-L6-v2
  • Groq-hosted LLM integration through LangChain
  • MCP tool integration with VS Code / GitHub Copilot
  • Supports dynamic weather queries for different cities
  • Secure API-key management using environment variables

🧠 How It Works

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

šŸ› ļø Tech Stack

Language: Python

AI / GenAI: LLMs, RAG, Prompt Engineering, Sentence Transformers

Frameworks: LangChain, FastMCP

Vector Database: ChromaDB

LLM Provider: Groq

External API: OpenWeather API

Protocol: Model Context Protocol (MCP)

Development Environment: VS Code, Git, GitHub

šŸ“‚ Project Structure

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

āš™ļø Setup

1. Clone the repository

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

2. Create a virtual environment

python -m venv .venv

Activate it on Windows:

.venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Copy the example environment file:

copy env.example .env

Add your credentials to .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 credentials are kept outside version control using .gitignore.

5. Run the MCP server

python server.py

šŸ”Œ MCP Configuration

Configure the local MCP server in VS Code using:

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

Replace PATH_TO_PROJECT with the local path to server.py.

After configuration:

  1. Open the VS Code Command Palette.
  2. Select MCP: List Servers.
  3. Select weather-mcp.
  4. Start the MCP server.
  5. Open GitHub Copilot Chat and allow the MCP tool when requested.

šŸŽ„ Project Demo

The following demo shows the custom weather-mcp MCP tool being invoked through GitHub Copilot to retrieve and generate contextual weather information.

Weather MCP Demo

šŸ’¬ Example Usage

Ask Copilot:

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

Other examples:

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

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

Example information returned by the assistant includes:

  • Current temperature
  • Feels-like temperature
  • Humidity
  • Wind speed and direction
  • Cloud conditions
  • Weather summary
  • Air-quality information when available

šŸ” Security

Sensitive credentials such as API keys are stored in a local .env file.

The following files/directories are excluded from Git:

.env
chroma_db/
__pycache__/
.vscode/

Never commit real API keys to the repository.

šŸ“Œ What I Learned

Through this project, I gained hands-on experience with:

  • Building and exposing tools through Model Context Protocol (MCP)
  • Integrating external APIs with LLM-based applications
  • Implementing a RAG pipeline
  • Working with embeddings and vector databases
  • Using ChromaDB for contextual retrieval
  • Connecting LangChain with a hosted LLM
  • Integrating a custom MCP server with GitHub Copilot
  • Managing environment variables and API credentials securely

šŸ”® Future Improvements

  • Add multi-day weather forecasting
  • Add weather alerts and recommendations
  • Improve retrieval and contextual memory
  • Add additional weather and environmental data sources
  • Build a standalone web interface using Streamlit or FastAPI
  • Containerize the application using Docker

šŸ‘©ā€šŸ’» Author

Rudrani Gulhane

B.Tech Computer Science Engineering — Artificial Intelligence & Machine Learning

Interested in AI/ML, Generative AI, RAG, LLMs, AI Agents, and MCP-based applications.

šŸ“„ License

This project is intended for educational, portfolio, and experimental use.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured