Mcp Server Auditor

io.github.GuardBee由 GitHub 账号 GuardBee 发布v0.4.1更新于 Nov 3, 2026

Scans MCP server tool definitions for excessive agency, injection sinks, hardcoded secrets

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

本地 MCP 服务器,用于扫描其他 MCP 服务器的工具定义与代码,发现过度授权、注入汇聚点、硬编码密钥等不安全模式。

可以做什么
  • 扫描文本字符串或代码片段中的不安全 MCP 工具定义模式
  • 扫描单个文件,或递归扫描整个服务器代码库,自动跳过 node_modules、.git、dist 和二进制文件
  • 检测过度授权、不安全输入(shell、eval、文件写入、SSRF、SQL)、过宽松的 schema、密钥泄露和通配符 CORS,并对 Python 和 Go 做工具输入流向检查
  • 按类别列出支持检测的模式
  • 为每条发现给出风险说明与修复建议
适用场景
适合在开发或引入某个 MCP 服务器时做安全审查,或在把工具定义交给助手之前做一次快速的静态安全检查。结果是启发式的,适合作为初步筛查,不能替代人工审计。
运行要求
以本地 stdio 进程运行,通常通过 npx 启动 npm 包 @guardbee/mcp-server-auditor,因此需要 Node.js 以及下载该包的网络访问。未声明需要账号、API 密钥或环境变量。
安装前请注意
扫描会读取你指定路径下的源代码,请只指向你有权查看的代码。结果是基于文本模式的启发式匹配,并非完整的 AST 分析,仍需人工复核。遥测默认关闭;设置 GUARDBEE_TELEMETRY=1 后会向第三方发送服务器、工具、成功与否、耗时以及文件路径等短参数值,较长的字符串和 content、token、password 等字段会被替换为占位符。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Server Auditor,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@guardbee/mcp-server-auditor

🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch

[npm version] [npm downloads] [License: MIT]

An MCP (Model Context Protocol) server that scans other MCP servers' tool definitions for insecure patterns.

While ai-code-scanner looks at general LLM/AI integration code, this package specifically looks at an MCP server itself: how privileged a tool defined via server.tool(...) is, how loose its parameters are, which dangerous sinks (shell/filesystem/HTTP/SQL) its handler passes tool input into directly. The MCP ecosystem is growing fast, but there's no common tool yet for auditing these servers' security.

Telemetry is off by default. With GUARDBEE_TELEMETRY=1 it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields like content, token or password are replaced with a placeholder. See @guardbee/mcp-telemetry.

Claude ──► mcp-server-auditor ──► An MCP server's source code              │              ├─ Excessive agency    (execSync(input.command), a tool named "run_shell")              ├─ Unsafe input        (fetch(input.url) → SSRF, SQL string interpolation)              ├─ Loose schema        (a parameter typed z.any()/z.unknown())              ├─ Secrets exposure    (a hardcoded API key in a schema default, the entire process.env)              └─ Network exposure    (wildcard CORS)

Features

  • 10 patterns, 5 categories — excessive-agency, unsafe-input, loose-schema, secrets-exposure, network-exposure
  • Python and Go servers: tool input followed from the tool definition (FastMCP parameters, low-level arguments, go-sdk typed args, mcp-go request.RequireString(...)) through plain assignments into shell, file write/delete, HTTP and SQL calls
  • Every finding includes why it's risky and what to do about it (recommendation) — not just "found it"
  • SARIF 2.1.0 output — CI/CD integration (GitHub Code Scanning, etc.)
  • Config file support via guardbee.yml
  • A positive and a negative (false-positive) test for every pattern, with vulnerable and clean Python and Go fixtures

Quick Start

Claude Desktop / MCP Client

json
{  "mcpServers": {    "guardbee-mcp-server-auditor": {      "command": "npx",      "args": ["-y", "@guardbee/mcp-server-auditor"]    }  }}

CLI (CI/CD)

bash
npx @guardbee/mcp-server-auditor scan ./src --fail-on=high --format=sarif > results.sarif

MCP Tools

ToolDescription
scan_textScans a given text/code snippet
scan_fileScans a single file
scan_directoryRecursively scans a directory (node_modules, .git, dist skipped automatically)
list_patternsLists all supported patterns by category

Detected Patterns

CategoryPatternSeverityOWASPWhat it means
excessive-agencyshell_exec_from_tool_inputcriticalMCP05:2025A tool handler passes tool input directly into a shell call like execSync/spawn
excessive-agencyeval_of_tool_inputcriticalMCP05:2025Tool input is executed as code via eval()/new Function()
excessive-agencyunrestricted_shell_tool_namehighMCP05:2025A tool name (run_shell, execute_sql, etc.) implies shell/SQL execution directly
unsafe-inputfs_write_from_raw_tool_inputhighA path from tool input flows into a file write/delete call with no validation (path traversal)
unsafe-inputssrf_fetch_from_tool_inputhighA URL from tool input flows directly into fetch/axios with no allowlist (SSRF)
unsafe-inputsql_injection_via_tool_inputcriticalMCP05:2025Tool input is interpolated into a SQL string via a template literal
loose-schemaoverly_permissive_tool_schemamediumA tool parameter is typed z.any()/z.unknown() — accepts anything
secrets-exposurehardcoded_secret_in_tool_schemacriticalA credential-shaped schema field's default value is a hardcoded literal
secrets-exposurefull_env_exposed_to_tool_callercriticalThe entire process.env is spread/stringified/returned (not one named variable)
network-exposurepermissive_cors_on_servermediumWildcard CORS (Access-Control-Allow-Origin: *) or cors() with no options

Python and Go

Python (.py) and Go (.go) files also get a tool-input flow check. The tool's input names come from its definition, are followed through plain assignments in the handler (command = f"du {directory}"), and a finding is reported when one reaches a sink call:

PatternSeveritySinks
python_shell_from_tool_inputcriticalsubprocess.*, os.system, os.popen, asyncio.create_subprocess_*
python_eval_of_tool_inputcriticaleval, exec
python_fs_write_from_tool_inputhighopen(..., "w"/"a"/"x"), os.remove/rename/…, shutil.rmtree/move, Path(...).write_text/unlink
python_ssrf_from_tool_inputhighrequests.*, httpx.*, client.get(...), urlopen (URL argument)
python_sql_injection_via_tool_inputcriticalcursor.execute(f"...{x}..."), % / .format / +
go_shell_from_tool_inputcritical (sh -c), high (argument list)exec.Command, exec.CommandContext
go_fs_write_from_tool_inputhighos.WriteFile, os.Remove, os.RemoveAll, os.Rename, os.Create, os.OpenFile for writing
go_ssrf_from_tool_inputhighhttp.Get/Post/NewRequest…, client.Get
go_sql_injection_via_tool_inputcriticaldb.Query…/Exec… with fmt.Sprintf or +

File findings are skipped when the handler checks the path against a base directory (is_relative_to, commonpath, .parents, filepath.IsLocal, filepath.Rel, strings.HasPrefix), and HTTP findings when it checks a host allowlist. Tools named run_shell, execute_sql etc. are reported for both languages. Rust, Java, Kotlin, C# and other languages get the language-neutral patterns only.

These are heuristic findings — a static text-pattern scan, not a full AST/type analysis. Designed for a low false-positive rate, but every finding should still be reviewed manually.


Configuration (guardbee.yml)

yaml
mcp-server-auditor:  fail-on: high       # any | critical | high | medium | low | none  max-files: 5000  exclude:    - ".test.ts"    - "fixtures/"

Development

bash
npm run buildnpm test

License

MIT — GuardBee

Feedback

Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.

来源:packages/mcp-server-auditor/README.md,提交 82be7b9

工具

4

scan_text

Scan a text string or code snippet for insecure MCP server/tool-definition patterns (excessive-agency tool names, shell/eval/SQL/SSRF sinks fed by raw tool input, overly permissive schemas, hardcoded secrets, wildcard CORS).

输入参数labelcontent必填

scan_file

Scan a single file for insecure MCP server/tool-definition patterns

输入参数path必填

scan_directory

Recursively scan an MCP server's codebase for insecure tool-definition patterns. Automatically skips node_modules, .git, dist, and binary files.

输入参数path必填excludeincludemaxFiles

list_patterns

List all MCP server security patterns that the auditor can detect, grouped by category

无需输入参数。

版本历史

6
  1. v0.4.1最新Oct 30, 2026
  2. v0.3.0Oct 29, 2026
  3. v0.2.2Oct 22, 2026
  4. v0.2.1Oct 22, 2026
  5. v0.1.9Oct 13, 2026
  6. v0.1.8Oct 9, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分