{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/readme-banner.svg\" alt=\"legal-text-mcp-de: German legal text MCP server banner\" width=\"100%\">\n</p>\n\n<p align=\"center\">\n  <a href=\"https://pypi.org/project/legal-text-mcp-de/\"><img alt=\"PyPI version\" src=\"https://img.shields.io/pypi/v/legal-text-mcp-de.svg?style=for-the-badge&logo=pypi&logoColor=white&color=3775A9\"></a>\n  <a href=\"https://pypi.org/project/legal-text-mcp-de/\"><img alt=\"Python 3.12 / 3.13\" src=\"https://img.shields.io/pypi/pyversions/legal-text-mcp-de.svg?style=for-the-badge&logo=python&logoColor=white\"></a>\n  <a href=\"https://github.com/klein-business/legal-text-mcp-de/blob/main/LICENSE\"><img alt=\"License: Apache 2.0\" src=\"https://img.shields.io/badge/license-Apache%202.0-16A34A?style=for-the-badge\"></a>\n  <a href=\"https://github.com/klein-business/legal-text-mcp-de/releases/latest\"><img alt=\"GitHub release\" src=\"https://img.shields.io/github/v/release/klein-business/legal-text-mcp-de?style=for-the-badge&logo=github&color=111827&label=release\"></a>\n  <a href=\"https://github.com/klein-business/legal-text-mcp-de/pkgs/container/legal-text-mcp-de\"><img alt=\"Container image\" src=\"https://img.shields.io/badge/ghcr.io-multi--arch-2496ED?style=for-the-badge&logo=docker&logoColor=white\"></a>\n  <a href=\"https://klein-business.github.io/legal-text-mcp-de/\"><img alt=\"Docs\" src=\"https://img.shields.io/badge/docs-mkdocs--material-526CFE?style=for-the-badge&logo=materialformkdocs&logoColor=white\"></a>\n</p>\n<p align=\"center\">\n  <a href=\"https://github.com/klein-business/legal-text-mcp-de/actions/workflows/ci.yml\"><img alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/klein-business/legal-text-mcp-de/ci.yml?branch=main&style=for-the-badge&label=CI&logo=githubactions&logoColor=white\"></a>\n  <a href=\"https://github.com/klein-business/legal-text-mcp-de/actions/workflows/codeql.yml\"><img alt=\"CodeQL\" src=\"https://img.shields.io/github/actions/workflow/status/klein-business/legal-text-mcp-de/codeql.yml?branch=main&style=for-the-badge&label=CodeQL&logo=githubactions&logoColor=white\"></a>\n  <a href=\"https://api.securityscorecards.dev/projects/github.com/klein-business/legal-text-mcp-de\"><img alt=\"OpenSSF Scorecard\" src=\"https://img.shields.io/ossf-scorecard/github.com/klein-business/legal-text-mcp-de?style=for-the-badge&label=OSSF%20Scorecard\"></a>\n  <a href=\"https://www.bestpractices.dev/projects/12860\"><img alt=\"OpenSSF Best Practices\" src=\"https://img.shields.io/cii/level/12860?style=for-the-badge&label=OSSF%20Best%20Practices&color=16A34A\"></a>\n  <a href=\"https://slsa.dev\"><img alt=\"SLSA Level 3\" src=\"https://img.shields.io/badge/SLSA-Level%203-2DBA00?style=for-the-badge&logo=githubactions&logoColor=white\"></a>\n  <a href=\"https://github.com/sigstore/cosign\"><img alt=\"Signed by cosign\" src=\"https://img.shields.io/badge/cosign-signed-purple?style=for-the-badge&logo=sigstore&logoColor=white\"></a>\n  <a href=\"https://registry.modelcontextprotocol.io/v0/servers?search=legal-text-mcp-de\"><img alt=\"MCP Registry\" src=\"https://img.shields.io/badge/MCP%20Registry-listed-1F6FEB?style=for-the-badge&logo=anthropic&logoColor=white\"></a>\n</p>\n\n# legal-text-mcp-de\n\n> **Cite-grade German legal-text infrastructure for LLM agents.**\n> ~8 500 federal + Länder + EU laws via MCP, HTTP API, and a typer\n> shell CLI — all over the same runtime, with cryptographic provenance\n> from gesetze-im-internet.de and EUR-Lex / Cellar.\n\nIt is **local or server-side infrastructure**: no SaaS, no billing, no\naccounts, no tenant model, and **no legal advice**. The runtime loads\neither the committed fixture packages used by fast CI or a generated\nproduction corpus package built outside Git. Official text comes from\n`gesetze-im-internet.de` for German federal laws and from EUR-Lex /\nCellar for EU acts such as the GDPR.\n\n> **No legal advice.** This software returns text and structured\n> metadata. It does not interpret the law, advise on it, or produce\n> any legal conclusion. The maintainer assumes no liability for use\n> in legal decision-making contexts.\n\nOlder internal documentation has been archived under\n[docs-legacy/summary.md](docs-legacy/summary.md).\n\n## Status\n\n| | |\n| --- | --- |\n| Lifecycle | Stable `v2.1.3` (current patch on `v2.1.0` typer-CLI minor) — MCP-native domain server with typer CLI |\n| Versioning | [SemVer 2.0.0](https://semver.org/spec/v2.0.0.html) (stability contract starts at `v1.0.0`) |\n| Licence | Apache License 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE) |\n| Upstream | Derived from [floleuerer/deutsche-gesetze-mcp](https://github.com/floleuerer/deutsche-gesetze-mcp) (MIT, preserved) |\n\n## Features\n\n- **MCP tools** for listing laws, fetching norms, resolving citations,\n  full-text search, and source provenance.\n- **HTTP API** (FastAPI) over the same runtime, with structured\n  `/health`, `/ready`, `/laws`, `/search`, and OpenAPI endpoints.\n- **Provenance-first design**: every law and norm carries source URL,\n  fetch timestamp, content hash, and the parser path it traversed.\n- **Two corpus modes**: committed fixture packages for deterministic\n  tests and CI, or a generated production package built from official\n  sources at runtime.\n- **No editorial bundling**: this repository ships tooling, not legal\n  text. Texts are loaded from official sources at runtime.\n\n## Installation\n\n### Mode 1 — `pip install` from PyPI (smallest dependency)\n\n```bash\npip install legal-text-mcp-de==2.1.3\nDATASET_PATH=/path/to/corpus.tar.zst legal-text-mcp-de serve\n```\n\nThe package ships the runtime only; provide a corpus bundle via\n`DATASET_PATH` (build with `prepare_data.build_corpus`, see Mode 4) or\npoint at an existing `.tar.zst` you trust.\n\n### Mode 2 — `uvx` + auto-download (recommended, easiest)\n\n```bash\nuvx legal-text-mcp-de serve\n```\n\nServer fetches the latest signed corpus bundle from GHCR on first run.\n\n### Mode 3 — Docker with pre-bundled corpus\n\n```bash\ndocker run -p 8001:8001 ghcr.io/klein-business/legal-text-mcp-de-full:2.1.3 serve\n```\n\n### Mode 4 — Self-built corpus (compliance-sensitive)\n\n```bash\ngit clone https://github.com/klein-business/legal-text-mcp-de\ncd legal-text-mcp-de\nuv run python -m prepare_data.build_corpus --output ./my-corpus.tar.zst --sources land:by,land:nrw\nDATASET_PATH=./my-corpus.tar.zst uvx legal-text-mcp-de serve\n```\n\n### Mode 5 — Public-hosted service\n\n```json\n// claude_desktop_config.json\n{\n  \"mcpServers\": {\n    \"legal-de\": {\n      \"url\": \"https://mcp.klein.business/legal/de\",\n      \"transport\": \"streamable-http\"\n    }\n  }\n}\n```\n\n## CLI\n\n`legal-text-mcp-de` ships a full subcommand CLI. Bare invocation prints\n`--help`. Common commands:\n\n```bash\nlegal-text-mcp-de serve              # start the MCP server (replaces the v2.0 bare invocation)\nlegal-text-mcp-de http               # start the FastAPI HTTP API\nlegal-text-mcp-de laws --query DSGVO # list laws\nlegal-text-mcp-de norm BGB \"§ 433\"   # fetch a single norm\nlegal-text-mcp-de search Werbung     # full-text search\nlegal-text-mcp-de corpus pull        # download the signed corpus bundle\nlegal-text-mcp-de corpus verify      # cosign-verify the local bundle\nlegal-text-mcp-de version            # version + Python + platform\n```\n\nAdd `--json` to any subcommand for machine-readable output (matches the\nHTTP API's response schema). See [CLI reference](docs/cli/index.md) for\nthe full subcommand list.\n\n> **BREAKING in v2.1.0:** bare `legal-text-mcp-de` now prints `--help`.\n> Append `serve` to keep the v2.0 behaviour (started the MCP server).\n\n## Quickstart\n\n### Run the MCP server with the committed fixture corpus\n\n```bash\nuv sync --all-groups\n\nDATASET_PATH=tests/fixtures/normalized \\\nSTRICT_STARTUP=true \\\nuv run legal-text-mcp-de serve\n```\n\nThe default transport is streamable HTTP at\n`http://localhost:8001/mcp`. For desktop / offline clients use the\nstdio transport instead — see\n[Quickstart → stdio](https://klein-business.github.io/legal-text-mcp-de/latest/quickstart/stdio/).\n\n> **Dev shortcut.** A [`Justfile`](Justfile) wraps the common `uv`\n> invocations (`just install`, `just test`, `just lint`, `just run`,\n> `just api`, `just docs`). Install via `brew install just`. The\n> Justfile is optional — CI only uses `uv` directly.\n\n### Run the HTTP API\n\nSince v2.1 the easiest way is the new CLI:\n\n```bash\nDATASET_PATH=tests/fixtures/normalized \\\nSTRICT_STARTUP=true \\\nuv run legal-text-mcp-de http\n```\n\nThe default port is `8001` (from `settings.port` / `PORT` env var); use\n`--port <N>` to override.\n\nOr directly via uvicorn (equivalent — same FastAPI app):\n\n```bash\nDATASET_PATH=tests/fixtures/normalized \\\nSTRICT_STARTUP=true \\\nuv run uvicorn legal_text_mcp_de.http_api:app --host 127.0.0.1 --port 8001\n```\n\nThe HTTP layer enforces `MAX_REQUEST_BODY_BYTES` (default `1048576` = 1 MiB)\nas a defence-in-depth body-size cap; over-limit requests return `413\nPayload Too Large`. The operator's reverse proxy is still expected to\nenforce a proxy-level limit on top of this.\n\n### Docker\n\nThe Docker image does not bundle legal text data. Mount a validated\npackage at `/data/legal-texts`:\n\n```bash\ndocker run --rm -p 8001:8001 \\\n  -v /path/to/legal-text-package:/data/legal-texts:ro \\\n  ghcr.io/klein-business/legal-text-mcp-de:2.1.3 serve\n```\n- See [`examples/docker-compose/http/`](examples/docker-compose/http/) for a minimal HTTP-mode Compose example.\n- See [`examples/docker-compose/production/`](examples/docker-compose/production/) for a committed, CI-tested production stack (MCP + HTTP behind Caddy, switchable via Compose profiles).\n\n## MCP Resources\n\nSince v2.0, the corpus is exposed as read-only `legal://` URIs that any MCP client can load directly into its LLM context. Examples:\n\n- `legal://laws` — paginated index\n- `legal://laws/bgb` — BGB header + norm index\n- `legal://laws/bgb/norms/par:433` — § 433 BGB as Markdown\n- `legal://corpus/coverage` — what's in the corpus\n\nSee `docs/concepts/mcp-native.md` for the full URI catalogue.\n\n## MCP Prompts (slash-commands)\n\nFive curated workflows appear as slash-commands in MCP clients:\n\n| Slash | Args | Purpose |\n|---|---|---|\n| `/rechtsfrage` | `frage`, `rechtsgebiet?` | Answer a German legal question with exact norm citations |\n| `/zitation-checken` | `citation` | Resolve a citation (e.g. `§ 433 Abs. 1 BGB`) + Stand-Datum |\n| `/norm-erklaeren` | `code`, `norm` | Plain-language explanation with cited cross-references |\n| `/recherche` | `topic` | Multi-step research using `research_topic` smart tool |\n| `/dsgvo-check` | `aktivitaet` | Walk through GDPR Art. 5, 6, 7, 9, 13, 14 against a processing activity |\n\n## Smart Tools\n\n`research_topic` is a multi-step research tool that orchestrates 2 LLM-sampling calls per invocation:\n\n1. Corpus search for candidate norms\n2. LLM ranking of candidates by relevance\n3. Related-norms graph loading\n4. LLM synthesis of a structured research report\n\nWhen the client lacks sampling support, the tool returns a degraded report with ranked candidates only.\n\n## Data Sources\n\n| Source | Coverage | Reuse position |\n| --- | --- | --- |\n| `gesetze-im-internet.de` | German federal laws | Public-domain-equivalent under §5 (1) UrhG |\n| EUR-Lex / Cellar (`publications.europa.eu`) | EU acts (GDPR, AI Act, Data Act, …) | Reuse permitted under Commission Decision 2011/833/EU with attribution |\n\nNo text from these sources is committed to this repository. The\ngenerated-corpus pipeline fetches them at build time and stores\nprovenance in a manifest.\n\n## MCP Tools\n\nSee the [MCP tools reference](docs/features/mcp-law-tools.md) for the\nfull surface. Highlights:\n\n- `list_laws(query?)` — list loaded laws with optional metadata filter.\n- `get_law(code)` — law metadata + normalised norm summaries.\n- `get_norm(code, norm)` — return one structured norm.\n- `search_laws(query, codes?)` — search normalised texts.\n- `resolve_citation(...)` — resolve structured citations without legal\n  interpretation.\n- `get_source_metadata(code?)`, `get_source_limitations(...)`,\n  `get_corpus_coverage()`, `get_related_norms(code, norm)`.\n\nMCP tools return JSON-compatible objects. They do not return\ndouble-serialised JSON strings.\n\n## HTTP API\n\n| Method | Path | Purpose |\n| --- | --- | --- |\n| `GET` | `/health` | Liveness |\n| `GET` | `/ready` | Readiness |\n| `GET` | `/laws` | List laws |\n| `GET` | `/laws/{code}` | Law detail |\n| `GET` | `/laws/{code}/norms/{norm}` | Norm detail |\n| `GET` | `/laws/{code}/norms/{norm}/relationships` | Relationship metadata |\n| `GET` | `/corpus/coverage` | Corpus coverage summary |\n| `GET` | `/corpus/source-limitations` | Source limitations query |\n| `GET` | `/search` | Search |\n| `GET` | `/openapi.json` | OpenAPI document |\n\nArticle-plus-section paths must be URL-encoded:\n\n```\n/laws/egbgb/norms/art%3A246a%2Fpar%3A1\n```\n\n## Documentation\n\nFull documentation is published at\n[klein-business.github.io/legal-text-mcp-de](https://klein-business.github.io/legal-text-mcp-de).\n\nQuick links:\n\n- [Quickstart](https://klein-business.github.io/legal-text-mcp-de/quickstart/uvx/)\n- [MCP tools](https://klein-business.github.io/legal-text-mcp-de/tools/list_laws/)\n- [HTTP API](https://klein-business.github.io/legal-text-mcp-de/api/)\n- [Operations: security, SBOM, cosign-verify, versioning, threat model](https://klein-business.github.io/legal-text-mcp-de/operations/security/)\n- [Roadmap](https://klein-business.github.io/legal-text-mcp-de/roadmap/)\n\nSource-of-truth documents live in the repo: [README.md](README.md),\n[CHANGELOG.md](CHANGELOG.md), [SECURITY.md](SECURITY.md),\n[CONTRIBUTING.md](CONTRIBUTING.md), [GOVERNANCE.md](GOVERNANCE.md),\n[NOTICE](NOTICE), [LICENSE](LICENSE).\n\n## Development\n\n```bash\nuv sync --all-groups\nuv run --group dev pytest\n```\n\nThe full fixture-backed release gate:\n\n```bash\nuv run --group dev python scripts/verify_release.py\n```\n\nThe public-flip readiness gate:\n\n```bash\nuv run --group dev python scripts/verify_pre_flip.py\n```\n\nA [`Justfile`](Justfile) wraps the common targets (`just test`,\n`just lint`, `just docs`, `just run`, `just api`) for convenience.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines, code of conduct, and security policy.\nAll contributions must comply with the [Developer Certificate of Origin](https://developercertificate.org/)\n(sign-off with `git commit -s`).\n\n## Verification\n\nEvery release since v1.0.0 is signed and accompanied by an SBOM and\nSLSA-3 provenance. Examples below use `v2.1.3`; substitute the tag\nyou actually pulled.\n\n### Cosign image signature\n\n```bash\ncosign verify ghcr.io/klein-business/legal-text-mcp-de:2.1.3 \\\n  --certificate-identity-regexp 'https://github.com/klein-business/.*' \\\n  --certificate-oidc-issuer https://token.actions.githubusercontent.com\n```\n\nSee [Verify with cosign](https://klein-business.github.io/legal-text-mcp-de/operations/verify-with-cosign/)\nfor SBOM and SLSA attestation verification.\n\n## Licence and acknowledgements\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\nSee [NOTICE](NOTICE) for required attribution.\n\nDerived from [floleuerer/deutsche-gesetze-mcp](https://github.com/floleuerer/deutsche-gesetze-mcp)\n(Copyright (c) 2025 Florian Leuerer, MIT). Upstream licence terms are\npreserved in [licenses/MIT-floleuerer.txt](licenses/MIT-floleuerer.txt).\n\n---\n\n<sub>**MCP Registry**: `io.github.klein-business/legal-text-mcp-de` ·\n[registry.modelcontextprotocol.io](https://registry.modelcontextprotocol.io/v0/servers?search=legal-text-mcp-de)</sub>\n\n<!--\nThe line below is a machine-readable ownership marker used by the\nofficial MCP Registry's PyPI verification flow. It MUST stay in the\nPyPI-rendered README (i.e. inside README.md, not in a Markdown\ncomment, since PyPI strips HTML comments). Removing it will break\nthe auto-publish workflow in .github/workflows/mcp-registry.yml.\n-->\n\nmcp-name: io.github.klein-business/legal-text-mcp-de\n",
  "bytes": 15755,
  "sha": "6b3364798b826d1e19de430973e6cbf088a756768199819e4276a8cfd9c37bc7",
  "repo_slug": "klein-business/legal-text-mcp-de",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_klein_business_legal_text_mcp__ecd5eee9/readme"
}