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.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

掃描 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 中

  1. 開啟 儀表板中的 Code Guard Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

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

json
{ "mcpServers": { "code-guard": { "command": "npx", "args": ["-y", "@mlawsonking/code-guard-mcp"] } } }

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 grouped hardcoded-* 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
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分