Multi-Agent RAG MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/Tsarri/rag-mcp-server.git
cd rag-mcp-server
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "SUPABASE_URL=${SUPABASE_URL}" -e "SUPABASE_KEY=${SUPABASE_KEY}" rag-mcp-server -- python "<FULL_PATH_TO_RAG_MCP_SERVER>/dist/index.js"

Replace <FULL_PATH_TO_RAG_MCP_SERVER>/dist/index.js with the actual folder you prepared in step 1.

Required:SUPABASE_URLSUPABASE_KEY
README.md

A multi-agent RAG system for legal document processing and deadline management.

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

  1. Clone the repository
git clone https://github.com/yourusername/rag-mcp-server.git
cd rag-mcp-server
  1. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Configure environment
cp .env.example .env
# Edit .env with your credentials
  1. Initialize database
# Run the database schema (see docs for details)
psql -h your-supabase-host -U postgres -d your-database -f database/schema.sql
  1. Configure Claude Desktop Edit your Claude Desktop config file (~/Library/Application Support/Claude/claude_desktop_config.json on 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"
      }
    }
  }
}
  1. 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 documents
  • list_deadlines - List all tracked deadlines
  • search_deadlines - Search deadlines by criteria

Document Agent Tools

  • classify_document - Classify document type
  • index_document - Add document to vector store
  • search_documents - Semantic document search

SmartContext Agent Tools

  • analyze_context - Strategic context analysis
  • extract_insights - Business intelligence extraction
  • trend_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.py

The 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 client
  • GET /api/clients - List all clients
  • GET /api/clients/{client_id} - Get client details
  • PUT /api/clients/{client_id} - Update client
  • DELETE /api/clients/{client_id} - Delete client (soft delete)

Document Operations:

  • `P

Tools (9)

extract_deadlinesExtract deadlines from legal documents
list_deadlinesList all tracked deadlines
search_deadlinesSearch deadlines by criteria
classify_documentClassify document type
index_documentAdd document to vector store
search_documentsSemantic document search
analyze_contextStrategic context analysis
extract_insightsBusiness intelligence extraction
trend_analysisCross-document trend analysis

Environment Variables

SUPABASE_URLrequiredURL for the Supabase instance
SUPABASE_KEYrequiredAPI key for the Supabase instance

Configuration

claude_desktop_config.json
{"mcpServers": {"rag-server": {"command": "python", "args": ["/path/to/rag-mcp-server/src/server.py"], "env": {"SUPABASE_URL": "your_supabase_url", "SUPABASE_KEY": "your_supabase_key"}}}}

Try it

→Extract all upcoming deadlines from the uploaded Spanish legal notification.
→Classify the document type of the latest file and index it into the vector store.
→Perform a trend analysis on the recent legal documents to identify business risks.
→Search for all documents related to the current client and summarize the key insights.

Frequently Asked Questions

What are the key features of Multi-Agent RAG MCP Server?

Multi-agent architecture with specialized legal and analytical agents. Semantic document search powered by Supabase and pgvector. Automated extraction and tracking of deadlines from legal texts. Strategic business intelligence and cross-document trend analysis. FastAPI REST API support for frontend integration.

What can I use Multi-Agent RAG MCP Server for?

Automating the tracking of critical deadlines in Spanish legal notifications. Classifying and organizing large volumes of legal documents automatically. Generating strategic business insights from cross-document analysis. Building a legal-tech dashboard using the provided REST API.

How do I install Multi-Agent RAG MCP Server?

Install Multi-Agent RAG MCP Server by running: git clone https://github.com/Tsarri/rag-mcp-server.git && cd rag-mcp-server && pip install -r requirements.txt

What MCP clients work with Multi-Agent RAG MCP Server?

Multi-Agent RAG MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Multi-Agent RAG MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare