lovdata-mcp

simensee/lovdata-mcp

3.2

If you are the rightful owner of lovdata-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Lovdata MCP Server provides access to Norwegian court rulings and legal documents from Lovdata.

Tools
  1. search_lovdata

    Search for legal documents in Lovdata.

  2. get_document

    Get full document content from Lovdata using document URL or ID.

  3. get_court_rulings

    Get recent court rulings from Lovdata.

  4. search_court_rulings

    Search specifically for court rulings/decisions.

Lovdata MCP Server

A Model Context Protocol (MCP) server that provides access to Norwegian court rulings and legal documents from Lovdata.

Features

  • Search Legal Documents: Search across all Lovdata documents including laws, regulations, and court rulings
  • Court Ruling Access: Get recent court rulings from Norwegian courts
  • Filtered Search: Search specific court types (Supreme Court, Appeal courts, District courts, etc.)
  • Full Document Retrieval: Get complete document content including metadata, summaries, and full text
  • Structured Results: Get formatted results with document IDs, departments, keywords, and relevant sections

Tools Available

search_lovdata

Search for legal documents in Lovdata.

  • Parameters:
    • query (string): Search query (e.g., "skade", "arbeidsrett", "erstatning")
    • filter_type (string, optional): Document type filter ("*", "HRA", "LRA", "TRA", "LOVER", etc.)
  • Returns: Search results with titles, document IDs, departments, keywords, and URLs

get_document

Get full document content from Lovdata using document URL or ID.

  • Parameters:
  • Returns: Complete document with metadata, summary, keywords, parties, case progression, and full document content

get_court_rulings

Get recent court rulings from Lovdata.

  • Parameters:
    • limit (int, optional): Number of rulings to fetch (default: 20, max: 50)
  • Returns: Recent court rulings with metadata and keywords

search_court_rulings

Search specifically for court rulings/decisions.

  • Parameters:
    • query (string): Search query for court rulings
    • court_type (string, optional): Court type ("all", "høyesterett", "lagmannsrett", "tingrett", "jordskifterett")
  • Returns: Court-specific search results with enhanced metadata

Installation

Option 1: Docker (Recommended)

  1. Clone this repository:
git clone <repository-url>
cd lovdata-mcp
  1. Build and run with Docker:
# Build the Docker image
./docker-run.sh build

# Run the server
./docker-run.sh server

# Or run tests
./docker-run.sh test

Option 2: Local Python Installation

  1. Clone this repository:
git clone <repository-url>
cd lovdata-mcp
  1. Install dependencies:
pip install -e .

Usage

Docker Usage

# Run the MCP server
./docker-run.sh server

# Run tests
./docker-run.sh test

# Open a shell in the container
./docker-run.sh shell

# Clean up Docker resources
./docker-run.sh clean

Local Usage

# Run the server
python -m lovdata_mcp.server

# Or use the installed command
lovdata-mcp

# Run tests
python test_server.py

With Claude Desktop

Add this to your Claude Desktop configuration (claude_desktop_config.json):

For Docker:
{
  "mcpServers": {
    "lovdata": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "lovdata-mcp:latest"]
    }
  }
}
For Local Installation:
{
  "mcpServers": {
    "lovdata": {
      "command": "python",
      "args": ["-m", "lovdata_mcp.server"]
    }
  }
}

Example Queries

  • "Search for cases about 'arbeidsrett' in Supreme Court"
  • "Find recent court rulings about damages (skade)"
  • "Show me laws related to 'personvern'"
  • "Get the full document content for HR-2013-2094-A"
  • "Search for insurance law cases with keywords 'forsikringsrett'"

Example Usage with Document Retrieval

  1. First search for documents:

    Search for "KLP Skadeforsikring Isbrytertjenesten Malangen"
    
  2. Then get full document content:

    Get document content for "https://lovdata.no/dokument/HRSIV/avgjorelse/hr-2013-2094-a"
    

Development

The server is built using the MCP Python SDK and uses:

  • httpx for HTTP requests
  • beautifulsoup4 for HTML parsing
  • lxml for XML/HTML processing

Docker Commands

# Build the image
docker-compose build

# Run server interactively
docker-compose run --rm lovdata-mcp

# Run tests
docker-compose run --rm test

# Clean up
docker-compose down

Requirements

  • Docker and Docker Compose (for Docker installation)
  • Python 3.10+ (for local installation)

License

MIT License