Rechtspraak MCP Server

Rechtspraak MCP Server

MCP server for searching and analyzing Dutch case law with advanced search, faceted filtering, and citation analysis.

Category
Visit Server

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

  1. Clone the repository:
git clone <repository-url>
cd rechtspraak-solr
  1. Start Solr with Docker:
docker-compose up -d solr
  1. Install dependencies:
uv sync
  1. Configure environment variables (create .env from .env.example):
cp .env.example .env
  1. 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:

  1. Local Mode (stdio): For Claude Desktop/Code running on your machine
  2. 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:

  1. Start HTTP server:
docker-compose up -d
  1. Configure nginx (see config/nginx.conf for 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;
}
  1. Security: Set MCP_API_KEY environment variable in your .env file

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 faceting
  • cases_get_by_ecli - Get specific case by ECLI identifier
  • cases_expand_query - Expand query with legal synonyms
  • cases_highlight_passages - Extract relevant passages from a case
  • cases_rerank - Rerank cases by relevance
  • cases_get_similar - Find similar cases
  • cases_search_by_article - Search by legal article
  • cases_validate_ecli - Validate ECLI format
  • cases_bulk_get - Batch retrieve multiple cases
  • cases_analyze_trend - Analyze temporal trends
  • cases_get_statistics - Get comprehensive statistics
  • cases_get_court_stats - Compare courts
  • cases_get_citations - Extract citations
  • cases_compare - Compare multiple cases
  • cases_extract_entities - Extract legal entities
  • system_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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured