Rechtspraak MCP Server
MCP server for searching and analyzing Dutch case law with advanced search, faceted filtering, and citation analysis.
README
Rechtspraak MCP Server
MCP (Model Context Protocol) server for searching and analyzing Dutch case law from rechtspraak.nl. Provides advanced search capabilities with query expansion, legal synonyms, faceting, and citation analysis.
Table of Contents
Features
🚀 MCP Server
- Advanced Search: Full-text search with query expansion and Dutch legal synonyms
- Faceted Search: Filter by court, legal area, date range, and procedure type
- Citation Analysis: Extract and analyze case citations (incoming and outgoing)
- Similar Cases: Find similar cases using MoreLikeThis algorithm
- Legal Article Search: Search cases by specific legal articles
- Trend Analysis: Analyze temporal trends in case law
- Query Expansion: Automatic expansion with legal terms and synonyms
- Rate Limiting & Caching: Built-in governance layer for production use
📥 Data Import
- Fetch case law XML from rechtspraak.nl feeds
- Extract links and download case files
- Automated batch processing
📊 Indexing
- Parse XML documents with structured sections
- Enrich with metadata (court types, legal domains, procedures)
- Full-text indexing in Solr
- Schema management and validation
Architecture
src/
├── mcp/ # MCP server (main feature)
│ ├── mcp_server.py # MCP server implementation
│ ├── mcp_schemas.py # Pydantic schemas for all tools
│ ├── solr_adapter.py # Solr query adapter with advanced features
│ ├── governance.py # Rate limiting & caching
│ ├── legal_synonyms.py # Dutch legal synonyms expansion
│ └── reference_data.py # Court/procedure reference data
│
├── importer/ # Data import from rechtspraak.nl
│ ├── extract_links.py
│ ├── fetch_link_files.py
│ └── fetch_content.py
│
├── indexing/ # XML parsing and Solr indexing
│ ├── xml_parser.py
│ ├── solr_indexer.py
│ ├── solr_setup.py
│ └── reindex_all.py
│
├── cli.py # CLI for indexing
└── config.py # Configuration
Installation
Prerequisites
- Python 3.13+
- uv (Python package manager)
- Docker & Docker Compose (for Solr)
Setup
- Clone the repository:
git clone <repository-url>
cd rechtspraak-solr
- Start Solr with Docker:
docker-compose up -d solr
- Install dependencies:
uv sync
- Configure environment variables (create
.envfrom.env.example):
cp .env.example .env
- Setup Solr collection and schema:
uv run rechtspraak-setup
Usage
Interactive CLI
Run the interactive menu for all operations:
python main.py
Or use direct commands:
# Data pipeline
python main.py fetch-links 2023-01-01 2023-12-31
python main.py extract-links 2023-01-01 2023-12-31
python main.py fetch-content
# Indexing
python main.py reindex # Full reindex (delete + setup + index)
python main.py index # Index data only
python main.py fix-schema # Configure schema only
# MCP server
python main.py mcp # Start MCP server
python main.py test-mcp # Test connection
# Utilities
python main.py health # System health check
python main.py test-reference # Test reference data
MCP Server
The MCP server supports two modes:
- Local Mode (stdio): For Claude Desktop/Code running on your machine
- HTTP Mode (SSE): For remote access via API
Local Mode - Configuration for Claude Desktop
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"rechtspraak": {
"command": "uv",
"args": [
"--directory",
"/path/to/rechtspraak-solr",
"run",
"rechtspraak-mcp"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr",
"SOLR_COLLECTION": "rechtspraak"
}
}
}
}
Local Mode - Configuration for Claude Code
Add to your Claude Code config (.claude/settings.local.json in project):
{
"mcp": {
"servers": {
"rechtspraak": {
"command": "uv",
"args": [
"--directory",
"/path/to/rechtspraak-solr",
"run",
"rechtspraak-mcp"
],
"env": {
"SOLR_URL": "http://localhost:8983/solr",
"SOLR_COLLECTION": "rechtspraak"
}
}
}
}
}
HTTP Mode - Remote Access
For production deployment with remote access:
- Start HTTP server:
docker-compose up -d
- Configure nginx (see
config/nginx.conffor complete example):
location /sse {
proxy_pass http://127.0.0.1:8000/sse;
proxy_http_version 1.1;
proxy_set_header Connection '';
proxy_buffering off;
}
- Security: Set
MCP_API_KEYenvironment variable in your.envfile
Connecting to Remote MCP Servers
Claude Desktop/Code only supports stdio transport natively, not SSE/HTTP. To connect to remote MCP servers, use the included mcp-sse-client.js bridge client:
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"rechtspraak": {
"command": "node",
"args": [
"/path/to/rechtspraak-solr/mcp-sse-client.js"
],
"env": {
"BASE_URL": "https://rechtspraak-nl-mcp.knowably.ai",
"SSE_PATH": "/sse",
"API_KEY": "your-api-key-here"
}
}
}
}
Optional environment variables for mcp-sse-client.js:
CLIENT_NAME- Custom client name (default: "mcp-sse-client")VERBOSE- Enable detailed logging (set to "true")MAX_RETRIES- Max connection attempts (default: 3)RETRY_DELAY_MS- Delay between retries in milliseconds (default: 2000)CONNECTION_TIMEOUT_MS- Connection timeout in milliseconds (default: 30000)
The bridge client acts as a local stdio process that Claude can communicate with, while internally translating requests to SSE/HTTP for the remote server. It includes automatic reconnection, configurable timeouts, and graceful error handling
Available MCP Tools
The server provides the following tools:
cases_search- Search cases with filters and facetingcases_get_by_ecli- Get specific case by ECLI identifiercases_expand_query- Expand query with legal synonymscases_highlight_passages- Extract relevant passages from a casecases_rerank- Rerank cases by relevancecases_get_similar- Find similar casescases_search_by_article- Search by legal articlecases_validate_ecli- Validate ECLI formatcases_bulk_get- Batch retrieve multiple casescases_analyze_trend- Analyze temporal trendscases_get_statistics- Get comprehensive statisticscases_get_court_stats- Compare courtscases_get_citations- Extract citationscases_compare- Compare multiple casescases_extract_entities- Extract legal entitiessystem_health- Check system health
Direct Entry Points
You can also use the entry points directly:
# Full reindex
uv run rechtspraak-reindex
# Index specific directory
uv run rechtspraak-index --data-dir ./data
# Setup collection and schema
uv run rechtspraak-setup
# Start MCP server
uv run rechtspraak-mcp
Development
Project Structure
- MCP Server: Main feature providing search API via MCP protocol
- Data Importer: Tools to fetch case law from rechtspraak.nl
- Indexing: XML parsing and Solr indexing with enrichment
- CLI: Command-line tools for management tasks
Testing
# Check MCP server
uv run rechtspraak-mcp
# Test indexing
uv run rechtspraak-index --data-dir ./test-data --verbose
Example Queries
Once connected to an MCP client (Claude Desktop/Code), you can ask:
- "Search for cases about 'aansprakelijkheid' in the last 5 years"
- "Find cases citing ECLI:NL:HR:2019:1234"
- "What are the trends in 'arbeidsrecht' cases from 2015 to 2023?"
- "Find similar cases to ECLI:NL:RBDHA:2020:5678"
- "Search cases mentioning Article 6:162 BW"
- "Compare courts Hoge Raad and Rechtbank Amsterdam for tax cases"
License
Do whatever you want
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。