MCP-RAG: Model Context Protocol with RAG π
A powerful and efficient RAG (Retrieval-Augmented Generation) implementation using GroundX and OpenAI, built with Modern Context Processing (MCP).
π Features
- Advanced RAG Implementation: Utilizes GroundX for high-accuracy document retrieval
- Model Context Protocol: Seamless integration with MCP for enhanced context handling
- Type-Safe: Built with Pydantic for robust type checking and validation
- Flexible Configuration: Easy-to-customize settings through environment variables
- Document Ingestion: Support for PDF document ingestion and processing
- Intelligent Search: Semantic search capabilities with scoring
π οΈ Prerequisites
- Python 3.12 or higher
- OpenAI API key
- GroundX API key
- MCP CLI tools
π¦ Installation
- Clone the repository:
git clone <repository-url>
cd mcp-rag
- Create and activate a virtual environment:
uv sync
source .venv/bin/activate # On Windows, use `.venvScriptsactivate`
βοΈ Configuration
- Copy the example environment file:
cp .env.example .env
- Configure your environment variables in
.env:
GROUNDX_API_KEY="your-groundx-api-key"
OPENAI_API_KEY="your-openai-api-key"
BUCKET_ID="your-bucket-id"
π Usage
Starting the Server
Run the inspect server using:
mcp dev server.py
Document Ingestion
To ingest new documents:
from server import ingest_documents
result = ingest_documents("path/to/your/document.pdf")
print(result)
Performing Searches
Basic search query:
from server import process_search_query
response = process_search_query("your search query here")
print(f"Query: {response.query}")
print(f"Score: {response.score}")
print(f"Result: {response.result}")
With custom configuration:
from server import process_search_query, SearchConfig
config = SearchConfig(
completion_model="gpt-4",
bucket_id="custom-bucket-id"
)
response = process_search_query("your query", config)
π Dependencies
groundx(β₯2.3.0): Core RAG functionalityopenai(β₯1.75.0): OpenAI API integrationmcp[cli](β₯1.6.0): Modern Context Processing toolsipykernel(β₯6.29.5): Jupyter notebook support
π Security
- Never commit your
.envfile containing API keys - Use environment variables for all sensitive information
- Regularly rotate your API keys
- Monitor API usage for any unauthorized access
π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MCP-RAG Server
Project Details
- sourangshupal/mcp-rag
- Last Updated: 4/20/2025
Recomended MCP Servers
MCP server for interacting with YNAB.
Model Context Protocol (MCP) server that provides tools for accessing the Korea Tourism API
Model Context Protocol Servers
MCP web research server (give Claude real-time info from the web)
A Python-based Model Context Protocol (MCP) tool for Kubernetes clusters that exposes a comprehensive API to retrieve cluster...
Langflow is a low-code app builder for RAG and multi-agent AI applications. Itβs Python-based and agnostic to any...
An MCP tool that provides AI with the ability to compress and decompress local files.
Verify that any MCP server is running the intended and untampered code via hardware attestation.
This MCP plugin integrates with the Spheron SDK to provide compute deployment capabilities directly through Claude.





