
China Law MCP
io.github.thu-lawyerv0.1.1Updated Oct 4, 2026
Search 23,995 Chinese statutes and verify citations to catch LLM-fabricated references.
Overview
Lets an assistant search 23,995 current Chinese statutes offline and verify whether cited law articles actually exist.
- What it does
- Provides a local corpus of 378 Chinese laws (constitution, statutes, legislative interpretations) with 23,995 articles. Tools include search_statutes for natural-language retrieval, get_article for fetching an article by law and number, list_laws for browsing the catalog, verify_citation for checking a single citation, and check_citations_in_text for extracting and validating every citation in a passage. Retrieval uses a local BM25 index with no external API calls.
- When to use it
- Useful when an assistant answers Chinese legal questions and citations must be checked, or when you want to catch fabricated references to Chinese laws. Also suited to looking up article text or finding relevant statutes from a plain-language description.
- Requirements
- Runs locally as a stdio process. Install via uvx or pip (Python), or run the published Docker image. No account, API key, or network access is required; the SQLite database ships with the package and the BM25 index is built on first run.
Installation
In SourceWeft
- Open China Law MCP in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
⚖️ china-law-mcp
中国法律条文 MCP 服务器 · 让 AI 引用法条不再编造
免费 · 免注册 · 免 API key · 本地运行
[License: MIT] [CI] [Python] [PyPI] [Downloads] [MCP] [MCP Registry] [Glama] [ghcr.io] [Laws] [Articles]
English · 中文
解决什么问题
直接问大模型中国法律问题,有两个后果:引用的条文可能根本不存在或已废止,你无法核实。法律是最不能容忍编造的领域。
china-law-mcp 给 AI 装上一个离线法条库 + 引用核验器:
- 模型要引用《民法典》第 1254 条?先调
verify_citation查一下,不存在就换掉 - 模型写了一整段分析?
check_citations_in_text会把里面所有《某法》第 N 条抽出来逐条核验,列出编造的引用 - 不知道适用哪条?
search_statutes用自然语言检索(支持「同事借我钱不还」这种口语)
数据在本地,不联网、不注册、不需要 API key。
快速开始
方式一:一行命令(推荐)
方式二:pip 安装
方式二:克隆运行
方式三:Docker(镜像已发布到 ghcr.io)
接入 Claude Code / Cursor / 其他 MCP 客户端
工具
效果示例
自然语言检索(口语直接问):
引用核验(防止 AI 编造):
数据
- 378 部法律、23,995 条现行条文(宪法、法律、立法解释全量)
- 每条含:法律名、编章、条号(中文 + 阿拉伯数字)、条文全文、部门法、时效状态
- SQLite 数据库(15 MB)随仓库提供,开箱即用;BM25 索引首次运行自动构建(约 6 秒,之后缓存)
换成你自己的语料:
字段说明见 scripts/build_corpus.py 头部注释。scripts/ 下另有两个可选工具:make_subset.py(抽取常用法律子集)、encrypt_data.py(把数据库加密为 laws.db.enc,服务器可用 CHINA_LAW_KEY 环境变量自动解密)。
工作原理
检索是纯本地 BM25(rank-bm25 + jieba),不调用任何外部 API,因此没有网络依赖、没有调用成本,也不会把你的查询发给第三方。
已知局限
- 检索是 BM25 基线,口语→法言法语的映射靠一张手工规则表(约 40 条)。常见场景效果好,生僻表述可能召回不相关条文——请始终以返回的条文原文为准。
- 覆盖范围为宪法、法律、立法解释(378 部),不含行政法规、地方性法规、司法解释。修法频繁的领域请留意时效状态字段。
- 条文时效状态部分为库内推定(见语料
status_basis字段)。 - 本工具提供条文检索与引用核验,不构成法律意见。
收录情况
- PyPI:https://pypi.org/project/china-law-mcp/
- MCP 官方注册表(active):https://registry.modelcontextprotocol.io/v0/servers?search=china-law-mcp
- Glama:https://glama.ai/mcp/servers/thu-lawyer/china-law-mcp —— 工具定义评分 A
- awesome-mcp-servers:已提交 PR
- 容器镜像:
ghcr.io/thu-lawyer/china-law-mcp
开发
相关项目
- 律问 LawQ —— 同一套检索引擎的 Web / 小程序版本(带流式问答)
- 中国行政诉讼案例数据集 —— 635 个行政案件、425 篇裁判文书全文
许可
MIT。条文数据来自公开渠道整理,请遵守相应来源的使用条款。
Source: README.md at commit f502333
Tools
0Version history
1- v0.1.1LatestOct 4, 2026

