MCPwner 是一个模型上下文协议(MCP)服务器,将安全测试工具集成到 LLM 驱动的工作流程中。它提供统一的接口,用于秘密扫描、静态分析(SAST)、软件组成分析(SCA)、基础设施即代码(IaC)安全、源码模糊测试、侦察、动态应用安全测试(DAST)以及包括 0 天发现在内的漏洞研究。
无需手动串联工具并将输出粘贴到 LLM 中,MCPwner 将结果标准化并直接流式传输到模型的工作上下文中。这实现了在安全研究生命周期中持续的推理、关联和攻击路径发现——从映射攻击面和识别已知漏洞到发现新型攻击向量。
注意:本项目正在积极开发中。在此处了解更多关于 MCP 的信息 here。
以下工具计划在未来的版本中实现。
用于武器化 SAST 中识别出的反序列化漏洞点的利用链和载荷生成器。Java、.NET 和 PHP 存在成熟的利用链生态系统;Python 通过恶意 pickle 生成覆盖(Ruby/Node 反序列化基于载荷,并归入下面的载荷语料库):
为上述工具提供支持的精选载荷和字典语料库:
"Enumerate and scan example.com" → MCPwner chains: Subfinder + Amass → Masscan + Nmap → httpx → Katana + gau → ffuf + Arjun
### 扫描 GitHub 仓库中的秘密```
"Scan https://github.com/example/repo for secrets"
→ MCPwner runs Gitleaks, TruffleHog, detect-secrets and correlates findings
"Run a security audit on my Python project" → MCPwner runs Bandit (SAST), OSV-Scanner (SCA), and secrets scanning
### 攻击路径分析```
"Find vulnerabilities in the authentication module"
→ MCPwner runs CodeQL queries, cross-references with secrets and SCA results
"Test for SQLi and XSS on http://localhost:8080" → MCPwner chains: sqlmap + Dalfox and verifies findings
## 安装
### 先决条件
**系统要求:**
- Docker 引擎 20.20+ 和 Docker Compose 2.20+
- 至少 8GB 内存(运行多个工具建议16GB)
- 20GB 可用磁盘空间(安全工具镜像较大)
- 支持的平台:Linux、macOS、Windows(使用 WSL2)
**MCP 客户端:**
- Claude Desktop、Cursor、Kiro 或任何 MCP 兼容的客户端
### 设置
1. **克隆仓库**: ```bash
git clone https://github.com/nedlir/mcpwner.git
cd mcpwner
一旦Docker容器运行,将MCPwner添加到你的MCP客户端:
重要:动态工具注册
MCPwner采用模块化、可选加入的架构。安全工具由Docker Compose profiles管理。
.env文件(COMPOSE_PROFILES=sast,secrets,reconnaissance,dast,etc)指示哪些容器被上线。或者,你可以覆盖此设置并通过CLI启动特定配置文件:docker compose --profile sast --profile dast up -d。semgrep),从.env中省略其类别(sast),并手动列出你需要的其他工具(bandit,gosec,codeql)。utilities类别中的工具(例如Linguist、WireMock、Chromium)被视为永久核心依赖。它们在执行docker compose up -d时无条件运行,以确保关键的跨工具依赖(如语言检测)始终可用。配置文件位置:
~/Library/Application Support/Claude/claude_desktop_config.json (macOS)mcp.json在你的项目或设置目录中一键安装(需要Docker运行):
手动配置:
将以下内容添加到你的MCP配置文件中:```json { "mcpServers": { "mcpwner": { "command": "docker", "args": ["exec", "-i", "mcpwner-server", "python", "src/server.py"], "env": {} } } }
重启你的 MCP 客户端以加载新的服务器配置。
### 扫描本地项目
要扫描来自主机上的项目,请通过在 `docker-compose.yaml` 中添加卷来将它们挂载到容器中:```yaml
services:
mcpwner:
volumes:
- /path/to/your/projects:/mnt/projects:ro
然后使用 create_workspace 工具,参数如下:
source_type="local"source="/mnt/projects/my-project"MCPwner 自动将工作区和 CodeQL 数据库元数据在容器重启之间持久化,通过共享 Docker 卷中的文件存储 (/workspaces/.metadata/)。无需配置——系统在启动时加载已有数据,并在每次操作后保存,使用原子写入防止损坏。
工作区清理控制:
cleanup_workspace 工具提供细粒度控制:
delete_files=True, delete_metadata=False - 释放磁盘空间但保留工作区历史记录(推荐)delete_files=True, delete_metadata=True - 完全移除工作区和元数据delete_files=False, delete_metadata=True - 从列表中移除但保留文件在磁盘上备份:```bash
docker run --rm -v mcpwner_workspaces:/data -v $(pwd):/backup
alpine tar czf /backup/workspaces-backup.tar.gz /data
docker run --rm -v mcpwner_workspaces:/data -v $(pwd):/backup
alpine tar xzf /backup/workspaces-backup.tar.gz -C /
## 架构
MCPwner 使用基于HTTP的容器间通信,以支持未来的远程部署。虽然当前针对本地使用进行了优化,但该架构只需最小修改即可适用于远程服务器部署。
**设计原则:**
- 容器隔离以确保安全工具执行
- 标准化的输出格式供LLM使用(SARIF/JSON)
- 可扩展的插件架构以支持新工具
- 无状态API(记忆由用户管理)
**架构概览:**```mermaid
graph LR
subgraph IDE[" "]
LLM[🤖<br/>LLM]
Client[MCP Client]
LLM -.-> Client
end
Server[MCPwner Server]
SAST[SAST Tools]
Secrets[Secrets Scanning]
SCA[SCA Tools]
Recon[Reconnaissance]
CodeQL[CodeQL Service]
Linguist[Language Detection]
Utilities[Utilities]
IaC[IaC Security]
Fuzzing[Source Fuzzing]
DAST[DAST Tools]
Client -->|JSON-RPC 2.0| Server
Server -->|HTTP| SAST
Server -->|HTTP| Secrets
Server -->|HTTP| SCA
Server -->|HTTP| Recon
Server -->|HTTP| CodeQL
Server -->|HTTP| Linguist
Server -->|HTTP| Utilities
Server -->|HTTP| IaC
Server -->|HTTP| Fuzzing
Server -->|HTTP| DAST
style LLM fill:#7C3AED,stroke:#5B21B6,stroke-width:3px,color:#fff
style Client fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff
style Server fill:#F5A623,stroke:#C17D11,stroke-width:3px,color:#fff
style SAST fill:#E74C3C,stroke:#C0392B,stroke-width:2px,color:#fff
style Secrets fill:#9B59B6,stroke:#7D3C98,stroke-width:2px,color:#fff
style SCA fill:#1ABC9C,stroke:#16A085,stroke-width:2px,color:#fff
style Recon fill:#00BCD4,stroke:#0097A7,stroke-width:2px,color:#fff
style CodeQL fill:#E67E22,stroke:#CA6F1E,stroke-width:2px,color:#fff
style Linguist fill:#3498DB,stroke:#2874A6,stroke-width:2px,color:#fff
style Utilities fill:#6D28D9,stroke:#4C1D95,stroke-width:2px,color:#fff
style IaC fill:#059669,stroke:#047857,stroke-width:2px,color:#fff
style Fuzzing fill:#B91C1C,stroke:#7F1D1D,stroke-width:2px,color:#fff
style DAST fill:#D35400,stroke:#A04000,stroke-width:2px,color:#fff
style IDE fill:none,stroke:#ddd,stroke-width:2px,stroke-dasharray: 5 5
MCPwner 通过 MCP 接口暴露以下工具:
工作空间管理:
create_workspace - 从本地路径、Git URL 或 GitHub 仓库初始化扫描工作空间list_workspaces - 列出所有可用工作空间cleanup_workspace - 移除工作空间及相关数据发现记录:
工作空间作用域,持久化到磁盘(<workspace>/findings/<id>.json),始终可用——无需容器或健康检查。这是多智能体深度研究流程的事实来源:每个假设、PoC 结果和审查结论都以发现条目的形式记录,而非散文文本。
upsert_finding - 创建或更新一个发现。默认与现有条目深度合并,因此一个智能体可以写入自己的子对象(例如 poc)而不会覆盖另一个智能体的字段(例如 review)list_findings - 列出工作空间中的所有发现,可选择按 status 过滤(例如 poc-confirmed、review-approved)get_finding - 按 ID 检索单个发现SAST(静态分析):
run_sast_scan - 运行静态分析工具(Semgrep, Bandit, Gosec, Brakeman, PMD, Psalm, NodeJsScan, Joern, YASA)get_sast_report - 获取 SAST 扫描结果sast_list_tools - 列出可用的 SAST 工具秘密检测:
run_secrets_scan - 运行秘密扫描工具(Gitleaks, TruffleHog, Whispers, detect-secrets, Hawk-Eye)get_secrets_report - 获取秘密扫描结果secrets_list_tools - 列出可用的秘密扫描工具SCA(软件组成分析):
run_sca_scan - 分析依赖项以查找漏洞(Grype, Syft, OSV-Scanner, Retire.js)get_sca_report - 获取 SCA 扫描结果sca_list_tools - 列出可用的 SCA 工具侦察:
run_reconnaissance_scan - 运行单个侦察工具(Subfinder, Amass, Nmap, Masscan, httpx, Katana, ffuf, bbot, gau, Arjun, wafw00f, Kiterunner)run_reconnaissance_chain - 按顺序链接多个侦察工具get_reconnaissance_report - 获取侦察扫描结果reconnaissance_list_tools - 列出可用的侦察工具CodeQL:
detect_languages - 通过 Linguist 检测代码库中的语言create_codeql_database - 创建 CodeQL 数据库进行分析list_databases - 列出可用的 CodeQL 数据库list_query_packs - 列出可用的查询包execute_query - 运行特定的 CodeQL 查询基础设施与 IaC 安全:
run_iac_scan - 扫描基础设施即代码以查找配置错误(Checkov, KICS, Terrascan, TFSec, Hadolint)get_iac_report - 获取 IaC 扫描结果iac_list_tools - 列出可用的 IaC 扫描工具源代码模糊测试:
run_fuzzing_scan - 针对每个目标的测试平台运行白盒、覆盖引导的模糊测试活动(Atheris, Jazzer, Jazzer.js, PHP-Fuzzer)get_fuzzing_report - 获取模糊测试崩溃结果(崩溃输入 + 堆栈跟踪)fuzzing_list_tools - 列出可用的模糊测试引擎,按检测到的语言过滤DAST(动态应用安全测试):
run_dast_scan - 运行动态应用安全测试工具(sqlmap, NoSQLMap, Commix, Dalfox, SSTImap, SSRFmap, jwt_tool, interactsh)get_dast_report - 获取 DAST 扫描结果dast_list_tools - 列出可用的 DAST 工具实用工具:
run_utilities_scan - 对实时目标运行实用工具(Linguist, WireMock, Mitmproxy, aiohttp, Headless Chromium)get_utilities_report - 获取实用工具扫描结果utilities_list_tools - 列出可用的实用工具及其配置选项健康与监控:
health_check - 检查服务器和工具的可用性list_tools - 列出所有可用工具及其状态MCPwner 执行可能进行入侵性操作的安全工具。仅在你拥有或明确授权测试的系统和代码库上使用——未经授权的访问是非法的。限制 MCP 服务器访问权限给授权用户,并考虑对生产部署进行网络隔离。在运行扫描前审查工具配置,因为某些工具可能产生大量网络流量或系统负载。记录工具执行和结果,注意安全扫描可能触发监控系统中的警报。在报告使用 MCPwner 发现的漏洞时,遵循负责任的披露实践。保持 Docker 镜像更新并定期扫描容器漏洞。切勿将 API 密钥、令牌或凭证提交到配置文件中——改用环境变量或密钥管理系统。
此外,在运行这些工具和访问第三方库时,你应自行负责安全;建议在沙箱环境中运行所有内容,无需特殊认证(在可行的情况下进行最小化和加固)。
![]() | ![]() | ![]() | ![]() |
|---|
| bbot | httpx | Katana | gau | Arjun |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| CodeQL | Psalm | Gosec | Bandit | Semgrep |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| Brakeman | PMD | NodeJsScan | Joern | YASA |
![]() | ![]() | ![]() | ![]() |
|---|
| Atheris | Jazzer | Jazzer.js | PHP-Fuzzer |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| Gitleaks | TruffleHog | detect-secrets | Whispers | Hawk-Eye |
![]() | ![]() | ![]() | ![]() |
|---|
| Grype | Syft | OSV-Scanner | Retire.js |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| Checkov | KICS | Terrascan | TFSec | Hadolint |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| sqlmap | NoSQLMap | Commix | Dalfox | SSTImap |
![]() |
|---|
| SSRFmap | jwt_tool | interactsh |
![]() | ![]() | ![]() | ![]() | ![]() |
|---|
| Linguist | WireMock | Mitmproxy | aiohttp | Chromium w. Playwright |