china-law-mcp is an MCP server for Chinese legal provisions whose core goal is to enable AI to cite real, currently effective legal provisions when answering legal questions, rather than fabricating articles. The project is free, requires no registration and no API key, and runs entirely locally.
Purpose Asking a large model directly about Chinese legal questions carries two risks: the cited provisions may not exist at all or may have been repealed, and users find it difficult to verify them. china-law-mcp provides AI with an offline legal provision library and citation verifier, to verify before the model cites a legal provision, or to batch-verify all legal citations in the model's generated analysis afterward.
Main capabilities
- Legal provision retrieval: search_statutes supports natural-language retrieval, including colloquial expressions (such as "a colleague borrowed money from me and won't pay it back"), implemented based on a local BM25 index (rank-bm25 + jieba), supplemented by about 40 manual rule tables for mapping colloquial language to legal language.
- Citation verification: verify_citation is used to verify whether a single citation exists, for example checking whether Article 1254 of the Civil Code actually exists; check_citations_in_text can extract all citations in the form of "Article N of [Some Law]" from an entire passage of text and verify them one by one, listing fabricated citations.
- Data coverage: includes the Constitution, laws, and legislative interpretations, totaling 378 instruments and 23,995 currently effective articles; each entry includes the law name, part/chapter, article number (in Chinese and Arabic numerals), full text of the article, area of law, and validity status. The SQLite database is about 15 MB, provided with the repository, and ready to use out of the box; the BM25 index is automatically built on first run (about 6 seconds, then cached).
- Deployment: as a standard stdio MCP server, it can be connected to by any MCP client; it can be run via uvx, and a Docker image published to ghcr.io is also available.
- Agent Skill form: the repository's skills/china-law/ provides equivalent capabilities, including the SKILL.md skill definition and the zero-dependency CLI law.py (which does not depend on the mcp package), and can be placed in the skill directories of agents such as Claude Code, Codex, and Kimi CLI.
- Optional tools: scripts/ provides make_subset.py (to extract a subset of commonly used laws) and encrypt_data.py (to encrypt the database as laws.db.enc, the server can automatically decrypt via the CHINA_LAW_KEY environment variable).
Usage After confirming that uvx is in PATH, connect to MCP clients as a standard stdio server; alternatively, replace uvx with Docker to run. If the Agent does not support MCP, place the skills/china-law/ directory into the corresponding skills directory (e.g., Claude Code's ~/.claude/skills/ or project-level .claude/skills/, Codex's ~/.codex/skills/, and Kimi CLI specified via --skills-dir).
Applicable scenarios Suitable for scenarios requiring AI-assisted querying of Chinese legal provisions, verifying the authenticity of legal citations, and preventing hallucinated citations in legal Q&A; also suitable for quickly querying a single legal provision from the command line.
Limitations Retrieval uses a BM25 baseline; colloquial mapping relies on a manually maintained rule table. It performs well in common scenarios, but uncommon expressions may retrieve irrelevant provisions, and the original text of the returned provisions should prevail. Coverage is limited to the Constitution, laws, and legislative interpretations, excluding administrative regulations, local regulations, and judicial interpretations. In fields with frequent legal amendments, pay attention to the validity status field; some validity statuses are inferences within the database. This tool provides provision retrieval and citation verification and does not constitute legal advice.