
Legal Text Mcp De
io.github.klein-business由 GitHub 帳號 klein-business 發布v2.1.3更新於 Oct 24, 2026
German federal & state legal texts (BGB, DSGVO, …) with canonical IDs and cite-grade provenance.
概覽
本機 MCP 伺服器,讓助理取得附有標準編號與來源溯源的德國及歐盟法律文本,可供引用。
- 可以做什麼
- 列出並檢視已載入的法律,可依中繼資料篩選,並讀取單一法律的詮釋資料與條文摘要。取得單一條文並解析結構化引用,不做法律解釋。對正規化法律文本做全文檢索,可限定特定法典。取得來源詮釋資料、來源限制、語料涵蓋範圍及相關條文關係。以唯讀 legal:// 資源載入語料,並執行引用核查、GDPR 檢視等預設提示工作流程。
- 適用情境
- 適合助理需要引用德國聯邦、邦或歐盟法律文本(如 BGB、DSGVO)並保留可追溯來源的情境,例如核對引用或找出相關條文。不適合提供法律意見或解釋。
- 執行需求
- 以本機程序方式透過 uvx 或 OCI 映像執行,也可連線託管的 streamable-HTTP 端點。需要透過 DATASET_PATH 提供正規化資料集目錄(laws.json、norms.json、search-index.json);套件與 Docker 映像不含法律文本,也沒有經驗證的公開語料下載。ANTHROPIC_API_KEY 為選用,僅 research_topic 工具使用,未設定時會退化為排序檢索。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Legal Text Mcp De,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
[legal-text-mcp-de: German legal text MCP server banner]
[PyPI version] [Python 3.12 / 3.13] [License: Apache 2.0] [GitHub release] [Container image] [Docs]
[CI] [CodeQL] [OpenSSF Scorecard] [OpenSSF Best Practices] [SLSA Level 3] [Signed by cosign] [MCP Registry]
legal-text-mcp-de
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
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_PATHmust point to a normalized dataset directory withlaws.json,norms.json, andsearch-index.json.- Public corpus OCI references and the
-fullimage currently returnDENIED; there is no verified public corpus download. - The CLI and HTTP runtime do not automatically prepare a usable dataset. A
.tar.zstbundle 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 bundis 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.
/healthchecks the process;/readychecks 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-denow prints--help. Appendserveto 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.
Run the MCP server with the committed fixture corpus
The default transport is streamable HTTP at
http://localhost:8001/mcp. The CLI does not expose stdio; see
stdio transport status.
Dev shortcut. A
Justfilewraps the commonuvinvocations (just install,just test,just lint,just run,just api,just docs). Install viabrew install just. The Justfile is optional — CI only usesuvdirectly.
Run the HTTP API
Since v2.1 the easiest way is the new CLI:
The default port is 8001 (from settings.port / PORT env var); use
--port <N> to override.
Or directly via uvicorn (equivalent — same FastAPI app):
The HTTP layer enforces MAX_REQUEST_BODY_BYTES (default 1048576 = 1 MiB)
as a defence-in-depth body-size cap; over-limit requests return 413 Payload Too Large. The operator's reverse proxy is still expected to
enforce a proxy-level limit on top of this.
Docker
The Docker image does not bundle legal text data. Mount a validated
package at /data/legal-texts:
- See
examples/docker-compose/http/for a minimal HTTP-mode Compose example. - See
examples/docker-compose/production/for a committed, CI-tested production stack (MCP + HTTP behind Caddy, switchable via Compose profiles).
MCP Resources
Since v2.0, the corpus is exposed as read-only legal:// URIs that any MCP client can load directly into its LLM context. Examples:
legal://laws— paginated indexlegal://laws/bgb— BGB header + norm indexlegal://laws/bgb/norms/par:433— § 433 BGB as Markdownlegal://corpus/coverage— what's in the corpus
See docs/concepts/mcp-native.md for the full URI catalogue.
MCP Prompts (slash-commands)
Five curated workflows appear as slash-commands in MCP clients:
Smart Tools
research_topic is a multi-step research tool that orchestrates 2 LLM-sampling calls per invocation:
- Corpus search for candidate norms
- LLM ranking of candidates by relevance
- Related-norms graph loading
- LLM synthesis of a structured research report
When the client lacks sampling support, the tool returns a degraded report with ranked candidates only.
Data Sources
No text from these sources is committed to this repository. The generated-corpus pipeline fetches them at build time and stores provenance in a manifest.
MCP Tools
See the MCP tools reference for the full surface. Highlights:
list_laws(query?)— list loaded laws with optional metadata filter.get_law(code)— law metadata + normalised norm summaries.get_norm(code, norm)— return one structured norm.search_laws(query, codes?)— search normalised texts.resolve_citation(...)— resolve structured citations without legal interpretation.get_source_metadata(code?),get_source_limitations(...),get_corpus_coverage(),get_related_norms(code, norm).
MCP tools return JSON-compatible objects. They do not return double-serialised JSON strings.
HTTP API
Article-plus-section paths must be URL-encoded:
Documentation
Full documentation is published at klein-business.github.io/legal-text-mcp-de.
Quick links:
- Quickstart
- MCP tools
- HTTP API
- Operations: security, SBOM, cosign-verify, versioning, threat model
- Roadmap
Source-of-truth documents live in the repo: README.md, CHANGELOG.md, SECURITY.md, CONTRIBUTING.md, GOVERNANCE.md, NOTICE, LICENSE.
Development
The full fixture-backed release gate:
The public-flip readiness gate:
A Justfile wraps the common targets (just test,
just lint, just docs, just run, just api) for convenience.
Contributing
See CONTRIBUTING.md for guidelines, code of conduct, and security policy.
All contributions must comply with the Developer Certificate of Origin
(sign-off with git commit -s).
Verification
Every release since v1.0.0 is signed and accompanied by an SBOM and
SLSA-3 provenance. Examples below use v2.1.3; substitute the tag
you actually pulled.
Cosign image signature
See Verify with cosign for SBOM and SLSA attestation verification.
Licence and acknowledgements
This project is licensed under the Apache License 2.0. See NOTICE for required attribution.
Derived from floleuerer/deutsche-gesetze-mcp (Copyright (c) 2025 Florian Leuerer, MIT). Upstream licence terms are preserved in licenses/MIT-floleuerer.txt.
MCP Registry: io.github.klein-business/legal-text-mcp-de ·
registry.modelcontextprotocol.io
mcp-name: io.github.klein-business/legal-text-mcp-de
來源:README.md,提交 7f55963
工具
0版本歷史
1- v2.1.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分