Skip to main content
Glama
README.md
# bundesrecht-mcp

An unofficial [MCP](https://modelcontextprotocol.io) server for German federal laws and regulations from [gesetze-im-internet.de](https://www.gesetze-im-internet.de). It downloads all laws, keeps dated snapshots, and lets an agent search and read every norm with a citation.

Only the Bundesgesetzblatt is legally binding. This project is not affiliated with the Federal Ministry of Justice or juris.

## Use

```bash
pip install bundesrecht-mcp
```

```bash
bundesrecht-mcp --data-dir ~/bundesrecht-mcp-data update
```

```bash
bundesrecht-mcp --data-dir ~/bundesrecht-mcp-data serve
```

`update` downloads the table of contents and every law archive, parses them and switches to the new data only if everything succeeded. Run it daily; unchanged laws are not downloaded again when the source reports them as unchanged.

To add it to Claude Code:

```bash
claude mcp add bundesrecht -- bundesrecht-mcp --data-dir ~/bundesrecht-mcp-data serve
```

## Tools

| Tool | Purpose |
| --- | --- |
| `search_law(query, law_id?, limit?, as_of?)` | Full-text search over all norms |
| `get_law(law_id, offset?, limit?, as_of?)` | A law's details and table of contents |
| `get_norm(law_id, key, offset?, max_chars?, as_of?)` | One norm's text, in parts if long |
| `list_versions(law_id)` | Snapshot dates on which a law's text changed |
| `source_status()` | Snapshots, counts and download problems |

Resources: `bundesrecht://readme` (the source and its known problems), `bundesrecht://laws` (catalog) and `law://bundesrecht/{law_id}/{key}` (one norm).

`as_of` returns the text as this server downloaded it on or before a date. The source serves only current versions, so older versions exist only from your own snapshots.

## Data folder

```
raw/<date>/              unchanged downloads with snapshot.json
processed/<date>/        index.sqlite and laws/<law_id>.md
CURRENT                  the build in use
```

`processed/<date>/laws/` holds every law as Markdown, so an agent can also work with the folder directly, without MCP.

## Development

```bash
bundesrecht-mcp --data-dir /tmp/br ingest --max-files 20
```

```bash
bundesrecht-mcp --data-dir /tmp/br process
```

```bash
pytest
```

The repository has no dependencies beyond PyPI packages; the shared base (downloads, snapshots, `as_of` builds, citations) is in `src/bundesrecht_mcp/_core/`.