MCP-RAG: Modular RAG Pipeline using MCP & GroundX
LocalAbout MCP-RAG: Modular RAG Pipeline using MCP & GroundX
MCP-RAG is a modular RAG implementation using GroundX and OpenAI GPT-4, intended for teams building AI applications. It separates document ingestion, semantic search, and response generation into discoverable, callable tools.
Key features
- 01Ingest PDFs into GroundX
- 02Run semantic search with GroundX
- 03Generate answers with OpenAI GPT-4
- 04Render YAML prompts with Jinja2
- 05Modular tool design and discovery
Use cases
- 01Add PDF documents to a vector store
- 02Answer queries using document content
MCP support
The MCP server provides document-ingestion and search tools for clients to discover and invoke. GroundX performs search, while the OpenAI API generates responses.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEMCP-RAG: Modular RAG Pipeline using MCP & GroundX
A production-ready Retrieval-Augmented Generation setup
🚀 Overview
MCP-RAG is a modular, production-grade implementation of a Retrieval-Augmented Generation (RAG) system, powered by:
- 🧠 MCP (Model Context Protocol) for standardized tool orchestration
- 🔍 GroundX for semantic search, ingestion, and vector store operations
- 🤖 OpenAI GPT-4 for LLM-powered contextual response generation
It allows clean separation of responsibilities across ingestion, search, generation, and tool discovery — making it scalable, flexible, and enterprise-ready.
📌 Developed by Sujith Somanunnithan for teams building AI-driven applications with reusable components.
📦 Features
- 🔧 Modular Tool Design using MCP server interface
- 🧩 YAML-Based Prompt Templates with Jinja2 rendering
- 📂 PDF File Ingestion into GroundX vector store
- 🔍 Real-Time Semantic Search via GroundX Search Tool
- 🤝 Plug-and-Play API Integration for new tools and services
📁 Project Structure
mcp-rag/
├── server.py # MCP Server initialization
├── config.py # Environment and config management
├── ingestion.py # File ingestion tool logic
├── search.py # Search + LLM generation logic
├── prompts.yaml # Prompt template in Jinja2
├── models.py # Pydantic models for configs
├── .env # API keys (excluded from version control)
├── pyproject.toml # Project config for uv / MCP
├── README.md # This file
🧠 Architectural Flow
- User query arrives at the MCP server
- Server routes it to the Search Tool
- Search Tool queries GroundX API
- Snippets are rendered via YAML prompt
- OpenAI API generates final LLM response
🔄 All tools are discoverable and invocable via MCP dynamically.
🔑 Environment Setup
Create .env with your keys:
OPENAI_API_KEY=your-openai-key
GROUNDEX_API_KEY=your-groundx-key
Install using uv:
uv pip install -r pyproject.toml
⚙️ Usage
Start the server:
mcp dev server.py
Ingest a PDF:
mcp call ingest_documents --args '{"file_path": "data/sample.pdf"}'
Search with a query:
mcp call process_search_query --args '{"query": "What is explained in section 3?"}'
📌 Clean Separation of Concerns
| Role | Component |
|---|---|
| Tool discovery/invoke | MCP Server |
| Search execution | GroundX API |
| Response generation | OpenAI API |
| File upload | Ingest Tool (MCP) |
📚 License
This project is licensed under the MIT License.
👨💻 Author
Sujith Somanunnithan
Cloud & AI Architect | sujith.de
💬 Feedback & Contributions
Feel free to raise issues, pull requests, or connect with the author for improvements or extensions (like multi-file ingestion, RAG fallback chains, etc).
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.