M

MCP 安全扫描(MCP Security Scan)

作者:注册老炮@MedXpert I SynomosAIv6

当用户说『接了个MCP server不放心』『MCP工具能执行命令怕有风险』『怎么审计MCP权限』『第三方MCP会不会偷数据』,或要把某 MCP server(模型上下文协议)接进 agent、担心它是新攻击面时使用。把 MCP server 当『需审查的第三方』:扫工具清单里的 命令执行/文件系统写/网络外联/凭证暴露 四类风险,给风险评级与最小授权建议。理论根基:LGD 三律(有籍·有证·有门禁)。触发词:MCP安全、mcp security、MCP审计、MCP权限、第三方MCP、MCP风险、server扫描、协议安全。

下载量
264
点赞
66
价格
免费

技能文档

---
name: mcp-security-scan
display_name: MCP 安全扫描(MCP Security Scan)
display_name_en: "MCP Security Scan"
description: "当用户说『接了个MCP server不放心』『MCP工具能执行命令怕有风险』『怎么审计MCP权限』『第三方MCP会不会偷数据』,或要把某 MCP server(模型上下文协议)接进 agent、担心它是新攻击面时使用。把 MCP server 当『需审查的第三方』:扫工具清单里的 命令执行/文件系统写/网络外联/凭证暴露 四类风险,给风险评级与最小授权建议。理论根基:LGD 三律(有籍·有证·有门禁)。触发词:MCP安全、mcp security、MCP审计、MCP权限、第三方MCP、MCP风险、server扫描、协议安全。"
version: 1.1.1
agent_created: true
author: 诺声(Logos)@SynomosAI
license: MIT
license_scope: 代码(.py 文件)MIT;本 SKILL.md 与其中理论文本不在 MIT 覆盖范围内(见文末「License & attribution」)
allowed-tools: Read, Glob, Grep, Write, WebFetch
category: AI安全
platforms: [windows, macos, linux]
platform_compatibility: [windows, macos, linux]
read_when:
  - 要把第三方 MCP server 接进 agent
  - 担心 MCP 工具能执行命令/读写文件/外联
  - 问「怎么审计 MCP 权限」
  - 怕 MCP 偷数据或越权
tags: [MCP安全, mcp security, MCP审计, 协议安全, 第三方审查, 最小授权, AI安全, 攻击面]
slug: mcp-security-scan
title: MCP 安全扫描(MCP Security Scan)
copyright: SynomosAI
description_zh: "当用户说『接了个MCP server不放心』『MCP工具能执行命令怕有风险』『怎么审计MCP权限』『第三方MCP会不会偷数据』,或要把某 MCP server(模型上下文协议)接进 agent、担心它是新攻击面时使用。把 MCP server 当『需审查的第三方』:扫工具清单里的 命令执行/文件系统写/网络外联/凭证暴露 四类风险,给风险评级与最小授权建议。理论根基:LGD 三律(有籍·有证·有门禁)。触发词:MCP安全、mcp security、MCP审计、MCP权限、第三方MCP、MCP风险、server扫描、协议安全。"
description_en: "Security-scan MCP servers before onboarding: tool-permission audit, command-execution risk, data-exfiltration surface and prompt-injection exposure analysis."
classification:
  skillhub: ["security-compliance"]
  iso_25010: ["Security"]
risk_tier: medium
risk_rationale: "门禁批量补丁默认 medium(内部约定:本 skill 设计为中等风险):调用 API/读写文件/本地执行,最小权限,密钥走 Secret;若实际涉对外代执行(push/发布/发送/上架)须人工复评,改 high 并走负责人批准。"
ai_protocol: true


spec: usk/1.0
interface:
  type: cli
  entry_point: scripts/mcp_scan.py
  runtime: python3
  call_pattern: args
input_schema:
  tools:
    type: string
    description: "tools"
    required: true
  json:
    type: bool
    description: "json"
    required: false
output_schema:
  stdout: 结构化 JSON IR(含 result / rc / error_code / warnings)
  exit_code: rc=0 正常 / rc=1 告警或从严推定 / rc=2 输入不足或非法
capabilities:
  - mcp
  - security
  - scanning
permissions:
  network: false
  filesystem: false
  subprocess: false
requirements:
  python_packages: []
  min_python: "3.8"
changelog: "1.1.1: Bilingual rewrite (full EN+ZH, English first); read_when kept; 1.0.0: initial upload (USK v3)"
---

> 凡自治之物 · LGD 治理学 · 创造术家族 | 评测协议:skill-quality-gate

## English

### When to use
- When the user plans to connect a third-party MCP server to the current agent and needs to assess whether it introduces a new attack surface.
- When the user is concerned about MCP tools executing commands, file-write access or network egress.
- Whenever auditing MCP permissions and confirming LGD three-laws (registered · evidenced · gated) compliance — this skill must be used for pre-onboarding review.

### Usage
Call the main script `mcp_scan.py` with the target MCP server's config or metadata as input. Specify `target_server_name`, `access_config` and risk concerns (e.g. `command_exec`, `fs_write`). The skill reads its built-in security rules, runs the simulated detection and returns a standardized JSON report with detailed risk categories and the LGD compliance verdict.

### Workflow
First, receive the MCP server's identity and config description, confirming it is a "third party under review". Then run `mcp_scan.py` to score the four risk classes: command execution, filesystem write, network egress and credential exposure. Cross-validate against the LGD three-laws model that the permission boundary is closed and traceable. Finally, generate the report with risk rating (high/medium/low) and least-privilege recommendations, for the decision-maker to admit or circuit-break.

### Evidence & safety statement
- Evidence: TBD (no evaluation / badge link yet; update here once it is produced)
- Version: 1.1.1
- Security: no independent security scan has been performed (TBD); the conclusion is pending and no endorsement is given until it is completed.

## 中文

### 何时用
当用户计划将第三方 MCP server 接入当前 Agent,需评估其是否构成新的安全攻击面时。
当检测到用户对 MCP 工具执行命令、文件写权限或网络外联存在风险疑虑时。
在涉及如何审计 MCP 权限及确认 LGD 三律(有籍·有证·有门禁)合规性时,必须使用此技能进行前置审查。

### 用法
调用主脚本 `mcp_scan.py` 并注入目标 MCP server 的配置信息或元数据作为输入参数。需指定 `target_server_name`、`access_config` 以及风险关注点(如 `command_exec`, `fs_write`)。技能将读取脚本内的安全规则,执行模拟检测逻辑,并返回标准化的 JSON 格式报告,包含详细的风险分类与 LGD 合规判定结果。

### 流程
首先接收 MCP server 的身份信息与配置描述,确认其作为“需审查的第三方”属性;其次运行 `mcp_scan.py` 对命令执行、文件系统写、网络外联及凭证暴露四大类风险进行扫描与打分;接着依据 LGD 三律模型交叉验证权限边界是否封闭且可追溯;最后生成包含风险评级(高/中/低)与最小授权建议的最终报告,供决策者执行准入或熔断。

### 证据与安全声明
- 证据:TBD(暂无评测/徽章链接;产生后在此更新实际链接)
- 版本:1.1.1
- 安全:未做独立安全扫描(TBD),结论待补;补全前不作推荐背书。

使用说明

# mcp-security-scan · MCP 安全扫描

[![LGD Powered](lgd-powered.png)](https://github.com/zhaoxinghua09-cell/lgd-theory)

## English

An MCP server is a *third party to audit*. Before connecting, scan its tool list for command-exec / file-write / network-egress / credential-exposure risks, rate each tool and advise least-privilege. Ships a zero-dependency `mcp_scan.py`.

### Why it beats "connect and trust"
| Pain | This skill |
|---|---|
| MCP can run shell | command-exec flagged high |
| Silent data exfil | network-egress flagged |
| Token in tool description | credential-exposure flagged |
| "Just enable all tools" | least privilege, disable extras |

### What's inside
- `SKILL.md` — 4-risk model + 3-step audit flow + hard rules
- `scripts/mcp_scan.py` — zero-dependency CLI: scan a tools.json (name+description), rate risk per tool plus overall advice

```bash
python scripts/mcp_scan.py --tools tools.json
python scripts/mcp_scan.py --tools tools.json --json
```

### Benchmark vs alternatives
| Tool | Gap this fills |
|---|---|
| MCP auth scopes | pre-connect tool-level risk rating |
| Manual read of tools | repeatable lexical scan |
| "It's official" | explicit high-risk flag, not trust |

Theoretical root: **LGD Three Laws** (registered · evidenced · gated). Pairs with `tool-call-guard` and `prompt-injection-shield`.

## 中文

把 MCP server 当需审查的第三方:接前扫工具清单的命令执行/文件写/网络外联/凭证暴露四类风险,给评级与最小授权建议。零依赖 `mcp_scan.py`。

### 为什么胜过「接上就信」
| 痛点 | 本技能 |
|---|---|
| MCP 能跑 shell | 命令执行标高危 |
| 静默数据外传 | 网络外联标红 |
| 工具描述里带 token | 凭证暴露标红 |
| 「全部工具开了再说」 | 最小授权,多余禁用 |

### 包内构成
- `SKILL.md` — 四类风险模型 + 三步审计流程 + 铁律
- `scripts/mcp_scan.py` — 零依赖 CLI:扫 tools.json(名称+描述),逐工具评级并给总体建议

```bash
python scripts/mcp_scan.py --tools tools.json
python scripts/mcp_scan.py --tools tools.json --json
```

### 与替代方案的对比
| 工具 | 本技能补的位 |
|---|---|
| MCP 授权域 | 接前工具级风险评级 |
| 人工读工具列表 | 可复现的词法扫描 |
| 「官方的没事」 | 显式高危标记,不靠信任 |

理论根基:**LGD 三律**(有籍·有证·有门禁)。与 `tool-call-guard`、`prompt-injection-shield` 配套。

---

© 2026 SynomosAI. All rights reserved.

---

## License & attribution
**分层许可(务必并读;代码许可不覆盖文档与理论文本)**

- **代码**(本包 `.py` 文件):**MIT**
- **本 `README.md` / `SKILL.md` 及其中的理论文本、方法论与一切理论表述**:**不在 MIT 覆盖范围内**,保留所有权利(All rights reserved)

```
© 2026 SynomosAI · China. All rights reserved.
理论署名 (attribution) : LGD(Lifecycle Governance Doctrine / 全程治理论)— SynomosAI initiative
名称状态 (name status)  : "SynomosAI" — 未申请实体注册、未申请商标注册
                        (not a registered legal entity; no trademark registered)
生产参考部署 (production reference, self-reported) : 无(未声明外部生产参考部署)
                    ← 非认证、非背书、非监管认可(not a certification or endorsement)
代码许可 (code license) : 本包未附 LICENSE 文件(许可待定)
                    本文本与理论表述不在任何代码许可覆盖范围内
引用格式 (cite as)      : 本资产无 DOI
```
(上列为《LGD 对外表述规范》§3.2 统一块,**整体复制、未删改**;发布/重提前须照最新版本复核。)

如何安装此技能?

访问技能市场,点击「安装」按钮,按提示将技能包放入 AI 编程助手的 skills 目录即可。

浏览技能市场

支持平台:Qoder · QoderWork · Claude · Codex 等 AI 编程助手