Legal Document RAG Server
БесплатноНе проверенEnables semantic and keyword search over legal documents, conflict detection, and document overview, supporting Indonesian and English texts.
Описание
Enables semantic and keyword search over legal documents, conflict detection, and document overview, supporting Indonesian and English texts.
README
Fully local, offline RAG system for legal documents (Indonesian + English).
Built on MCP SDK, ChromaDB, SQLite FTS5, and multilingual-e5-large.
Requirements
- Python ≥ 3.11
- Tesseract OCR with Indonesian language pack:
# Ubuntu / Debian sudo apt install tesseract-ocr tesseract-ocr-ind # macOS brew install tesseract brew install tesseract-lang # includes ind
Setup
# 1. Clone / copy the project
cd legal_rag_mcp
# 2. Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. (First run) The multilingual-e5-large model (~2.2 GB) will be
# downloaded automatically to ~/.cache/huggingface/hub
# All subsequent runs are fully offline.
Usage
Drop documents in the watch folder
legal_rag_mcp/raw_legal_docs/
├── kontrak_jual_beli.pdf
├── perjanjian_kerjasama.docx
├── schedule_of_fees.xlsx
└── scanned_addendum.png
Launch the MCP server
# Development mode (with MCP Inspector UI)
mcp dev mcp_server/server.py
# Production mode (stdio, for Claude Desktop or any MCP client)
python mcp_server/server.py
Claude Desktop configuration (claude_desktop_config.json)
{
"mcpServers": {
"legal-rag": {
"command": "python",
"args": ["/absolute/path/to/legal_rag_mcp/mcp_server/server.py"]
}
}
}
Tools Exposed
| Tool | Purpose |
|---|---|
search_clauses |
Hybrid semantic + keyword search |
find_conflicts |
Cross-document conflict detection (two-zone thresholds) |
get_document_overview |
Document metadata + clause outline |
retrieve_context |
Read a clause in full surrounding context |
list_documents |
Inventory of all ingested files |
Conflict Detection Thresholds
| Zone | Cosine Similarity | Interpretation |
|---|---|---|
| Near-duplicate | > 0.88 | Same clause — skip |
| HIGH suspicion | 0.75 – 0.88 | Same topic, different obligations |
| MODERATE suspicion | 0.60 – 0.75 | Related topic, may diverge |
| Unrelated | < 0.60 | Different provisions |
Thresholds are configurable in config.py.
Re-ingestion (Diff-Based)
When a file in raw_legal_docs/ is modified:
- File-level SHA-256 hash is compared against the stored hash.
- If unchanged → skip entirely.
- If changed → re-chunk the document, compute per-chunk hashes.
- Only changed or new chunks are re-embedded and upserted.
- Orphaned chunks (present in old version, absent in new) are deleted.
- Full re-embedding is never triggered by a partial change.
Установка Legal Document RAG Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/alifindrar/doc-scraperFAQ
Legal Document RAG Server MCP бесплатный?
Да, Legal Document RAG Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Legal Document RAG Server?
Нет, Legal Document RAG Server работает без API-ключей и переменных окружения.
Legal Document RAG Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Legal Document RAG Server в Claude Desktop, Claude Code или Cursor?
Открой Legal Document RAG Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Legal Document RAG Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
