Search DevTools

Jump to any tool or page

OpenCaseLaw — Swiss Caselaw, Statutes & Doctrine

Unexplored

1M+ Swiss court decisions, statutes & doctrine with citation graph (DE/FR/IT). CC0, free, 42 tools.

jonashertner57 stars17 forksAI & Agents
View source

Install

mcp_config.json

{
  "mcpServers": {
    "ch-opencaselaw-swiss-caselaw": {
      "url": "https://mcp.opencaselaw.ch/mcp",
      "type": "streamable-http"
    }
  }
}

Documentation

OpenCaseLaw

Open Swiss case law and legislation for legal research and AI.

1M+ decisions · all 26 cantons · 1875–today · citation graph · MCP + REST + Parquet · CC0 data · MIT code

Try the search · Connect an AI client · Download the dataset · API documentation

What you can do

  • Find Swiss decisions across federal and cantonal courts, in German, French and Italian.
  • Trace citations between cases and identify the leading decisions on a question.
  • Query case law and legislation from Claude, ChatGPT-compatible clients, or any MCP client.
  • Download the corpus for legal NLP, retrieval and graph research.

Connect in 30 seconds

{
  "mcpServers": {
    "opencaselaw": {
      "url": "https://mcp.opencaselaw.ch/mcp"
    }
  }
}

No sign-up, no API key, read-only. 42 tools; setup guides for individual clients are at opencaselaw.ch/mcp.

A real result

Question. When is a dismissal in retaliation for an employee asserting a claim abusive under Swiss law?

One callsearch_decisions("missbräuchliche Kündigung Rachekündigung") returns 129 decisions, the leading one first:

BGE 136 III 513 (7 October 2010)

Art. 336 OR; missbräuchliche Kündigung. Der Arbeitnehmer ist vor einer Rachekündigung nur geschützt (Art. 336 Abs. 1 lit. d OR), sofern er nach Treu und Glauben annehmen kann, dass die von ihm geltend gemachten Ansprüche berechtigt sind. Es ist nicht erforderlich, dass sie tatsächlich begründet sind.

The Regeste is returned verbatim from the stored official head-note, and the citation string comes from a stored field — tools never construct citations. That contract is what makes the answer checkable rather than plausible.

Reproduce it:

curl -sG https://mcp.opencaselaw.ch/api/decisions \
  --data-urlencode "q=missbräuchliche Kündigung Rachekündigung" \
  --data-urlencode "limit=3"

Coverage

ResourceCoverage
Court decisions1,050,000+ records, 118 court and source collections, 1875–today
LanguagesGerman, French, Italian
Legislation5,525 federal laws, 15,600 cantonal laws (all 26 cantons)
Citation graph~10M resolved decision-to-decision edges, 12.4M statute references
Interpretive layersFederal Council dispatches, commentaries, open-access scholarship, federal administrative practice
AccessWeb, MCP, REST, daily CC0 Parquet
LicensingCC0 data, MIT code (ECtHR texts © ECHR-CEDH, see the data card)

Counts are generated from one source of truth, docs/canonical_numbers.md, with the verification method recorded alongside each figure.

Limitations, stated plainly. Coverage is not complete where portals restrict access; those sources are documented rather than glossed. The citation graph reports resolution coverage (93.8 %), which is not a precision estimate — a human semantic audit is in preparation. Some cantonal decisions may be published unredacted by the court; we inherit upstream pseudonymisation and do not re-pseudonymise. See governance and removal policy.

Contributing

Data-quality reports are the most valuable contribution — every one so far has been reproduced, fixed and pinned with a regression test. See CONTRIBUTING.md.


The remainder of this page is reference detail.

Why this exists

Swiss legal research today is fragmented across paywalls, inaccessible to language models, and prohibitively expensive for the people who need it most — law students, independent researchers, and anyone outside the major firms. Commercial databases (Weblaw, Swisslex, Legalis) charge hundreds of francs per month and still don't expose a clean API. LLMs hallucinate statute text because they have no authoritative source. Small cantons publish decisions in PDF archives nobody indexes.

OpenCaseLaw fixes this. Every published Swiss court decision, every federal and cantonal law, the resolved citation graph between them, and 44 MCP tools (42 remote in public mode + 2 local-only) that let any modern LLM act as a Swiss legal research assistant — all free, all open, all refreshed automatically.

What you get

Case law — 1,050,000+ decision records (~909,000 unique decisions; cross-identifier duplicates retained and linked, never deleted) from 1875 to today across 118 courts, full text + structured metadata, covering:

  • All 7 federal courts (BGer, BVGer, BStGer, BPatGer, BGE, BGE historical, BGE-EGMR)
  • Federal military court (Militärkassationsgericht / MKG, 1,244 decisions 1915–2025)
  • All 26 cantonal court systems (first, second, and third instance)
  • Regulatory decisions (FINMA, ComCo, FDPIC, IndepBC, ElCom, PostCom, ComCom)
  • ECHR/EGMR: 841 Swiss-respondent (HUDOC) + general ECtHR Grand Chamber/Chamber/Committee — 2,840 judgments live (481 BGE-published EGMR translations, 841 HUDOC, 1,186 Chamber, 237 Committee, 95 Grand Chamber)
  • Three official languages: German 463,012 (46.7%), French 446,869 (45.1%), Italian 81,796 (8.2%); schema reserves rm for Romansh
  • Deduplicated via docket normalisation + content-length-aware merge
  • Updated daily; BGer decisions available within ~15 minutes of court publication

Legislation — every Swiss law, federal and cantonal, locally mirrored with article-level indexing:

  • 5,525 federal laws / ~133,359 articles in each of DE/FR/IT from the Fedlex SPARQL endpoint
  • 15,600 cantonal laws / 361,430 articles, direct-scraped from all 26 cantons (LexWork covers 18, SIL covers 2, ZH OpenData covers ZH, TI~RL covers TI); LexFind PDF fallback supplements 4 cantons for laws missing from their primary portals
  • Unified SQLite FTS5 search federates both corpora; sub-millisecond article lookup
  • Monthly refresh on the 2nd of each month (the day after laws enter into force)
  • 12.4 M resolved links from decisions to individual statute articles

Citation graph — the only public large-scale citation graph of the Swiss legal system:

  • 9.65 M resolved decision-to-decision citation edges (10 M extracted) with confidence scores
  • 12.4 M decision-to-statute links resolved against the current consolidated text
  • Bidirectional lookup, appeal-chain resolution (Instanzenzug), leading-case ranking by citation authority
  • Powers find_leading_cases, find_citations, find_appeal_chain, analyze_legal_trend (top: BGE 125 V 351 with 85,108 incoming citations)

44 MCP tools (42 remote in public mode + 2 local-only) — specialised research tools that run in your LLM of choice:

  • Natural-language decision search (BM25 + synonym expansion + Haiku reranking, MRR@10 = 0.647 on a 100-query golden set)
  • Leading-case discovery, citation networks, appeal chains, jurisprudence evolution
  • Federal + cantonal law article lookup, full-text search across both — with colloquial→legal vocabulary expansion (searching "Vaterschaftsurlaub" finds the statute even though it says "Urlaub des andern Elternteils") and cross-language cantonal search (German query finds French/Italian cantonal laws)
  • Doctrine overviews (statute + authority-ranked BGEs + timeline + Botschaft reference)
  • Legislative history (Materialien) — 83,958 Botschaft amendment references across 9,139 BBl publications and 33,465 distinct (statute, article) pairs; Phase 2 verbatim Botschaft corpus (5,900+ documents, ~410K FTS5-indexed paragraphs) accessible via search_botschaft (topical FTS5 across the verbatim corpus), get_article_purpose (verbatim Botschaft text for a specific article), and get_article_history (chronological timeline composing statute + Botschaft + leading cases + commentary); per-article digests (legislative intent, key arguments, design choices, rejected alternatives) for BV and BGFA; parliamentary debate transcripts for the BV. Full verbatim ingest to ~25K Botschaften via Fedlex SPARQL discovery is scaling.
  • Decision-structure accessget_decision_structure (Sachverhalt + Erwägungen + Dispositiv + Regeste split), get_erwaegung (verbatim Schweizer-citation Einheit, e.g. get_erwaegung("BGE 140 III 86", "2.3")), get_regeste (official BGer/BVGer/BStGer head-note)
  • Scholarly commentary lookup from OnlineKommentar.ch + OpenLegalCommentary.ch (1,131 commentaries)
  • Fallbearbeitung exam questions generated from real BGE fact patterns, with hidden analysis for practice
  • Draft mock decisions from fact patterns (research-only tool for grounding LLM outputs)
  • Structured case briefs (regeste, Sachverhalt, Erwägungen, Dispositiv, cited statutes, authority)

Multiple access paths — same data, two distinct audiences:

For LLM users, researchers and developers — full 24-tool surface:

  • Remote MCP server at mcp.opencaselaw.ch (SSE + Streamable HTTP) — 30-second setup in any MCP client (Claude, ChatGPT, Cursor, Gemini, Windsurf)
  • OpenAI-compatible tool definitions for Grok/xAI and any function-calling LLM API
  • Local MCP server — full offline capability, all 44 tools (the 2 local-only update tools are available offline), ~65 GB disk
  • 30-route REST API with interactive documentation (Swagger UI + OpenAPI spec)
  • Bulk Parquet download via the HuggingFace dataset (~7 GB)
  • Live dashboard + browsing UI at opencaselaw.ch

For legal practitioners drafting documents — curated practitioner surface:

  • Word add-in — Search decisions and insert correctly-formatted Swiss legal citations directly in Word (no copy-paste). Click an Erwägung to insert it with the correct sub-citation; click a law § to insert that alinea. Free Audit scans the whole document for fabricated citations and bad pinpoints (deterministic, no LLM). Pro tier (Stripe-billed, CHF 5/month, 25 AI calls/day shared, structural PII redaction) adds four AI tools: Verify (single citation vs. full-text decision), Strengthen (paragraph x-ray with leading-case suggestions ranked by citation-graph centrality + commentary excerpts), Find Support (locate decisions that back an unsupported statement, scored 0–100), and Reflect (literary mirror on the whole document — one canonical work that frames the same human dilemma + one reflective question). Exposes ~8 of the 44 MCP tools (42 remote in public mode + 2 local-only) through the REST API, tuned for the write-your-brief workflow.

Performance you can defend in a paper:

MetricValue
Decision search qualityMRR@10 = 0.647 (online) / 0.470 (offline reproducible) · +102 % over baseline
Article lookup latency< 1 ms (local FTS5)
BGer publication → searchable~15 min (was 24 h pre-poller)
Daily full-text rebuild~5 h, zero downtime (atomic swap)
Citation-to-decision resolution9.65 M edges resolved (10 M extracted)

What this is

A structured, searchable archive of Swiss court decisions — from the Federal Supreme Court (BGer) down to cantonal courts in all 26 cantons. Every decision includes the full decision text, docket number, date, language, legal area, judges, cited decisions, and 20+ additional metadata fields.

The dataset is built by direct scraping of official court websites and cantonal court portals. New decisions are scraped, deduplicated, and published every night.

There are eight ways to use it, depending on what you need:

MethodFor whomWhat you get
Search with AIEveryoneNatural-language search in Claude, ChatGPT, Cursor, or Gemini — instant access, no download, full 24-tool surface
Citation AnalysisLegal scholars, researchersLeading cases, citation networks, appeal chains, jurisprudence trends over time
Statute LookupLegal professionalsFull article text from 5,525 federal laws and 15,600 cantonal laws, federated FTS5, sub-millisecond lookup
Legislation SearchLegal professionalsLexFind-backed discovery search with fetch_top_n_texts for single-call natural-language workflows
Education toolsLaw students, instructorsStructured case briefs, doctrine timelines, real-BGE exam questions with hidden analysis
Word Add-inLegal practitioners writing briefsInsert formatted Swiss citations into Word · click Erwägung / § to insert with correct sub-reference · free Audit (5-rail citation check) · Pro (CHF 5/mo, 25 AI calls/day): Verify (citation vs. full text) · Strengthen (paragraph x-ray + leading-case suggestions) · Find Support (decisions backing a statement) · Reflect (literary mirror) — curated ~8-tool subset
REST API / DownloadDevelopers, data scientists, NLP researchers30-route REST API, bulk Parquet download via HuggingFace (~7 GB)
Web UIEveryoneLive dashboard with corpus stats, daily delta, top movers, multilingual browsing

Not sure where to start? Connect to the remote MCP server — works with Claude, ChatGPT, and Gemini CLI. Instant access to all 1,050,000+ decisions, citation analysis, statute lookup, legislation search, and education tools, no download needed.


1. Search with AI

The dataset comes with an MCP server whose exact tool surface is deployment-dependent. Local deployments expose all 44 tools; remote mode omits the 2 local-only update tools (update_database, check_update_status) for 42 remote tools. You ask a question in natural language; the tool runs a full-text search and returns matching decisions with snippets.

Remote vs. local

RemoteLocal
Setup30 seconds30–60 minutes
DiskNone~65 GB
Tools38 (no local update tools)40, including update_database and check_update_status
FreshnessNightly (automatic)Manual
OfflineNoYes
RequiresClaude, ChatGPT, or Gemini CLI (see plans below)Any MCP client

Start with the remote server. Switch to local only if you need offline access.

Option A: Remote server (recommended)

Connect directly to the hosted MCP server — no data download, no local database, instant access to 1,050,000+ decisions.

Claude.ai / Claude Desktop (easiest):

  1. Open SettingsConnectors
  2. Click "Add custom connector"
  3. Paste https://mcp.opencaselaw.ch
  4. Click Add

Same steps in the browser (claude.ai) and the desktop app. No Node.js, no config files, no downloads.

Available on Pro, Max, Team, and Enterprise plans. For the free plan, use Claude Code or the manual JSON config.

Claude Code:

claude mcp add swiss-caselaw --transport sse https://mcp.opencaselaw.ch

Alternative: manual JSON config (if custom connectors aren't available)

Add to claude_desktop_config.json (Node.js required):

{
  "mcpServers": {
    "swiss-caselaw": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.opencaselaw.ch"]
    }
  }
}

Restart Claude Desktop after saving.

ChatGPT:

  1. Open SettingsAppsAdvanced settings → enable Developer mode
  2. Click Create app → name it Swiss Caselaw, paste https://mcp.opencaselaw.ch/sse, auth: None
  3. In any chat: click +Developer mode → select Swiss Caselaw

Available on Plus, Pro, Team, Enterprise, and Edu plans. Recommended with GPT-5.3 (GPT-5.4 does not currently support MCP tool invocation).

Gemini CLI:

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "swiss-caselaw": {
      "url": "https://mcp.opencaselaw.ch"
    }
  }
}

Restart Gemini CLI after saving. No account plan required — Gemini CLI is free.

Google ADK (Agent Development Kit):

Build a Gemini-powered agent with access to all tools:

from google.adk.agents import LlmAgent
from google.adk.tools import MCPToolset
from mcp.client.sse import SseConnectionParams

agent = LlmAgent(
    model="gemini-3.1-pro",
    name="swiss_law_agent",
    instruction="You are a Swiss legal research assistant.",
    tools=[
        MCPToolset(
            connection_params=SseConnectionParams(
                url="https://mcp.opencaselaw.ch/sse",
            ),
        ),
    ],
)

See the full MCP setup guide for Google Gen AI SDK examples and all other platforms.

See the full MCP setup guide for detailed instructions for all platforms.

The update_database and check_update_status tools are only available on the local server — the remote dataset is updated automatically every night.

Option B: Local server (offline access)

Run the MCP server locally with your own copy of the database (~65 GB disk). This gives you offline access and full control over the data.

Setup with Claude Code

Claude Code is Anthropic's CLI for working with Claude in the terminal.

Step 1. Clone this repository:

git clone https://github.com/jonashertner/opencaselaw.git
cd caselaw-repo-1

Step 2. Create a virtual environment and install the MCP server dependencies:

python3 -m venv .venv

# macOS / Linux
source .venv/bin/activate
pip install mcp pydantic huggingface-hub pyarrow fastapi

# Windows (PowerShell)
.venv\Scripts\Activate.ps1
pip install mcp pydantic huggingface-hub pyarrow

Step 3. Register the MCP server with Claude Code:

# macOS / Linux
claude mcp add swiss-caselaw -- /path/to/caselaw-repo-1/.venv/bin/python3 /path/to/caselaw-repo-1/mcp_server.py

# Windows
claude mcp add swiss-caselaw -- C:\path\to\caselaw-repo-1\.venv\Scripts\python.exe C:\path\to\caselaw-repo-1\mcp_server.py

Use the full absolute path to the Python binary inside .venv so that the server always finds its dependencies, regardless of which directory you run Claude Code from.

Step 4. Restart Claude Code and run your first search.

On first use, the server automatically:

  1. Downloads all Parquet files (~7 GB) from HuggingFace to ~/.swiss-caselaw/parquet/
  2. Builds a local SQLite FTS5 full-text search index at ~/.swiss-caselaw/decisions.db (~58 GB)

This takes 30–60 minutes depending on your machine and connection. It only happens once — after that, searches run instantly against the local database.

Total disk usage: ~65 GB in ~/.swiss-caselaw/ (macOS/Linux) or %USERPROFILE%\.swiss-caselaw\ (Windows).

Setup with Claude Desktop

See the Claude Desktop setup guide for step-by-step instructions (macOS + Windows).

Quick version — add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "swiss-caselaw": {
      "command": "/path/to/caselaw-repo-1/.venv/bin/python3",
      "args": ["/path/to/caselaw-repo-1/mcp_server.py"]
    }
  }
}

Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows). On Windows, use .venv\\Scripts\\python.exe instead.

Any MCP-compatible client works with the same command + args pattern.

Keeping the data current

The dataset is updated daily. To get the latest decisions, ask Claude to run the update_database tool, or call it

Sourced from the repository README.

More in AI & Agents