Serves as the backend database for storing client information, legal document metadata, and extracted deadlines, utilizing the pgvector extension for semantic search operations.
Used for managed database and vector storage services, providing the infrastructure for semantic document search, indexing, and strategic data retrieval.
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., "@Multi-Agent RAG MCP ServerExtract all deadlines from the attached Spanish court notification."
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.
Multi-Agent RAG MCP Server
A comprehensive multi-agent Retrieval-Augmented Generation (RAG) system built on the Model Context Protocol (MCP), featuring specialized AI microagents for legal document processing, deadline extraction, and strategic analytics.
๐ฏ Overview
This project implements an interconnected agentic ecosystem using MCP servers as the foundation for coordinating specialized AI agents. The system is designed for legal tech applications, particularly document intelligence and deadline management.
โจ Features
Multi-Agent Architecture: Three specialized agents working in coordination
Vector Storage: Supabase with pgvector for semantic search
MCP Integration: Seamless integration with Claude Desktop
Legal Document Processing: Specialized for Spanish legal notifications
Strategic Analytics: Business intelligence and context analysis
Zero-Input Strategy: 75% automation, 25% strategic oversight
๐ค Agents
1. Deadline Agent
Extracts and manages deadlines from Spanish legal documents with high accuracy.
Capabilities:
Spanish legal text processing
Deadline extraction and categorization
Automated deadline tracking
Legal notification parsing
2. Document Classification Agent
Automatically categorizes and classifies legal documents.
Capabilities:
Multi-class document classification
Metadata extraction
Automated tagging
Document type recognition
3. SmartContext Analytics Agent
Provides strategic business intelligence and contextual analysis.
Capabilities:
Strategic analytics
Business context extraction
Cross-document insights
Trend analysis
๐๏ธ Architecture
rag-mcp-server/
โโโ src/
โ โโโ server.py # Main MCP server
โ โโโ agents/
โ โ โโโ deadline_agent.py
โ โ โโโ document_agent.py
โ โ โโโ smartcontext_agent.py
โ โโโ data_sources/
โโโ database/
โ โโโ schema.sql # Database schema
โโโ docs/ # Documentation
โโโ config/ # Configuration files
โโโ data/ # Data storage
โโโ tests/ # Test files๐ Quick Start
Prerequisites
Python 3.10+
Supabase account
Claude Desktop (for MCP integration)
PostgreSQL with pgvector extension
Installation
Clone the repository
git clone https://github.com/yourusername/rag-mcp-server.git
cd rag-mcp-serverCreate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies
pip install -r requirements.txtConfigure environment
cp .env.example .env
# Edit .env with your credentialsInitialize database
# Run the database schema (see docs for details)
psql -h your-supabase-host -U postgres -d your-database -f database/schema.sqlConfigure Claude Desktop Edit your Claude Desktop config file (
~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS):
{
"mcpServers": {
"rag-server": {
"command": "python",
"args": ["/Users/yourusername/rag-mcp-server/src/server.py"],
"env": {
"SUPABASE_URL": "your_supabase_url",
"SUPABASE_KEY": "your_supabase_key"
}
}
}
}Restart Claude Desktop
๐ ๏ธ Usage
The system can be used in two ways:
1. MCP Server (Claude Desktop Integration)
Once configured, the agents are available through Claude Desktop with the following tools:
Deadline Agent Tools
extract_deadlines- Extract deadlines from legal documentslist_deadlines- List all tracked deadlinessearch_deadlines- Search deadlines by criteria
Document Agent Tools
classify_document- Classify document typeindex_document- Add document to vector storesearch_documents- Semantic document search
SmartContext Agent Tools
analyze_context- Strategic context analysisextract_insights- Business intelligence extractiontrend_analysis- Cross-document trend analysis
2. REST API Server (Frontend Integration)
The system also provides a FastAPI REST API for frontend applications:
# Run REST API server (for frontend)
python src/api_server.pyThe API server runs on http://localhost:8000 with interactive documentation at http://localhost:8000/docs.
Key Features:
Client Management - Create and manage client records
Document Upload - Upload documents with automatic processing
Data Retrieval - Query documents, deadlines, and analyses per client
CORS Enabled - Ready for frontend integration
API Endpoints:
Client Management:
POST /api/clients- Create new clientGET /api/clients- List all clientsGET /api/clients/{client_id}- Get client detailsPUT /api/clients/{client_id}- Update clientDELETE /api/clients/{client_id}- Delete client (soft delete)
Document Operations:
POST /api/clients/{client_id}/documents- Upload and process documentGET /api/clients/{client_id}/documents- List client's documentsGET /api/clients/{client_id}/documents/stats- Document statistics
Deadline Management:
GET /api/clients/{client_id}/deadlines- Get client's deadlinesGET /api/clients/{client_id}/deadlines/stats- Deadline statistics
Strategic Analysis:
GET /api/clients/{client_id}/analysis- Get strategic analyses
Running Both Servers:
# Run MCP server for Claude Desktop (existing functionality)
python src/server.py
# Run REST API server for frontend (new functionality)
python src/api_server.pyBoth servers can run independently and use the same database.
๐ Database Schema
The system uses the following main tables:
clients- Client information and managementdocuments- Document metadata and classificationdeadline_extractions- Deadline extraction operationsdeadlines- Extracted deadline trackinganalyses- Strategic insights and analytics
Client Isolation:
All documents, deadlines, and analyses are associated with specific clients via client_id, enabling proper data isolation and multi-tenant support.
See database/schema.sql for complete schema details.
๐ Documentation
Comprehensive documentation is available in the docs/ folder:
Quick Start Guide - 30-minute setup from scratch
Architecture Guide - Complete system design and patterns
Troubleshooting Guide - Common issues and solutions
API Reference - Tool definitions and usage
๐ Security
This system implements three-layered security:
Authentication - User identity verification
Authorization - Access control and permissions
Encryption - Zero-knowledge encryption for sensitive data
Never commit your .env file - it contains sensitive credentials.
๐งช Testing
Run the test suite:
pytest tests/Test individual agents:
python test_deadline_extraction.py๐ค Contributing
This is a personal project, but suggestions and feedback are welcome! Please open an issue to discuss proposed changes.
๐ License
[Add your license here]
๐ Acknowledgments
Built with:
Anthropic Claude - AI capabilities
Model Context Protocol - Agent coordination
Supabase - Database and vector storage
pgvector - Vector similarity search
๐ Contact
[Add your contact information]
Status: Production-Ready
Version: 1.0
Last Updated: November 2024
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.