MCP server, HTTP API & CLI for German federal/state legal texts (BGB, DSGVO, …) with canonical IDs and…
legal-text-mcp-de
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
> **Cite-grade German legal-text infrastructure for LLM agents.**
> ~8 500 federal + Länder + EU laws via MCP, HTTP API, and a typer
> shell CLI — all over the same runtime, with cryptographic provenance
> from gesetze-im-internet.de and EUR-Lex / Cellar.
It is **local or server-side infrastructure**: no SaaS, no billing, no
accounts, no tenant model, and **no legal advice**. The runtime loads
either the committed fixture packages used by fast CI or a generated
production corpus package built outside Git. Official text comes from
gesetze-im-internet.de for German federal laws and from EUR-Lex /
Cellar for EU acts such as the GDPR.
> **No legal advice.** This software returns text and structured
> metadata. It does not interpret the law, advise on it, or produce
> any legal conclusion. The maintainer assumes no liability for use
> in legal decision-making contexts.
Older internal documentation has been archived under
docs-legacy/summary.md.
Status
| | |
| --- | --- |
| Lifecycle | Stable v2.1.3 (current patch on v2.1.0 typer-CLI minor) — MCP-native domain server with typer CLI |
| Versioning | SemVer 2.0.0 (stability contract starts at v1.0.0) |
| Licence | Apache License 2.0 — see LICENSE and NOTICE |
| Upstream | Derived from floleuerer/deutsche-gesetze-mcp (MIT, preserved) |
Features
- **MCP tools** for listing laws, fetching norms, resolving citations,
full-text search, and source provenance.
- **HTTP API** (FastAPI) over the same runtime, with structured
/health, /ready, /laws, /search, and OpenAPI endpoints.
- **Provenance-first design**: every law and norm carries source URL,
fetch timestamp, content hash, and the parser path it traversed.
- **Two corpus modes**: committed fixture packages for deterministic
tests and CI, or a generated production package built from official
sources at runtime.
- **No editorial bundling**: this repository ships tooling, not legal
text. Texts are loaded from official sources at runtime.
Installation
pip or uvx with an explicit dataset
- The package and standard Docker image contain the runtime only.
- DATASET_PATH must point to a normalized dataset directory with laws.json, norms.json, and search-index.json.
- Public corpus OCI references and the -full image currently return DENIED; there is no verified public corpus download.
- The CLI and HTTP runtime do not automatically prepare a usable dataset. A .tar.zst bundle is not a supported direct runtime path.
- Build the nine registered federal laws from official sources using the federal corpus guide. This requires the current source checkout and includes a fix beyond v2.1.3.
- prepare_data.build_corpus --sources bund is not implemented. Its archive output is separate from the serving dataset format.
Docker with a mounted dataset
- Use a dataset compatible with the selected runtime version.
- /health checks the process; /ready checks whether the HTTP API can serve its dataset.
- For freshly built federal data, follow the guide's source-image build instructions.
Mode 5 — Public-hosted service
CLI
legal-text-mcp-de ships a full subcommand CLI. Bare invocation prints
--help. Common commands:
Place --json or --output yaml before the subcommand for machine-readable
output; the data field contains the HTTP response shape. See CLI reference for
the full subcommand list.
> **BREAKING in v2.1.0:** bare legal-text-mcp-de now prints --help.
> Append serve to keep the v2.0 behaviour (started the MCP server).
Quickstart
MCP-client compatibility
- **Tested** requires a recorded client version, transport, successful tools/list, and one successful tool call.
- Configuration examples alone are not test evidence. Client runs below remain **[UNVERIFIED]**; protocol-level CI does not establish desktop-client compatibility.