ZAP-MCP Server 使用说明
项目简介
ZAP-MCP Server 是一个基于 Model Context Protocol (MCP) 构建的应用后端,旨在连接 OWASP ZAP 强大的安全扫描能力与 AI 模型。通过标准化的 MCP 协议,AI 模型可以调用 ZAP 的功能进行自动化安全测试和漏洞分析。
主要功能点
- AI 驱动的安全测试: 允许 AI 模型通过 MCP 协议调用 OWASP ZAP 的安全扫描功能,实现智能化的安全测试流程。
- 实时扫描监控: 提供扫描进度跟踪和实时告警功能,让用户及时了解扫描状态。
- 自动化分析报告: 自动生成安全报告和漏洞分析建议,辅助用户进行安全决策。
- 灵活集成: 通过 MCP 协议,可以与各种兼容 MCP 协议的 AI 客户端 (如 Claude Desktop) 集成。
- WebSocket 通信: 使用 WebSocket 实现实时数据更新和双向通信。
- REST API: 提供 RESTful API 接口,方便用户进行程序化访问和集成。
安装步骤
-
克隆仓库:
git clone https://github.com/ajtazer/ZAP-MCP.git cd ZAP-MCP -
安装依赖:
pip install -r requirements.txt cd zap_mcp pip install -r requirements.txt # 再次安装 zap_mcp 目录下的依赖 cd ..注意:仓库根目录和 'zap_mcp' 目录下都有 'requirements.txt',都需要安装。
-
配置服务器:
- 复制 'claude_desktop_config.json' 文件到您 Claude 应用的配置目录 (如果需要与 Claude Desktop 集成)。
- 修改 'zap_mcp/.env' 文件,配置 ZAP API 密钥 ('ZAP_API_KEY') 和 ZAP API URL ('ZAP_API_URL'),以及其他服务器设置。
-
启动服务器:
python -m zap_mcp.server或者使用 'run.py' 脚本:
python run.py
服务器配置
以下 JSON 配置信息用于 MCP 客户端连接 ZAP-MCP 服务器。请根据实际情况进行配置,并将此配置提供给您的 MCP 客户端。
{ "serverName": "ZAP-MCP Server", "command": "python", "args": [ "-m", "zap_mcp.server" ], "protocol": "websocket", "address": "ws://localhost:8000/events", "description": "ZAP Security Scan Server", "tools": [ { "name": "start_scan", "description": "Start a new ZAP security scan on a target URL.", "parameters": [ {"name": "target_url", "type": "string", "description": "The URL to scan."} ] }, { "name": "get_scan_status", "description": "Check the status of a running scan.", "parameters": [ {"name": "scan_id", "type": "string", "description": "The ID of the scan."} ] }, { "name": "get_scan_results", "description": "Get the results of a completed scan.", "parameters": [ {"name": "scan_id", "type": "string", "description": "The ID of the scan."} ] }, { "name": "generate_report", "description": "Generate a security report for a scan.", "parameters": [ {"name": "scan_id", "type": "string", "description": "The ID of the scan."}, {"name": "report_format", "type": "string", "description": "The format of the report (html, json)."} ] } ] }
- 'serverName': 服务器名称,自定义。
- 'command': 启动服务器的命令,这里使用 'python'。
- 'args': 启动服务器命令的参数,'"-m zap_mcp.server"' 表示运行 'zap_mcp.server' 模块。
- 'protocol': 通信协议,这里使用 'websocket'。
- 'address': WebSocket 服务器地址,ZAP-MCP 默认地址为 'ws://localhost:8000/events' (SSE endpoint, check server code '/events' path).
- 'description': 服务器描述信息,自定义。
- 'tools': 服务器提供的工具列表,每个工具包含名称、描述和参数信息。这些工具对应 ZAP-MCP Server 提供的功能,例如启动扫描、获取扫描状态等。
基本使用方法
- 确保 OWASP ZAP 应用程序已启动并运行。
- 启动 ZAP-MCP Server (按照安装步骤)。
- 配置您的 MCP 客户端 (例如 Claude Desktop 应用),导入上面提供的服务器配置 JSON。
- 在 MCP 客户端中,您可以使用定义的工具 (例如 'start_scan'),并提供相应的参数 (例如 'target_url'),即可调用 ZAP-MCP Server 的功能,进行安全扫描和分析。
信息
分类
开发者工具