Provides function calling capabilities for Gemini to search document databases and retrieve relevant information from PDF collections using natural language queries
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RAG Database MCP Serversearch my documents for information about renewable energy policies"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RAG Database with Model Context Protocol (MCP) Server
A comprehensive Retrieval-Augmented Generation (RAG) system that integrates with AI assistants like Claude, ChatGPT, and Gemini through the Model Context Protocol (MCP). This system allows you to ingest PDF documents, create vector embeddings, and query your document collection using natural language.
π― Overview
This RAG system consists of three main components:
Document Ingestion Pipeline - Extracts text from PDFs and creates vector embeddings
Vector Database - Local ChromaDB storage with persistent file-based storage
MCP Server - Exposes the RAG database through standardized tools for AI assistants
Key Features
π PDF Document Processing - Automatic text extraction and chunking
π Semantic Search - Vector similarity search using embeddings
π€ AI Assistant Integration - Works with Claude Desktop, ChatGPT, and other MCP-compatible clients
πΎ Local Storage - All data stored locally, no external dependencies
β‘ Fast Performance - Persistent API server keeps models loaded
π§ Easy Setup - Automated installation and configuration scripts
π Quick Start
Prerequisites
Python 3.8+
4GB+ RAM (for embedding models)
macOS, Linux, or Windows
1. Initial Setup
2. Initialize Database
3. Add Documents
4. Start the System
π§ AI Assistant Integration
Claude Desktop Integration
Claude Desktop uses the MCP protocol to connect to your RAG database.
Configuration
Configure Claude Desktop MCP Settings
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or equivalent on other platforms:
Start Required Services
Restart Claude Desktop
The MCP server will automatically start when Claude Desktop launches.
Usage in Claude Desktop
Once configured, you can ask Claude to search your documents:
ChatGPT Integration
ChatGPT can access your RAG system through API calls or custom GPT actions.
Option 1: API Integration
Option 2: Custom GPT Actions
Create a custom GPT with these action definitions:
Google Gemini Integration
Gemini can integrate through function calling or extensions.
Function Calling Setup
π System Architecture
π οΈ Detailed Setup Guide
Manual Installation
If the automated setup doesn't work, follow these manual steps:
Environment Configuration
Create a .env file for custom configuration:
π Usage Examples
Command Line Usage
API Usage
MCP Tools Available
When connected through MCP, these tools are available:
search_documents- Search the document databaseget_collection_stats- Get database statisticshealth_check- Check system health
βοΈ Configuration Options
Database Configuration
API Server Configuration
Document Ingestion Options
π Troubleshooting
Common Issues
1. "ChromaDB directory not found"
2. "RAG API returned status 500"
3. "Module not found" errors
4. MCP connection issues
Performance Optimization
For better performance:
Use GPU acceleration (if available):
# Install CUDA-compatible PyTorch pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118Increase chunk size for longer documents:
python ingest_pdfs.py --chunk-size 1500Keep API server running to avoid model loading delays
π System Monitoring
Health Checks
Performance Metrics
First search: ~7 seconds (includes model loading)
Subsequent searches: ~30ms
Memory usage: ~2-4GB (with models loaded)
Storage: ~1MB per 100 pages of documents
π Security Considerations
Local storage only - No data sent to external services
Network access - API server runs on localhost by default
File permissions - Ensure proper access controls on document directory
API security - Consider authentication for production deployments
π€ Contributing
Fork the repository
Create a feature branch
Make your changes
Test thoroughly
Submit a pull request
π License
[Specify your license here]
π Support
For issues and questions:
Check the troubleshooting section above
Review the logs for error messages
Create an issue in the repository
Include system information and error logs
π Updates and Maintenance
Updating the System
Backup and Restore
Note: This system is designed for local use and development. For production deployments, consider additional security measures, monitoring, and scaling configurations.