campus-guardrails
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@campus-guardrails scan my ./miniapp project for leaked secrets and inline rpx styles before release"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
校园小程序开发护栏(campus-dev-guardrails)
MCP server + 独立 CLI · 43 条从线上事故沉淀的 uni-app / 微信小程序开发约束
版权所有 (c) 2026 北京煜澜文化(beijingyulanwenhua)· 鸥吧(hiouba)
AI 编程助手帮你写小程序代码,往往"能跑,但处处是坑":行内样式写 rpx 真机尺寸归零、defineProps 泛型写法产物丢 type、分包开关没开真机资源 404、提审被诱导分享红线驳回……
这个护栏把 43 条踩过血的坑变成 AI 可查询、项目可扫描的结构化规则。让 Claude / Cursor / 任意 MCP 客户端在写代码前拿到约束、发版前扫出违规。
它和"小程序自动化 MCP"的区别
市面上的小程序 MCP(封装微信开发者工具 CLI)解决的是"手"的问题——怎么编译、截图、点元素。本护栏解决的是"脑"的问题——怎么写不踩坑。两者互补,不重复。
Related MCP server: shipcheck-mcp
能力一览
工具 | 说明 |
| 六大类:platform / packaging / compliance / performance / interaction / engineering |
| 规则索引,按分类与严重级过滤 |
| 规则详情:症状、成因、修复方案 |
| 静态扫描你的项目:rpx 行内样式、WXSS 通配/伪类、defineProps 泛型、分包开关、动画 fill-mode,外加密钥/内网 IP/服务器路径泄露红线 |
| 提审/上线检查清单(可选 first-release 场景) |
每条规则含 severity(error / warn / info)——给 AI 的硬约束,error 级必须遵守。
接入(MCP)
Claude Code / Cursor / 任意 MCP 客户端:
{
"mcpServers": {
"campus-guardrails": {
"command": "npx",
"args": ["-y", "campus-dev-guardrails"]
}
}
}本地开发(零依赖,Node ≥ 18):
git clone https://github.com/hiouba/campus-dev-guardrails.git
cd campus-dev-guardrails
node server/index.jsnpm 包
campus-dev-guardrails发布后,上面一段可简化为npx -y campus-dev-guardrails。
建议工作流(写进你的系统提示词或直接对 AI 说):
动手前按任务场景调
get_rules(category);涉及布局/组件/动画先查对应规则;发版前跑lint_project;提审前调submit_checklist。
独立 CLI(不开 MCP 也能用)
npx -y -p campus-dev-guardrails campus-guardrails-lint <项目路径>
# clone 本地:node bin/lint-cli.js <项目路径> [--json]退出码 0 通过 / 1 有警告 / 2 有 error 或敏感信息——可直接进 CI:
- run: npx -y -p campus-dev-guardrails campus-guardrails-lint ./miniapp
# 非零退出码自动让 CI 失败lint_project 对开源/发布前的包特别有用:它会揪出内网 IP、云密钥格式、真实 AppID、硬编码 token、服务器绝对路径——我们自己的项目被它逮到过真实的行内 rpx 隐患。
规则库(rules/rules.json)
规则是纯 JSON,与 server 解耦,可独立消费:
做自己的 lint 工具、文档站、团队 wiki,直接读
rules/rules.json提 Issue 增补规则;
lintable: true的规则欢迎附带扫描用例字段:
id / cat / sev / title / symptom / rule / fix / lintable
规则不是凭空写的最佳实践清单——每一条都对应一次真实线上事故(症状栏就是当时的现场)。
项目结构
├── rules/rules.json # 43 条护栏规则(核心资产)
├── server/index.js # MCP server(stdio JSON-RPC,零依赖)
├── bin/lint-cli.js # 独立 CLI(可接 CI)
└── LICENSE.md # 鸥吧社区许可证FAQ
Q:规则是怎么来的? A:多校区校园小程序运营平台的历史事故沉淀——真机才暴露的编译坑、被微信驳回的合规项、包体积红线、资金链路的发布纪律。已剔除一切业务敏感信息。
Q:能商用吗? A:学习/研究/社团工具免费;商业用途(收费服务、嵌入商业产品)需书面授权:hiouba@126.com。
Q:支持非校园项目吗? A:platform / packaging / performance 三类规则对任何 uni-app 项目通用;compliance 中的类目与备案建议以校园场景为例,规则本身适用于微信生态。
Q:为什么不是一份文档?
A:文档 AI 读不全、读了不遵守优先级;MCP 让约束进入 AI 的工具调用链路,severity 提供强制语义,lint_project 提供事后验证。文档版也在规划中。
交流
Issues 提规则、报误报;商用与定制联系 hiouba@126.com;系列项目见 github.com/hiouba(校园集市论坛 / 校园代丢垃圾跑腿)。
Available Tools
5 toolsget_rulesA
获取规则详情(含症状、成因、修复方案)。传 ids 精确取,或传 category 取整类,都不传取全量。写代码前先按任务场景取对应类规则遵守。
Inputs: ids, category.
lint_projectA
对指定 uni-app/微信小程序项目目录做静态护栏扫描:rpx 行内样式、WXSS 通配/伪类、defineProps 泛型、分包开关与资源位置、动画 fill-mode、以及密钥/内网信息泄露红线。返回违规清单(含修复建议)。发版/开源前必跑。
Inputs: project_path (required).
list_categoriesA
列出护栏规则分类(platform/packaging/compliance/performance/interaction/engineering)。
Inputs: no named parameters.
list_rulesA
列出规则索引,可按 category / severity(error|warn|info) 过滤。返回 id+title,供后续 get_rules 取详情。
Inputs: category, severity.
submit_checklistB
生成微信小程序提审/上线前的护栏检查清单。scenario 可选 first-release(首版上线,附加常见卡点)。
Inputs: scenario.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool occupies a distinct layer of the workflow: browse categories, list a rule index, fetch full rule details, statically scan a project, and generate a submission checklist. The index-vs-detail split between list_rules and get_rules is explicitly described (id+title vs full symptom/cause/fix), and lint_project (code scanning) is clearly separated from submit_checklist (pre-release checklist generation). No two tools appear to do the same thing.
All five names follow a strict snake_case verb_noun pattern (list_categories, list_rules, get_rules, lint_project, submit_checklist), with verb choice matching semantics (list for collections, get for detail, lint/submit for actions). No mixed conventions or vague standalone verbs.
Five tools is right-sized: two discovery tools, one detail tool, one enforcement tool, one release-workflow tool. Each earns its place with no filler or redundant wrappers.
The rule-reference → lint → pre-release checklist lifecycle is covered end to end, with category/severity filtering and id/category/full-detail fetch modes. Minor gaps: no keyword/symptom-based rule search (only category/severity/id), and lint_project has no scope options (e.g., single file, changed files) or severity-threshold configuration.
Maintenance
Related MCP Connectors
AI code governance and code review for Claude Code, Copilot and Cursor. Checks rules and security.
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI coding tools to scan projects for security vulnerabilities, hardcoded secrets, injection flaws, and privacy violations with 699 rules and 76 MCP tools, all running locally with zero telemetry.1,397 npm7MIT
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible AI agents to scan code for leaked secrets, copyleft licenses, unprotected routes, missing privacy policies, and risky card handling before committing or shipping.MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to inspect a project's design tokens and component catalog, audit React/Tailwind files against seven static UI quality rules, score overall UI health, and apply auto-fixes that are re-audited and reverted on regression. It works both locally over filesystem access and remotely on raw TSX/JSX or CSS snippets passed directly as strings.-
- AlicenseNot gradedqualityBmaintenanceEnables AI coding assistants to scan an iOS, Android, Flutter, React Native or Expo project for App Store and Google Play rejection risks, returning deterministic findings that cite the guideline section, link to the official Apple or Google page and explain how to fix each problem. Nothing leaves the machine and no AI is used in the checks.8 npmMIT