eu.ansvar/chinese-law-mcp
Chinese law database — cybersecurity, data protection, commercial law with full-text search
Ask AI about eu.ansvar/chinese-law-mcp
Powered by Claude · Grounded in docs
I know everything about eu.ansvar/chinese-law-mcp. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Chinese Law MCP Server
The NPC National Law Database alternative for the AI age.
Query 1,188 Chinese laws, administrative regulations, and departmental rules -- from 个人信息保护法 and 网络安全法 to 民法典, 公司法, and CAC AI regulations -- directly from Claude, Cursor, or any MCP-compatible client.
If you're building legal tech, compliance tools, or doing Chinese legal research, this is your verified reference database.
Built by Ansvar Systems -- Stockholm, Sweden
Why This Exists
Chinese legal research is scattered across official NPC databases, State Council publications, and commercial legal platforms. Whether you're:
- A lawyer validating citations in a brief or contract
- A compliance officer checking PIPL, CSL, or DSL requirements
- A legal tech developer building tools on Chinese law
- A researcher analysing legislation across 9 legal categories
...you shouldn't need dozens of browser tabs and manual cross-referencing. Ask Claude. Get the exact provision. With context.
This MCP server makes Chinese law searchable, cross-referenceable, and AI-readable.
Quick Start
Use Remotely (No Install Needed)
Connect directly to the hosted version -- zero dependencies, nothing to install.
Endpoint: https://chinese-law-mcp.vercel.app/mcp
| Client | How to Connect |
|---|---|
| Claude.ai | Settings > Connectors > Add Integration > paste URL |
| Claude Code | claude mcp add chinese-law --transport http https://chinese-law-mcp.vercel.app/mcp |
| Claude Desktop | Add to config (see below) |
| GitHub Copilot | Add to VS Code settings (see below) |
Claude Desktop -- add to claude_desktop_config.json:
{
"mcpServers": {
"chinese-law": {
"type": "url",
"url": "https://chinese-law-mcp.vercel.app/mcp"
}
}
}
GitHub Copilot -- add to VS Code settings.json:
{
"github.copilot.chat.mcp.servers": {
"chinese-law": {
"type": "http",
"url": "https://chinese-law-mcp.vercel.app/mcp"
}
}
}
Use Locally (npm)
npx @ansvar/chinese-law-mcp
Claude Desktop -- add to claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"chinese-law": {
"command": "npx",
"args": ["-y", "@ansvar/chinese-law-mcp"]
}
}
}
Cursor / VS Code:
{
"mcp.servers": {
"chinese-law": {
"command": "npx",
"args": ["-y", "@ansvar/chinese-law-mcp"]
}
}
}
Example Queries
Once connected, just ask naturally:
- "个人信息保护法第四条说了什么?" (What does Article 4 of PIPL say?)
- "搜索关于数据安全的规定" (Search for provisions about data security)
- "网络安全法是否仍然有效?" (Is the Cybersecurity Law still in force?)
- "算法推荐管理规定对推荐算法有什么要求?" (What does the Algorithm Recommendation Provisions require?)
- "Find provisions about反垄断 (anti-monopoly) in Chinese law"
- "Validate this citation: 民法典 第一条"
- "Build a legal stance on data breach notification requirements"
What's Included
| Category | Count | Details |
|---|---|---|
| National Laws | 385 statutes | Constitution, constitutional-related, civil & commercial, administrative, economic, social, criminal, procedural |
| Administrative Regulations | 799 regulations | State Council administrative regulations (行政法规) |
| CAC Departmental Rules | 4 rules | Key AI/cybersecurity regulations from the Cyberspace Administration of China |
| Provisions | 62,981 articles | Full-text searchable with FTS5 |
| Database Size | ~51 MB | Optimized SQLite, portable |
| Daily Updates | Automated | Freshness checks against NPC database |
Legal Categories Covered
| Category | Chinese Name | Count |
|---|---|---|
| Constitution | 宪法 | 7 |
| Constitutional-related | 宪法相关法 | 75 |
| Civil & Commercial | 民法商法 | 46 |
| Administrative | 行政法 | 146 |
| Economic | 经济法 | 133 |
| Social | 社会法 | 44 |
| Criminal | 刑法 | 7 |
| Procedural | 诉讼与非诉讼程序法 | 15 |
| Administrative Regulations | 行政法规 | 799 |
| CAC Departmental Rules | 部门规章 (CAC) | 4 |
| Total | 1,276 enumerated (1,188 ingestable) |
Verified data only -- every provision is extracted from official sources: NPC National Law Database DOCX files (flk.npc.gov.cn) and CAC published regulations (cac.gov.cn). Zero LLM-generated content.
Why This Works
Verbatim Source Text (No LLM Processing):
- All statute text is extracted from official NPC DOCX files via mammoth HTML conversion
- Provisions are returned unchanged from SQLite FTS5 database rows
- Zero LLM summarization or paraphrasing -- the database contains regulation text, not AI interpretations
Smart Context Management:
- Search returns ranked provisions with BM25 scoring (safe for context)
- Provision retrieval gives exact text by law name + article number
- Cross-references help navigate without loading everything at once
Technical Architecture:
NPC FLK Database → DOCX Download → mammoth HTML ─┐
├→ Article Parser → SQLite → FTS5 snippet() → MCP response
CAC (cac.gov.cn) → HTML Fetch ───────────────────┘ ↑ ↑
第X条 regex parser Verbatim database query
Traditional Research vs. This MCP
| Traditional Approach | This MCP Server |
|---|---|
| Navigate flk.npc.gov.cn SPA manually | Search by plain language: "个人信息 同意" |
| Download DOCX files one at a time | Get the exact provision with context |
| Manual cross-referencing between laws | build_legal_stance aggregates across sources |
| "Is this statute still in force?" → check manually | check_currency tool → answer in seconds |
| Check multiple sources for updates | Daily automated freshness checks |
| No API, no integration | MCP protocol → AI-native |
Traditional: Browse flk.npc.gov.cn → Find law → Download DOCX → Open Word → Ctrl+F → Repeat for each law → Manual cross-referencing
This MCP: "What does the PIPL say about cross-border data transfers?" → Done.
Available Tools (8)
| Tool | Description |
|---|---|
search_legislation | FTS5 search on 62,981 provisions with BM25 ranking |
get_provision | Retrieve specific provision by law name + article number |
list_sources | List all 1,188 available laws with metadata |
validate_citation | Validate citation against database (zero-hallucination check) |
build_legal_stance | Aggregate citations from statutes for a legal topic |
format_citation | Format citations per Chinese conventions (full/short/pinpoint) |
check_currency | Check if statute is in force, amended, or repealed |
about | Server info, capabilities, and coverage summary |
Data Sources & Freshness
All content is sourced from authoritative Chinese legal databases:
- NPC National Law Database (flk.npc.gov.cn) -- Official National People's Congress database with full DOCX downloads
- State Council / gov.cn -- Administrative regulations from the State Council
- CAC (cac.gov.cn) -- Key departmental rules from the Cyberspace Administration of China (Algorithm Recommendation Provisions, Deep Synthesis Provisions, Generative AI Measures, Cybersecurity Review Measures)
Census-First Ingestion
The entire NPC National Law Database was enumerated via the FLK search API across 9 legal categories. Each law's official DOCX file was downloaded, converted to HTML via mammoth, and parsed article-by-article using Chinese legal numbering patterns (第X条). CAC departmental rules are fetched directly from cac.gov.cn and parsed from their HTML pages.
| Metric | Value |
|---|---|
| Total laws enumerated | 1,276 |
| Ingestable (in force + amended) | 1,188 |
| Excluded (repealed) | 88 |
| Provisions extracted | 62,981 |
| Ingestion success rate | 99.9% (1 network timeout) |
| Corpus date | 2026-02-25 |
Automated Freshness Checks (Daily)
A daily GitHub Actions workflow monitors the NPC database for new or amended laws.
Security
This project uses multiple layers of automated security scanning:
| Scanner | What It Does | Schedule |
|---|---|---|
| CodeQL | Static analysis for security vulnerabilities | Weekly + PRs |
| Semgrep | SAST scanning (OWASP top 10, secrets, TypeScript) | Every push |
| Gitleaks | Secret detection across git history | Every push |
| Trivy | CVE scanning on filesystem and npm dependencies | Daily |
| Socket.dev | Supply chain attack detection | PRs |
| Dependabot | Automated dependency updates | Weekly |
See SECURITY.md for the full policy and vulnerability reporting.
Important Disclaimers
Legal Advice
THIS TOOL IS NOT LEGAL ADVICE
Statute text is sourced from the official NPC National Law Database (flk.npc.gov.cn). However:
- This is a research tool, not a substitute for professional legal counsel
- Only the Chinese-language text is legally binding under PRC law
- Verify critical citations against primary sources for court filings
Before using professionally, read: DISCLAIMER.md | PRIVACY.md
Client Confidentiality
Queries go through the Claude API. For privileged or confidential matters, use on-premise deployment. See PRIVACY.md for guidance.
Development
Branching Strategy
This repository uses a dev integration branch. Do not push directly to main.
feature-branch → PR to dev → verify on dev → PR to main → deploy
mainis production-ready. Only receives merges fromdevvia PR.devis the integration branch. All changes land here first.- Feature branches are created from
dev.
Setup
git clone https://github.com/Ansvar-Systems/chinese-law-mcp
cd chinese-law-mcp
npm install
npm run build
npm test
Running Locally
npm run dev # Start MCP server
npx @anthropic/mcp-inspector node dist/index.js # Test with MCP Inspector
Data Management
npm run ingest # Census-driven full corpus ingestion from flk.npc.gov.cn
npm run ingest:cac # Ingest CAC departmental rules from cac.gov.cn
npm run build:db # Rebuild SQLite database from seed files
npm run check-updates # Check NPC database for amendments
npm run drift:detect # Detect data drift against census
npm test # Run all tests
npm run test:contract # Run golden contract tests
Performance
- Search Speed: <100ms for most FTS5 queries
- Database Size: ~51 MB (efficient, portable)
- Ingestion: Census-first -- 1,276 laws enumerated, 1,188 ingested
Related Projects: Complete Compliance Suite
This server is part of Ansvar's Compliance Suite -- MCP servers that work together for end-to-end compliance coverage:
@ansvar/eu-regulations-mcp
Query 49 EU regulations directly from Claude -- GDPR, AI Act, DORA, NIS2, MiFID II, eIDAS, and more. Full regulatory text with article-level search. npx @ansvar/eu-regulations-mcp
@ansvar/us-regulations-mcp
Query US federal and state compliance laws -- HIPAA, CCPA, SOX, GLBA, FERPA, and more. npx @ansvar/us-regulations-mcp
@ansvar/security-controls-mcp
Query 261 security frameworks -- ISO 27001, NIST CSF, SOC 2, CIS Controls, SCF, and more. npx @ansvar/security-controls-mcp
@ansvar/automotive-cybersecurity-mcp
Query UNECE R155/R156 and ISO 21434 -- Automotive cybersecurity compliance. npx @ansvar/automotive-cybersecurity-mcp
69+ national law MCPs covering Australia, Brazil, Canada, China, Denmark, Finland, France, Germany, Ghana, Iceland, India, Ireland, Israel, Italy, Japan, Kenya, Netherlands, Nigeria, Norway, Poland, Singapore, Slovenia, South Korea, Spain, Sweden, Switzerland, Thailand, Turkey, UAE, UK, US, Zimbabwe, and more.
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
Priority areas:
- Judicial interpretation expansion (Supreme People's Court)
- Additional departmental rules (MIIT, SAMR, and other ministries)
- Historical statute versions and amendment tracking
Roadmap
- Full corpus ingestion -- Census-first: 1,184 laws, 62,648 provisions from NPC DOCX files (v2.0.0)
- Vercel Streamable HTTP deployment
- npm package publication
- Golden standard -- 8 tools, 6-layer security CI/CD, open source files
- CAC departmental rules -- 4 key AI/cybersecurity regulations from cac.gov.cn (v3.0.0)
- Chinese-native focus -- Removed English/EU layers, pure Chinese legal text (v3.0.0)
- Judicial interpretations (Supreme People's Court)
- Additional departmental rules (MIIT, SAMR, other ministries)
- Historical statute versions (amendment tracking)
Citation
If you use this MCP server in academic research:
@software{chinese_law_mcp_2026,
author = {Ansvar Systems AB},
title = {Chinese Law MCP Server: Production-Grade Legal Research Tool},
year = {2026},
url = {https://github.com/Ansvar-Systems/chinese-law-mcp},
note = {Comprehensive Chinese legal database with 1,188 laws and 62,981 provisions from NPC National Law Database and CAC}
}
License
Apache License 2.0. See LICENSE for details.
Data Licenses
- Laws & Regulations: Chinese Government (public domain -- 中华人民共和国政府公开信息)
About Ansvar Systems
We build AI-accelerated compliance and legal research tools for the global market. This MCP server started as our internal reference tool -- turns out everyone building compliance tools has the same research frustrations.
So we're open-sourcing it. Navigating 1,188 Chinese laws shouldn't require a law degree.
ansvar.eu -- Stockholm, Sweden
Built with care in Stockholm, Sweden
