Repository avatar
Other Tools
v0.1.0
active

cn-compliance

io.github.xmg221221/cn-compliance

Scan Chinese ad copy for PRC Advertising Law and platform banned words before publishing.

Documentation

cn-compliance-mcp

Catch the Chinese words that get ads fined ¥200,000 — before you publish.

An MCP server that checks Chinese marketing copy against PRC Advertising Law (广告法) and the review rules of Xiaohongshu, Douyin, WeChat Official Accounts, Toutiao and Baijiahao.

Built for people shipping Chinese content from outside China — and for the AI agents writing it.

Listed on Glama No dependencies Python 3.9+


Why this exists

  • 《广告法》第九条 bans superlative and "national-level" claims outright. The statutory fine starts at ¥200,000 (≈US$28k) and can escalate to revocation of the business licence.
  • Platform review is a separate layer. Xiaohongshu and Douyin maintain their own tightening lists, and 站外导流 (telling readers to add your WeChat) is among the most-punished behaviours on every mainland platform — shadowban first, account ban second.
  • Frontier LLMs write fluent, natural Chinese. They have no reliable sense of which words are legally toxic on the mainland. Ask any model for "an amazing Xiaohongshu post about my serum" and it will happily produce 全网最好 + 100%有效 + 彻底根治.

This server hands the model the actual list, checks the draft, and returns a rewritten version.

Install

Zero dependencies. Python 3.9+. Just point your MCP client at mcp_server.py.

Cursor — ~/.cursor/mcp.json

{
  "mcpServers": {
    "cn-compliance": {
      "command": "python3",
      "args": ["/absolute/path/to/mcp-cn-compliance/mcp_server.py"]
    }
  }
}

Claude Desktop — claude_desktop_config.json

{
  "mcpServers": {
    "cn-compliance": {
      "command": "python3",
      "args": ["/absolute/path/to/mcp-cn-compliance/mcp_server.py"]
    }
  }
}

Windows: use the full interpreter path, e.g. C:\\Python313\\python.exe, and escaped backslashes in args.

Tools

check_chinese_content_compliance

argtypenotes
textstringChinese copy, up to 20,000 chars
platformenumxiaohongshu (default) · douyin · wechat · toutiao · baijiahao · all

Returns a verdict — blocked / risky / safe — a 0–100 score, every offending word with its legal reason and a suggested replacement, and an auto-rewritten draft.

platform: "all" checks the same copy against every platform and reports the worst verdict plus the strictest platform in detail. Useful for matrix accounts publishing one draft to five places.

list_banned_words

Dumps the rule set grouped by legal basis, with safe alternatives. Optional rule substring filter, e.g. list_banned_words(rule="广告法").

Example

Input (Xiaohongshu):

这款面膜是全网最好的,拥有国家级认证,100%有效,三天彻底解决痘痘,无效退款!加微信 abc123 领取试用装。

Output:

## 小红书 — BLOCKED (score 20/100)

**发现 5 处法律级风险,发布前必须改掉**

| word | level | rule | replace with |
| --- | --- | --- | --- |
| 100%有效 | error | 广告法绝对化用语 | 多数用户反馈有效 |
| 国家级认证 | error | 广告法绝对化用语 | 通过相关检测 |
| 彻底解决 | error | 广告法绝对化用语 | 有助于改善 |
| 最好 | error | 广告法绝对化用语 | 比较好 |
| 无效退款 | error | 虚假背书 / 无法证明的承诺 | 支持七天无理由 |
| 加微信 | warn | 站外导流 | 在平台内咨询 |

Each row carries the underlying legal reason and the surrounding context, so the model can explain why rather than just refusing.

Design notes

  • Substring de-duplication. Hitting 国家级认证 does not also report 国家级 — otherwise one phrase is penalised twice.
  • Longest match wins. Overlapping hits keep the longest span at the earliest position.
  • Tiering. error = statutory risk, warn = throttling risk, info = style advice. The score is 100 − 15·errors − 5·warns − 1·infos, floored at 0.
  • Auto-rewrite is a draft, not a final. Substitutions are word-level; grammar around them may need a human pass. The checker optimises for legally safe, not elegant.

Scope and honesty

This is a pre-publication screening tool, not legal advice. It catches the patterns that account for most routine violations and罚单. It cannot know whether a specific claim is substantiated by your own test reports — if you claim 通过相关检测 you still need the report.

Cloud version

The rule set here is the free, offline core. The hosted version adds:

  • daily-updated platform rule changes (platforms tighten lists without notice)
  • category packs — 美妆 / 母婴 / 食品 / 保健食品 / 医疗器械 / 金融
  • batch screening and a plain HTTP API for pipelines

→ https://buxianliu.com

License

MIT.

No installation packages available.

Remote