# Opencaselaw

> Open Swiss legal corpus + MCP server: 1M+ court decisions (1875–today), 21k laws, 10M-edge citation graph, 42 MCP tools. CC0 data, MIT code. Live at mcp.opencaselaw.ch

- **Type:** MCP server
- **Install:** `agentstack add mcp-jonashertner-opencaselaw`
- **Verified:** Pending review
- **Seller:** [jonashertner](https://agentstack.voostack.com/s/jonashertner)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [jonashertner](https://github.com/jonashertner)
- **Source:** https://github.com/jonashertner/opencaselaw
- **Website:** https://opencaselaw.ch/

## Install

```sh
agentstack add mcp-jonashertner-opencaselaw
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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](https://opencaselaw.ch) ·
[Connect an AI client](#connect-in-30-seconds) ·
[Download the dataset](#2-download-the-dataset) ·
[API documentation](https://mcp.opencaselaw.ch/api/docs)

## 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

```json
{
  "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 [mcp.opencaselaw.ch](https://opencaselaw.ch/mcp/).

## A real result

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

**One call** — `search_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:

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

## Coverage

| Resource | Coverage |
|---|---|
| Court decisions | 1,050,000+ records, 118 court and source collections, 1875–today |
| Languages | German, French, Italian |
| Legislation | 5,525 federal laws, 15,600 cantonal laws (all 26 cantons) |
| Citation graph | ~10M resolved decision-to-decision edges, 12.4M statute references |
| Interpretive layers | Federal Council dispatches, commentaries, open-access scholarship, federal administrative practice |
| Access | Web, MCP, REST, daily CC0 Parquet |
| Licensing | CC0 data, MIT code (ECtHR texts © ECHR-CEDH, see the data card) |

Counts are generated from one source of truth,
[`docs/canonical_numbers.md`](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](docs/governance-and-removal-policy.md).

## 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](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 access** — `get_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](docs/openai-tools.json) 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](https://mcp.opencaselaw.ch/api/docs) (Swagger UI + OpenAPI spec)
- Bulk Parquet download via the [HuggingFace dataset](https://huggingface.co/datasets/voilaj/swiss-caselaw) (~7 GB)
- Live dashboard + browsing UI at [opencaselaw.ch](https://opencaselaw.ch)

*For legal practitioners drafting documents — curated practitioner surface:*
- [**Word add-in**](https://word.opencaselaw.ch/install.html) — 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**:

| Metric | Value |
|---|---|
| Decision search quality | MRR@10 = 0.647 (online) / 0.470 (offline reproducible) · **+102 %** over baseline |
| Article lookup latency |  **Not sure where to start?** Connect to the [remote MCP server](#option-a-remote-server-recommended) — 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](https://modelcontextprotocol.io) 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

|  | Remote | Local |
|---|---|---|
| **Setup** | 30 seconds | 30–60 minutes |
| **Disk** | None | ~65 GB |
| **Tools** | 38 (no local update tools) | 40, including `update_database` and `check_update_status` |
| **Freshness** | Nightly (automatic) | Manual |
| **Offline** | No | Yes |
| **Requires** | Claude, 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 **Settings** → **Connectors**
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](#alternative-manual-json-config-if-custom-connectors-arent-available).

**Claude Code:**

```bash
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](https://nodejs.org) required):

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

Restart Claude Desktop after saving.

**ChatGPT:**

1. Open **Settings** → **Apps** → **Advanced 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`:

```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:

```python
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](docs/claude-desktop-setup.md) for Google Gen AI SDK examples and all other platforms.

> See the **[full MCP setup guide](docs/claude-desktop-setup.md)** 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](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's CLI for working with Claude in the terminal.

**Step 1.** Clone this repository:

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

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

```bash
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:

```bash
# 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

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jonashertner](https://github.com/jonashertner)
- **Source:** [jonashertner/opencaselaw](https://github.com/jonashertner/opencaselaw)
- **License:** MIT
- **Homepage:** https://opencaselaw.ch/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** yes
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: flagged — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-jonashertner-opencaselaw
- Seller: https://agentstack.voostack.com/s/jonashertner
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
