https://github.com/design4pro/mcp-rag-server
https://github.com/design4pro/mcp-rag-server
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/design4pro/mcp-rag-server
- Owner: design4pro
- License: mit
- Created: 2025-07-27T20:43:08.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T14:11:53.000Z (10 months ago)
- Last Synced: 2025-07-28T14:34:39.197Z (10 months ago)
- Language: Python
- Size: 896 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCP RAG Server
A comprehensive Retrieval-Augmented Generation (RAG) server built with the Model Context Protocol (MCP), featuring advanced memory management, session handling, AI reasoning capabilities, and multi-modal document processing.
## ๐ Features
- **Document Management**: Add, search, and manage documents with automatic chunking and embedding
- **Memory Integration**: Advanced memory context retrieval with multi-factor scoring and pattern analysis
- **Session Management**: User session tracking and comprehensive statistics
- **AI Reasoning**: Advanced reasoning capabilities including deductive, inductive, abductive, and chain-of-thought reasoning
- **Context Understanding**: Deep context analysis with entity extraction and relationship mapping
- **MCP Integration**: Full Model Context Protocol support with comprehensive tools and resources
- **Vector Search**: Powered by Qdrant vector database with advanced search capabilities
- **AI Integration**: Gemini API for embeddings and text generation
- **Self-hosted Memory**: Local mem0 service for conversation memory
- **Performance Optimization**: Optimized reasoning engine with benchmarking capabilities
## ๐ Project Status
**All Development Phases Completed** โ
| Phase | Name | Status | Progress |
| ----- | ------------------ | ----------- | -------- |
| 1 | Foundations | โ
Complete | 100% |
| 2 | RAG Core | โ
Complete | 100% |
| 3 | MCP Integration | โ
Complete | 100% |
| 4 | Memory Integration | โ
Complete | 100% |
| 5 | Advanced Features | โ
Complete | 100% |
| 6 | AI Reasoning | โ
Complete | 100% |
## ๐๏ธ Project Structure
```
mcp-rag/
โโโ data/ # All application data
โ โโโ mem0_data/ # Memory storage
โ โโโ session_data/ # Session storage
โ โโโ test_mem0_data/ # Test memory data
โโโ docs/ # Comprehensive project documentation
โ โโโ 00-overview/ # Project overview and documentation index
โ โโโ 01-architecture/ # System architecture documentation
โ โโโ 02-installation/ # Installation and setup guides
โ โโโ 03-api/ # API reference documentation
โ โโโ 04-development/ # Development phases and guides
โ โโโ 05-troubleshooting/ # Troubleshooting and support
โโโ src/ # Source code
โ โโโ mcp_rag_server/ # Main application package
โ โโโ services/ # Core services (RAG, Memory, AI, etc.)
โ โโโ tools/ # MCP tools implementation
โ โโโ resources/ # MCP resources implementation
โ โโโ validation.py # Data validation schemas
โโโ tests/ # Comprehensive test suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โโโ docker/ # Docker configuration
โโโ deployment/ # Deployment scripts and configurations
โโโ scripts/ # Management scripts
โโโ examples/ # Usage examples and demonstrations
```
## ๐ Data Organization
All application data is organized in the `data/` folder:
- **`data/mem0_data/`**: Stores conversation memories and user data
- **`data/session_data/`**: Stores user session information and statistics
- **`data/test_mem0_data/`**: Test-specific memory data for development
This centralized approach ensures clean project organization and easy data management.
## โก Quick Start
### Prerequisites
- Python 3.11+
- Docker (for Qdrant)
- Gemini API key
### 1. Setup
```bash
git clone
cd mcp-rag
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your Gemini API key
```
### 2. Start Services
```bash
# Start Qdrant
docker run -d -p 6333:6333 -p 6334:6334 qdrant/qdrant:latest
# Option 1: Use Cursor IDE (Recommended)
# Enable RAG tools in Cursor IDE - containers start automatically
# Option 2: Manual Docker run
docker run -i --rm \
-p 8001:8000 \
-e MCP_GEMINI_API_KEY=your_api_key \
-e MCP_QDRANT_URL=http://host.docker.internal:6333 \
ghcr.io/design4pro/mcp-rag-server:latest
# Option 3: Use scripts
./scripts/manage_server.sh start
```
### 3. Verify Installation
```bash
# Health check
./scripts/manage_server.sh health
# Check status
./scripts/manage_server.sh status
```
## ๐ง Development
```bash
# Run tests
python -m pytest tests/
# Run tests with coverage
python -m pytest tests/ --cov=src/mcp_rag_server
# Check logs
./scripts/manage_server.sh logs
# Stop server
./scripts/manage_server.sh stop
```
## ๐ Documentation
Comprehensive documentation is available in the `docs/` directory:
- **Documentation Index**: [[docs/00-overview/documentation-index.md]]
- **Project Overview**: [[docs/00-overview/project-overview.md]]
- **System Architecture**: [[docs/01-architecture/system-architecture.md]]
- **Installation Guide**: [[docs/02-installation/installation-guide.md]]
- **Cursor IDE Setup**: [[docs/02-installation/cursor-ide-automatic-container-management|Cursor IDE Automatic Container Management]]
- **Docker Registry**: [[docs/02-installation/docker-registry-publishing-guide|Docker Registry Publishing Guide]]
- **API Reference**: [[docs/03-api/api-reference.md]]
- **Development Phases**: [[docs/04-development/phases/development-phases-overview.md]]
- **Troubleshooting**: [[docs/05-troubleshooting/troubleshooting-guide.md]]
## ๐งช Testing
The project includes comprehensive test coverage:
- **Unit Tests**: 183 tests covering all core functionality
- **Integration Tests**: Complete MCP tool integration testing
- **Performance Tests**: Benchmarking and performance validation
- **Error Handling**: Comprehensive error scenario testing
Run tests with:
```bash
python -m pytest tests/ -v
```
## ๐ Advanced Features
### AI Reasoning Capabilities
- **Deductive Reasoning**: Logical inference from premises to conclusions
- **Inductive Reasoning**: Pattern-based generalizations from observations
- **Abductive Reasoning**: Hypothesis generation from observations
- **Chain-of-Thought Reasoning**: Multi-step reasoning with intermediate conclusions
- **Multi-Hop Reasoning**: Iterative reasoning across multiple contexts
### Memory Management
- **Semantic Memory Search**: Advanced semantic search capabilities
- **Memory Clustering**: Automatic memory organization and clustering
- **Pattern Analysis**: Memory pattern identification and analysis
- **Context Retrieval**: Enhanced memory context with multi-factor scoring
### Session Management
- **User Session Tracking**: Comprehensive session management
- **Session Statistics**: Detailed usage analytics and statistics
- **Session Persistence**: Reliable session data storage
- **Cleanup Management**: Automatic session cleanup and maintenance
## ๐ค Contributing
1. Follow the phased development approach
2. Update documentation after changes
3. Test all deployment methods
4. Use English for all code and documentation
5. Ensure all tests pass before submitting changes
## ๐ License
MIT License - see LICENSE file for details.
## ๐ Support
For support and troubleshooting:
1. Check the troubleshooting guide: [[docs/05-troubleshooting/troubleshooting-guide.md]]
2. Review the system architecture: [[docs/01-architecture/system-architecture.md]]
3. Consult the API reference: [[docs/03-api/api-reference.md]]
## ๐ Version History
- **v1.0.0**: Complete implementation with all phases finished
- Advanced AI reasoning capabilities
- Comprehensive memory management
- Full MCP integration
- Performance optimization
- Complete test coverage
---
**Project Status**: โ
Production Ready
**Last Updated**: 2025-01-25
**Version**: 1.0.0