Provides integration with Google Gemini for embeddings and as an optional LLM provider for the RAG system, allowing the server to generate responses from document queries.
Powers the client UI interface for the MCP server, enabling users to interact with the chatbot and access the RAG and weather tools.
Enables using Ollama models (specifically qwen3:1.7b and nomic-embed-text) as LLM providers for orchestration and embeddings in the RAG system.
RAG MCP Application
This project combines a Retrieval-Augmented Generation (RAG) system with the Model Context Protocol (MCP) to create a powerful, modular AI application. It features a dedicated MCP server (rag_server.py
) that exposes RAG capabilities and a weather tool, and a client UI (client_ui.py
) that uses an orchestrator LLM to interact with these tools.
Project Structure
rag-mcp-app/
data/
: Directory for your PDF documents to be indexed by the RAG system.chroma_db/
: Directory where the ChromaDB vector store will be persisted.rag_server.py
: The MCP server that hosts the RAG and weather tools.client_ui.py
: The client application with a Gradio UI that orchestrates LLM calls and tool usage.ingest.py
: A script to load and index your PDF documents into the vector database.requirements.txt
: Lists all project dependencies.README.md
: This file.
Getting Started
Prerequisites
- Python 3.11+: Ensure you have Python installed.
- Ollama: Install Ollama from ollama.ai and ensure it's running.
- Ollama Model (
qwen3:1.7b
): Pull theqwen3:1.7b
model for the client's orchestrator LLM: - Ollama Embedding Model (
nomic-embed-text
): If you plan to use Ollama for embeddings (though Gemini is default), pull this model: - Google API Key: Set your
GOOGLE_API_KEY
as an environment variable (e.g., in a.env
file). This is required for Google Gemini embeddings and the Gemini LLM.
Installation
- Clone the repository (if you haven't already):(Note: If you are following along with the development process, you would have already created this directory and copied files into it.)
- Create and Activate a Virtual Environment:
- Install Dependencies:
Data Preparation
- Populate the
data/
directory: Place your PDF documents into therag-mcp-app/data/
directory. - Run the Ingestion Script: This needs to be run before you start the RAG server for the first time, or whenever you add new documents to the
data/
directory.
Running the Application
You will need to run two processes: the MCP server and the client UI.
1. Start the MCP Server:
Open a new terminal, activate your virtual environment, and run:
This will start the MCP server, making the get_weather
and get_rag_response
tools available.
2. Start the Client UI:
Open another terminal, activate your virtual environment, and run:
This command connects the client UI to the MCP server and specifies the orchestrator LLM.
The client UI will launch in your browser. You can then interact with the chatbot, asking questions that might trigger the RAG system or the weather tool.
Example Usage
- Ask a question about your documents: "What is the main topic of the documents?"
- Ask about the weather: "What's the weather like in London?"
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A Model Context Protocol server that exposes Retrieval-Augmented Generation capabilities and a weather tool, allowing clients to interact with document knowledge bases and retrieve weather information.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that provides real-time weather information and 5-day forecasts to AI assistants, supporting multiple languages and flexible units.Last updated -35TypeScript
- AsecurityAlicenseAqualityA Model Context Protocol server that provides weather information and forecasts based on user location or address input.Last updated -6121TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that provides real-time weather data and forecasts for any city.Last updated -17ISC License
- AsecurityFlicenseAqualityA Model Context Protocol server that provides real-time weather data to AI clients through Server-Sent Events, enabling them to fetch current weather conditions, multi-day forecasts, and location-based weather information.Last updated -5Python