legal_mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Legal MCP - RAG System for Polish Legal Documents
An implementation of a RAG (Retrieval-Augmented Generation) system utilizing the Model Context Protocol (MCP). This project demonstrates a modular architecture for legal document processing and retrieval using ChromaDB as a vector store and Ollama for local LLM inference.
π Project Structure
The project is organized into several microservices:
mcp_server/: The core MCP server that exposes semantic search tools over the vector database. This is the primary service β connect any MCP-compatible LLM client directly to it.ingestion/: REST API service for fetching and embedding documents from the SAOS (court judgments) and ELI (legislative acts) APIs into ChromaDB.frontend/: Optional local chat UI backed by Ollama and the MCP server.data/: Local storage for the ChromaDB database and other persistent assets.scripts/: Utility scripts for ingestion and maintenance.
Related MCP server: SAOS MCP
π Getting Started
Prerequisites
Docker & Docker Compose: Required for containerized deployment.
Python 3.10+: For local development.
Ollama: Installed locally, or use the integrated service in
docker-compose.yml.NVIDIA Container Toolkit: (Optional) For GPU acceleration within Docker.
Environment Setup
Clone the repository:
git clone https://github.com/barwojcik/legal_mcp.git cd legal_mcpCopy and review the environment variables:
cp .env.example .env # Edit .env if you want to use OpenAI/Google embeddings instead of Ollama
Running with Docker Compose
Spin up ChromaDB, Ollama, the MCP server, and the ingestion service:
docker compose up -d chroma ollama mcp-server ingestionTo also run the optional frontend:
docker compose up -dServices will be available at:
ChromaDB:
http://localhost:8000Ollama:
http://localhost:11434MCP Server:
http://localhost:8001/mcpIngestion API:
http://localhost:8002Frontend (optional):
http://localhost:8003
Populate the database
bash scripts/ingest_saso.shThis fetches one page (20 judgments) from the SAOS API and embeds them into ChromaDB. See scripts/ingest_saso.sh and the Ingestion API docs for more options.
π Connecting a Commercial LLM
The MCP server speaks the Model Context Protocol over HTTP/SSE. Once the stack is running, point your LLM client at http://localhost:8001/mcp.
Claude Desktop
Add the following to your claude_desktop_config.json
(usually at ~/Library/Application Support/Claude/claude_desktop_config.json on macOS
or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"legal": {
"url": "http://localhost:8001/mcp",
"type": "http"
}
}
}Cursor / Zed / other MCP clients
Add an MCP server entry pointing to http://localhost:8001/mcp. Refer to your client's documentation for the exact configuration format.
Once connected, the LLM will have access to 14 tools for searching and retrieving Polish court judgments and legislative acts.
π Ingestion API
The ingestion service exposes a REST API at http://localhost:8002.
Ingest SAOS court judgments:
curl -X POST http://localhost:8002/update \
-H "Content-Type: application/json" \
-d '{"n_pages": 1, "page_size": 20}'Ingest ELI legislative acts:
curl -X POST http://localhost:8002/eli-update \
-H "Content-Type: application/json" \
-d '{"n_pages": 1, "page_size": 20}'π Development
Linting and Type Checking
# Run ruff
ruff check . --fix
# Run mypy
mypy .Pre-commit Hooks
pre-commit installβ License
This project is licensed under the Apache-2.0 licence.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Semantic search over Polish law and case law, citing the exact in-force article.
Polish statutes (Dziennik Ustaw, ELI) and court rulings (SAOS) for AI agents. Runs on Apify.
Slovak court decisions as MCP tools. 12,000+ decisions, GDPR-compliant, pseudonymized, SLA-backed.
Public Indian legal search MCP for Roop judgments, statutes, and corpus grounding.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI-powered legal research and analysis of Polish legal acts from the Sejm API. Provides comprehensive search, document retrieval, metadata analysis, and content access for legal documents from Dziennik Ustaw and Monitor Polski.1323MIT
- AlicenseAqualityCmaintenanceProvides access to Polish court judgments from the SAOS database. Enables search and retrieval of judgments with full-text search, filtering, and detailed case information.320 npm1Apache 2.0
- AlicenseNot gradedqualityFmaintenanceMCP server providing access to Polish law statutes, provisions, case law, and EU law integrations, enabling natural language legal research, citation validation, and cross-referencing.52 npm7Apache 2.0
- AlicenseNot gradedqualityBmaintenanceBridges any MCP client to the Sudska Praksa Semantic Search of Serbian Case Law documents, enabling natural-language queries of legal cases.BSD 3-Clause