eu.ansvar/chinese-law-mcp

Chinese law database — cybersecurity, data protection, commercial law with full-text search

DatabasesTypeScriptv1.1.2

Chinese Law MCP Server

The NPC National Law Database alternative for the AI age.

npm version MCP Registry License GitHub stars CI Daily Data Check Database Provisions

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

ClientHow to Connect
Claude.aiSettings > Connectors > Add Integration > paste URL
Claude Codeclaude mcp add chinese-law --transport http https://chinese-law-mcp.vercel.app/mcp
Claude DesktopAdd to config (see below)
GitHub CopilotAdd to VS Code settings (see below)

Claude Desktop -- add to claude_desktop_config.json:

json
{
  "mcpServers": {
    "chinese-law": {
      "type": "url",
      "url": "https://chinese-law-mcp.vercel.app/mcp"
    }
  }
}

GitHub Copilot -- add to VS Code settings.json:

json
{
  "github.copilot.chat.mcp.servers": {
    "chinese-law": {
      "type": "http",
      "url": "https://chinese-law-mcp.vercel.app/mcp"
    }
  }
}

Use Locally (npm)

bash
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

json
{
  "mcpServers": {
    "chinese-law": {
      "command": "npx",
      "args": ["-y", "@ansvar/chinese-law-mcp"]
    }
  }
}

Cursor / VS Code:

json
{
  "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

CategoryCountDetails
National Laws385 statutesConstitution, constitutional-related, civil & commercial, administrative, economic, social, criminal, procedural
Administrative Regulations799 regulationsState Council administrative regulations (行政法规)
CAC Departmental Rules4 rulesKey AI/cybersecurity regulations from the Cyberspace Administration of China
Provisions62,981 articlesFull-text searchable with FTS5
Database Size~51 MBOptimized SQLite, portable
Daily UpdatesAutomatedFreshness checks against NPC database

Legal Categories Covered

CategoryChinese NameCount
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
Total1,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:

text
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 ApproachThis MCP Server
Navigate flk.npc.gov.cn SPA manuallySearch by plain language: "个人信息 同意"
Download DOCX files one at a timeGet the exact provision with context
Manual cross-referencing between lawsbuild_legal_stance aggregates across sources
"Is this statute still in force?" → check manuallycheck_currency tool → answer in seconds
Check multiple sources for updatesDaily automated freshness checks
No API, no integrationMCP 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)

ToolDescription
search_legislationFTS5 search on 62,981 provisions with BM25 ranking
get_provisionRetrieve specific provision by law name + article number
list_sourcesList all 1,188 available laws with metadata
validate_citationValidate citation against database (zero-hallucination check)
build_legal_stanceAggregate citations from statutes for a legal topic
format_citationFormat citations per Chinese conventions (full/short/pinpoint)
check_currencyCheck if statute is in force, amended, or repealed
aboutServer 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.

MetricValue
Total laws enumerated1,276
Ingestable (in force + amended)1,188
Excluded (repealed)88
Provisions extracted62,981
Ingestion success rate99.9% (1 network timeout)
Corpus date2026-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:

ScannerWhat It DoesSchedule
CodeQLStatic analysis for security vulnerabilitiesWeekly + PRs
SemgrepSAST scanning (OWASP top 10, secrets, TypeScript)Every push
GitleaksSecret detection across git historyEvery push
TrivyCVE scanning on filesystem and npm dependenciesDaily
Socket.devSupply chain attack detectionPRs
DependabotAutomated dependency updatesWeekly

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
  • main is production-ready. Only receives merges from dev via PR.
  • dev is the integration branch. All changes land here first.
  • Feature branches are created from dev.

Setup

bash
git clone https://github.com/Ansvar-Systems/chinese-law-mcp
cd chinese-law-mcp
npm install
npm run build
npm test

Running Locally

bash
npm run dev                                       # Start MCP server
npx @anthropic/mcp-inspector node dist/index.js   # Test with MCP Inspector

Data Management

bash
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:

bibtex
@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


Learn More