
MCP Security Guard
io.github.petrovicistefanv0.7.0更新於 Oct 6, 2026
Audit MCP servers for tool poisoning, rug pulls and supply-chain risk (OWASP MCP Top 10).
概覽
稽核已安裝的 MCP 伺服器,檢查工具投毒、隱藏文字、rug pull、高風險能力與供應鏈風險,並提供可選的執行階段掛鉤。
- 功能
- 探索 Claude Code、Claude Desktop、外掛及其他本機用戶端中設定的 MCP 伺服器,並稽核其工具定義、說明、提示與資源,檢查投毒、隱藏字元、工具遮蔽與名稱衝突。它會以雜湊釘住工具定義,以便發現後續變更,為每個伺服器評分並歸類執行、寫入、刪除、外送等能力。可選掛鉤會在 MCP 呼叫時提示憑證或注入指令,並記錄不含內容的稽核日誌。發現項目會標註 OWASP MCP Top 10 編號,可匯出為 markdown、JSON、SARIF 或 HTML。
- 適用情境
- 當你安裝了多個 MCP 伺服器,想了解它們能做什麼、描述是否遭竄改時使用。它適合在安裝前審查某個伺服器、釘住定義以便日後發現變更,以及在 CI 中執行已核准伺服器政策。
- 執行需求
- 以 npm 套件透過 stdio 在本機執行,通常使用 npx,免費功能不需帳號或 API 金鑰。進行工具層級稽核需要啟動伺服器並明確確認;可選的供應鏈檢查需要連線至 npm、PyPI 與 OSV。付費方案使用 MCP_SECURITY_API_KEY。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 MCP Security Guard,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-security-guard
A Claude Code plugin that audits the MCP servers you have installed. Your code is covered by other tools. This one checks the servers that inject text into Claude's context.
It discovers servers from every place Claude Code and Claude Desktop load them: user, local and project scope, servers shipped inside installed plugins and plugins synced from your claude.ai account (named <plugin>:<server>), claude_desktop_config.json and Claude Desktop extensions, the organisation-managed managed-mcp.json, other clients on the machine (Cursor, VS Code, Windsurf, user and project configs), and the claude.ai connectors you have used (names only: their configuration lives in your account).
It scans everything a server puts into Claude's context, not only tools: server instructions, prompts, resources and resource templates go through the same poisoning checks and are pinned for rug-pull detection.
Everything runs locally. Nothing is sent anywhere.
OWASP MCP Top 10 coverage
Every finding is tagged with its OWASP MCP Top 10 id, in reports and in SARIF.
What a local tool cannot do (planned for a hosted Team plan): org-wide discovery and audit aggregation, and OAuth scope review.
Measured: detects 26/27 attacks from a corpus of publicly documented techniques, with 0 false positives on 13 hard benign samples and on 17 real servers (83 tools). See bench/RESULTS.md.
Install
Then run /mcp-audit, or ask Claude "are my MCP servers safe?".
Other MCP clients (Cursor, VS Code, Windsurf, Claude Desktop, Cline, ...)
The same server is published on npm and runs with no install step:
The command line tool is the same package: npx mcp-security-guard audit --project-only. It is also listed in the official MCP Registry as io.github.petrovicistefan/mcp-security-guard.
Tools
Session-start check
A SessionStart hook re-verifies only the servers you have pinned (pinning is your consent to launch them) and stays silent unless something changed. Control it with MCP_SECURITY_SESSION_CHECK:
full(default): compare launch configs and re-list toolsconfig: compare launch configs only, launch nothingoff: disable the check
CI / GitHub Action
Fail pull requests that add risky MCP servers to .mcp.json, and show the findings in GitHub code scanning:
The same checks run locally without Claude:
Check a server before installing it (launches it, sends only initialize and tools/list):
Test your own server for command injection and path traversal (it calls the tools; run a test instance, ideally in a container):
Fix what the audit found (dry run first, then --write):
Start a team policy from the servers configured today:
Any command takes --format markdown|json|sarif|html. The HTML report is a single self-contained file you can open in a browser or attach to a ticket.
Exit codes: 0 clean, 1 findings at or above --fail-on, 2 usage error.
Limitations
Remote servers that require OAuth (most hosted MCP servers) cannot be scanned at the tool level: the scanner cannot reuse Claude Code's tokens. Their configuration is still audited.
Interactive dashboard (MCP App)
security_dashboard is an MCP App: hosts that support MCP Apps (Claude Desktop, claude.ai, VS Code Copilot…) render it inline. It shows every server with its score and grade, findings filterable by severity and server, the OWASP MCP Top 10 breakdown, recommended permission rules, and Full scan and Pin buttons. Selecting a server tells Claude what you are looking at, so follow-up questions have context. Claude Code in a terminal gets the text summary instead.
To use it in Claude Desktop, add the server to claude_desktop_config.json and ask Claude to "open the MCP security dashboard":
The UI is a single self-contained HTML file. Server-supplied text reaches the page only as text (never as HTML), and the host's sandbox applies. Develop it with a local host that drives the real server: npm run dashboard:dev -- /path/to/project.
Runtime hooks
The hooks add about 40 ms per MCP call.
Trust model
- Read-only, apart from the pin file, the audit log, and
policy-init(which writes a file you asked for). - Network only when you opt in:
check_supply_chain/--supply-chainsend package names and versions to npm, PyPI and OSV. Theadversarial_testtool is the only one that calls tools. - Evidence from scanned servers is sanitised (invisible characters revealed, length capped) and labelled as untrusted data.
- Secrets are masked in all output.
- Static checks reduce risk. They do not prove a server safe: malicious behaviour in tool responses or server code is out of scope.
Development
test/fixtures/poisoned-server.mjs is a deliberately malicious server used by the end-to-end test.
Pro & Team (early access)
Everything above is free and stays free: it runs locally and needs no account. Paid plans add what needs a server: a daily threat feed of known malicious MCP servers and packages, alerts when a server you use ships changed tool descriptions, history, and team policies and dashboards. They are opt-in through MCP_SECURITY_API_KEY; see PRIVACY.md for exactly what is sent.
Interested? Join the early access list. Early sign-ups get launch pricing, including a limited lifetime license.
Security, privacy, license
- Found a vulnerability? See SECURITY.md.
- What is read, written and sent: PRIVACY.md.
- Changes: CHANGELOG.md.
- MIT, see LICENSE.
About the author
I'm Stefan Petrovici: passionate about IT, a husband and a father. I built mcp-security-guard on my own. I'm looking for a job.
I build web applications end to end, frontend, backend, APIs and deployment, and I'm happy to work on anything else that needs building. This repository shows how I work: tests, CI, careful documentation and attention to security.
I also build WordPress and WooCommerce plugins, available at pluginsforstores.com.
If your team is hiring, write to me at [email protected].
來源:README.md,提交 dbc07be
工具
0版本歷史
1- v0.7.0最新Oct 6, 2026


