
Code Guard Mcp
io.github.mlawsonking由 GitHub 账号 mlawsonking 发布v1.3.0更新于 Oct 24, 2026
Security scan for AI-generated code: injection, SSRF, secrets, weak crypto, unsafe deserialization.
概览
扫描 AI 生成的代码和差异,检查注入、密钥、弱加密等常见安全问题,并返回判定结果和发现项。
- 可以做什么
- 为助手刚编写的代码提供基于规则的安全扫描。scan_code 工具检查代码片段,返回判定结果(pass、review 或 block)以及包含规则、类别、严重程度、行号和修复建议的发现项。scan_diff 仅对统一差异中新增的行执行相同检查,list_rules 则列出全部 32 条规则目录。它结果确定、不使用 LLM,覆盖 JS/TS 和 Python。
- 适用场景
- 适合让编码助手在提交或运行自己生成的代码前先做检查,尤其是在提交循环中用 scan_diff 检查新增行。它只是对常见问题的快速初筛,不能替代真正的安全审查。
- 运行要求
- 通过 stdio 在本地运行,通常使用 npx 调用该 npm 包。未声明需要账户、API 密钥或环境变量。默认每天会联系一次规则源,可通过 --offline、AGENT_GUARDS_NO_FEED=1 或配置项关闭。
安装
在 SourceWeft 中
- 打开 控制台中的 Code Guard Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
code-guard-mcp
An MCP server that scans code for security bugs. A coding agent calls it on the code or diff it just produced, before committing or running it. Rule-based, no LLM, free.
More than half of new code is AI-assisted now, and a fair amount of it ships with the usual problems: injection, hardcoded secrets, disabled TLS checks, unsafe deserialization. This catches the common cases in one call. Treat it as a fast first pass, not a substitute for a real security review.
Install
Add it to your MCP client config (Claude Desktop, Cursor, Claude Code, and so on):
Tools
scan_code: scan a snippet. Returns a verdict (pass, review, or block) and a list of findings, each with the rule, category, severity, line number, and a suggested fix. Covers command, code, and SQL injection, SSRF, hardcoded secrets and API keys, weak crypto, unsafe deserialization (pickle, yaml), disabled TLS verification, XSS or template injection, and personal data left in source (email, US SSN, card number).scan_diff: the same scan, but only on the added lines of a unified diff, with correct new-file line numbers. Useful inside a commit loop. It only reads added lines, so a pattern spanning an added line and an untouched one is not seen.list_rules: the full rule catalog, so you can see what it checks and what it doesn't. 32 entries: the 31 code rules, plus one groupedhardcoded-*entry covering 22 credential patterns and 3 personal-data patterns.
Languages
JS/TS and Python. That is the whole list. 11 rules are JS/TS, 14 are Python, 6 are language-agnostic. There is no Go, Ruby, PHP, Java or Rust ruleset. A language value it doesn't recognise is ignored and the language is sniffed from the source instead, which returns one of three answers: js, py or unknown. Which one depends on what the file happens to contain. import java.util.List; reads as Python, a Go file with a const line reads as JavaScript, a Go file with only func and import "fmt" lands on unknown. Unknown runs all 31 rules against every line, which catches more and flags more things that are not bugs.
What it doesn't do
The 31 code rules are regexes matched one line at a time. No parser, no data flow, no taint tracking, so it isn't static analysis in the sense a SAST tool means it. It reads text. db.query("SELECT ... " + id) is caught on one line and missed the moment you split it across two. The word DES on a line trips weak-cipher, comment or variable name included. The hardcoded-* patterns are the exception: those run over the whole source, so a multi-line private-key block is still caught. A pass means none of the rules matched, not that the code is safe.
Rule updates
About once a day this server asks the rules feed whether there is a newer ruleset, and applies it if
there is. The request carries two things: which surface asked, which here is facade, and the rules
version already installed. No machine id, no user id, no file names, nothing you scanned.
Bundles are signed with Ed25519 and verified against a public key compiled into this package, so it
does not matter which mirror served one. A bundle that fails its signature, its schema, or its ReDoS
check is discarded and the rules you already had stay in place. --offline turns updates off, as
does AGENT_GUARDS_NO_FEED=1 or {"feed": false} in ~/.agent-guards/config.json. The bundle
format and how to verify one yourself: https://github.com/mlawsonking/MCP/blob/main/rules/README.md
Same input always gives the same output. It calls the API at https://code-guard-api.vercel.app (set CODE_GUARD_API to point at your own copy). One of six agent guards in this repo: package-guard, agent-firewall, payment-guard, email-guard, code-guard, and web-tools. MIT.
来源:code-guard-mcp/README.md,提交 91f3fa7
工具
0版本历史
1- v1.3.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分