RAG MCP Server
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.
README
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.7bmodel for the client's orchestrator LLM:ollama pull qwen3:1.7b - Ollama Embedding Model (
nomic-embed-text): If you plan to use Ollama for embeddings (though Gemini is default), pull this model:ollama pull nomic-embed-text - Google API Key: Set your
GOOGLE_API_KEYas an environment variable (e.g., in a.envfile). This is required for Google Gemini embeddings and the Gemini LLM.
Installation
-
Clone the repository (if you haven't already):
git clone <your-repo-url> cd rag-mcp-app(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:
python -m venv venv # On Windows: .\venv\Scripts\activate # On macOS/Linux: # source venv/bin/activate -
Install Dependencies:
uv pip install -r requirements.txt
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.python ingest.py
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:
python rag_server.py --llm-provider ollama
# Or to use Gemini for RAG LLM:
# python rag_server.py --llm-provider gemini
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:
python client_ui.py --mcp-server rag_server.py --model qwen3:1.7b
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?"
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.