sujithadr/MCP-RAG
If you are the rightful owner of MCP-RAG and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP-RAG is a modular, production-grade implementation of a Retrieval-Augmented Generation (RAG) system.
MCP-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 .
šØāš» 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).