A Simple MCP RAG with GroundX
Project description
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 `.venv\Scripts\activate`
⚙️ 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iflow_mcp_mcp_rag-0.1.0.tar.gz
(392.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iflow_mcp_mcp_rag-0.1.0.tar.gz.
File metadata
- Download URL: iflow_mcp_mcp_rag-0.1.0.tar.gz
- Upload date:
- Size: 392.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f7b5cf0af3e78216d8e0825e904eb0d0a4d4617f901a3f9b627006cd3342069
|
|
| MD5 |
1e3d0d88639946b92704208cd574636b
|
|
| BLAKE2b-256 |
1d690a9c70d1fbedeb664f6a6e8b59b96263c250d9e9ab35d84914aaaa419a54
|
File details
Details for the file iflow_mcp_mcp_rag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_mcp_rag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00497a41d3f9826b349ac05f8fc6c86176c830532a5f01f00dff1af125e7dbb4
|
|
| MD5 |
3b06f85bc5b7b34f68374d3f0e8b7cbf
|
|
| BLAKE2b-256 |
5eb1282fcecb9cc6d0fd53ebb130102fc7c1b2a43742e59e83351747bfb03cb8
|