Skip to main content
Glama

Weather RAG MCP Server

An MCP server that gives AI assistants a get_weather tool. It fetches live weather and air-quality data for a location, indexes it into a local vector store, retrieves the relevant context, and hands it to an LLM to produce a clear, hallucination-free weather report.

How it works

  1. Fetch — current weather and air pollution data for a location are pulled from the OpenWeatherMap API.

  2. Document — the raw JSON is turned into a structured, human-readable weather document.

  3. Index — the document is embedded (via a local Hugging Face sentence-transformer model) and stored in a Chroma vector store, replacing any previous entry.

  4. Retrieve — the most relevant chunks are pulled back out via a retriever.

  5. Generate — the retrieved context is passed to a Groq-hosted LLM, which is prompted to report only what's in the context and say so if something is missing.

This round-trip through a vector store is overkill for a single document, but it keeps the project structured as a genuine RAG pipeline that's easy to extend (e.g. multi-location history, forecasts, caching).

Related MCP server: OpenWeather MCP Server

Project structure

.
├── server.py                # MCP server entrypoint, exposes the get_weather tool
├── config.py                # Loads and validates environment variables
├── services/
│   └── weather_service.py   # Orchestrates fetch -> index -> retrieve -> generate
├── rag/
│   ├── embedding.py         # HuggingFace sentence-transformer embedding model
│   ├── vector_store.py      # Chroma vector store wrapper
│   ├── retriever.py         # Retrieves relevant context from the vector store
│   └── llm.py                # Groq LLM + prompt for report generation
└── utils/
    └── parser.py             # Builds the weather document from API responses

Prerequisites

Setup

  1. Clone the repo and install dependencies:

    git clone <your-repo-url>
    cd Weather_Pred_MCP
    pip install -r requirements.txt
  2. Create your environment file from the template and fill in your keys:

    cp .env.example .env

    Variable

    Required

    Default

    Description

    OPENWEATHER_API_KEY

    Yes

    —

    API key for OpenWeatherMap

    GROQ_API_KEY

    Yes

    —

    API key for Groq

    GROQ_MODEL

    No

    openai/gpt-oss-120b

    Groq model used for report generation

    EMBEDDING_MODEL

    No

    sentence-transformers/all-MiniLM-L6-v2

    Hugging Face embedding model

    CHROMA_DB_DIR

    No

    ./chroma_db

    Directory for the local Chroma vector store

Running the server

python server.py

This starts the MCP server over stdio.

Using it with an MCP client

A sample client config is included at .vscode/mcp.json:

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

Point any MCP-compatible client (VS Code, Claude Desktop, etc.) at this config, then call the get_weather tool with a location name (e.g. "Mumbai") to get a generated weather report.

Tech stack

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time weather information and forecasts, connecting AI assistants with live weather data for current conditions and multi-day forecasts for any location worldwide.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides real-time weather data and forecasts for locations worldwide using the OpenWeatherMap API. It enables AI assistants to retrieve current conditions, temperature, and forecasts through a simple tool-based interface.
      MIT
    • F
      license
      D
      quality
      D
      maintenance
      Provides real-time weather information, enabling AI assistants to retrieve current temperature and weather conditions for any location worldwide.
      1
      -