OWASP ZAP MCP Server

io.github.pierre3由 GitHub 帳號 pierre3 發布v1.1.0更新於 Oct 25, 2026

MCP server for OWASP ZAP vulnerability scanning with Docker management

概覽

AI 產生的概覽

讓 AI 助理驅動 OWASP ZAP 弱點掃描的 MCP 伺服器,支援爬蟲、主動掃描、告警與報告,並內建 Docker 管理

可以做什麼
透過 Docker Compose 工具啟動、停止 ZAP 容器,查看狀態與日誌,或以 URL 和 API 金鑰連線既有 ZAP 執行個體。使用標準爬蟲與 Ajax 爬蟲抓取目標,可指定已登入使用者,並監控掃描進度。執行主動與被動掃描,並可隨時停止。依風險等級分頁讀取告警,產生 HTML、JSON 或 XML 報告。管理情境、驗證方式、使用者、憑證與強制使用者模式,以支援驗證掃描。
適用情境
適合讓助理對你有權測試的網站執行 Web 安全掃描,從快速被動檢查到附報告的驗證主動掃描。適合已在使用 OWASP ZAP、希望從聊天用戶端驅動掃描流程的開發者與測試人員。
執行需求
以 .NET 工具在本機執行,需要 .NET 10 SDK。內建 ZAP 容器管理需要支援 docker compose 的 Docker;否則需透過 ZAP_BASE_URL 和 ZAP_API_KEY 環境變數指向既有 ZAP 執行個體。透過工具啟動容器時會自動產生 API 金鑰。
安裝前請注意
主動掃描會向目標送出真實攻擊流量,只應掃描你擁有或取得書面許可的系統。伺服器可啟動與移除 Docker 容器,也可刪除情境與使用者。驗證掃描需透過憑證工具儲存目標使用者名稱與密碼,ZAP API 金鑰屬於機密。README 含刻意存在弱點的範例應用,請勿對外暴露。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 OWASP ZAP MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

dotnet-zap-mcp

[NuGet] [NuGet Downloads] [Release]

MCP (Model Context Protocol) server for OWASP ZAP. Enables AI agents (Claude, GitHub Copilot, etc.) to drive ZAP vulnerability scanning via MCP.

Features

  • 45 MCP tools for controlling OWASP ZAP (scanning, alerts, spider, ajax spider, context, authentication, reports, etc.)
  • Built-in Docker Compose management (start/stop ZAP with a single tool call)
  • Zero-config setup: auto-generates API keys and extracts Docker assets
  • Works with any MCP-compatible client (Claude Desktop, VS Code, etc.)

Installation

bash
dotnet tool install -g dotnet-zap-mcp

Prerequisites

  • .NET 10 SDK
  • Docker (Docker Engine or Docker Desktop) with docker compose support (for built-in ZAP container management)

Configuration

Zero-config (recommended)

No configuration needed. The agent calls DockerComposeUp which automatically:

  1. Extracts Docker assets to ~/.zap-mcp/docker/
  2. Generates a random API key
  3. Starts the ZAP container on localhost:8090
  4. Waits for ZAP to become healthy
Data persistence

The ZAP container uses two Docker named volumes:

VolumeContainer PathPurpose
zap-home/home/zap/.ZAPZAP settings, contexts, sessions, scan policies (persisted across restarts)
zap-data/zap/wrk/dataShared directory for reports, session files, and context import/export

On the first launch, the template config.xml is copied into zap-home. On subsequent launches, only the API key is updated — any changes made through ZAP (contexts, authentication settings, scan policies, etc.) are preserved.

The zap-data volume contains:

  • reports/ — generated scan reports
  • sessions/ — saved ZAP sessions
  • contexts/ — exported context files

Claude Desktop / Claude Code

Add to your MCP configuration:

json
{  "mcpServers": {    "zap": {      "command": "zap-mcp"    }  }}

VS Code (Copilot)

Add to .vscode/mcp.json:

json
{  "servers": {    "zap": {      "command": "zap-mcp"    }  }}

With existing ZAP instance

If you already have a ZAP instance running, pass connection details via environment variables:

json
{  "mcpServers": {    "zap": {      "command": "zap-mcp",      "env": {        "ZAP_BASE_URL": "http://localhost:8090",        "ZAP_API_KEY": "your-api-key"      }    }  }}

Available Tools

Docker Management

ToolParametersDescription
DockerComposeUp—Start the ZAP container and wait for healthy
DockerComposeDown—Stop and remove the ZAP container
DockerComposeStatus—Check container status
DockerComposeLogstailGet recent container logs

ZAP Core

ToolParametersDescription
GetVersion—Verify ZAP connectivity
GetHosts—List recorded hosts
GetSites—List recorded sites
GetUrlsbaseUrlList recorded URLs for a base URL

Spider

ToolParametersDescription
StartSpiderurl, maxChildren, recurse, subtreeOnly, contextNameStart a spider scan to crawl and discover pages
GetSpiderStatusscanIdCheck spider progress (0-100%)
GetSpiderResultsscanIdGet URLs discovered by spider
StopSpiderscanIdStop a running spider scan

Active Scan

ToolParametersDescription
StartActiveScanurl, recurse, inScopeOnly, scanPolicyName, contextIdStart an active vulnerability scan
GetActiveScanStatusscanIdCheck active scan progress (0-100%)
StopActiveScanscanIdStop a running active scan

Passive Scan

ToolParametersDescription
GetPassiveScanStatus—Check passive scan progress (records remaining)

Alerts

ToolParametersDescription
GetAlertsSummarybaseUrlAlert counts by risk level
GetAlertsbaseUrl, start, count, riskIdDetailed alert list with pagination and risk filter

Reports

ToolParametersDescription
GetHtmlReport—Generate HTML scan report
GetJsonReport—Generate JSON scan report
GetXmlReport—Generate XML scan report

Context Management

ToolParametersDescription
GetContextList—List all contexts defined in ZAP
GetContextcontextNameGet context details (scope patterns, etc.)
CreateContextcontextNameCreate a new context
RemoveContextcontextNameDelete a context
IncludeInContextcontextName, regexAdd URL include pattern to context scope
ExcludeFromContextcontextName, regexAdd URL exclude pattern to context scope
ImportContextcontextFilePathImport a context file into ZAP
ExportContextcontextName, contextFilePathExport a context to file

Authentication

ToolParametersDescription
GetAuthenticationMethodcontextIdGet the authentication method configured for a context
SetAuthenticationMethodcontextId, authMethodName, authMethodConfigParamsSet authentication method (form-based, JSON-based, script-based, HTTP)
SetLoggedInIndicatorcontextId, loggedInIndicatorRegexSet regex pattern indicating logged-in state
SetLoggedOutIndicatorcontextId, loggedOutIndicatorRegexSet regex pattern indicating logged-out state

Users

ToolParametersDescription
GetUsersListcontextIdList all users for a context
CreateUsercontextId, nameCreate a new user
RemoveUsercontextId, userIdRemove a user
SetAuthenticationCredentialscontextId, userId, authCredentialsConfigParamsSet user credentials (username/password)
SetUserEnabledcontextId, userId, enabledEnable or disable a user

Forced User

ToolParametersDescription
SetForcedUsercontextId, userIdSet the forced user for a context
SetForcedUserModeEnabledenabledEnable or disable forced user mode globally
GetForcedUserStatuscontextIdGet forced user mode status and current forced user

Ajax Spider

ToolParametersDescription
StartAjaxSpiderurl, inScope, contextName, subtreeOnlyStart the Ajax Spider for JavaScript-heavy apps
StartAjaxSpiderAsUsercontextName, userId, url, subtreeOnlyStart the Ajax Spider as a specific user
GetAjaxSpiderStatus—Get Ajax Spider status (running/stopped)
GetAjaxSpiderResults—Get Ajax Spider results summary
StopAjaxSpider—Stop the Ajax Spider

Typical Workflow

  1. Agent calls DockerComposeUp to start ZAP
  2. Configure browser/Playwright to use ZAP as proxy (http://127.0.0.1:8090)
  3. Browse the target application through the proxy
  4. Agent calls StartSpider to crawl the application, then GetSpiderStatus to monitor progress
  5. Agent calls GetPassiveScanStatus to wait for passive scan completion
  6. Agent calls StartActiveScan on key pages, then GetActiveScanStatus to monitor progress
  7. Agent calls GetAlertsSummary and GetAlerts to retrieve vulnerability findings
  8. Agent calls GetHtmlReport or GetJsonReport to generate a scan report
  9. Agent calls DockerComposeDown when done

Note: ZAP settings (contexts, authentication, scan policies) are persisted in the zap-home Docker volume. You can stop and restart the container without losing configuration.

Try It Out (with the included vulnerable app)

This repository includes an intentionally vulnerable web application for trying out ZAP scanning. The app contains common vulnerabilities (XSS, SQL Injection, CSRF, Open Redirect) so ZAP can detect real findings.

Setup

bash
# Start ZAP and the vulnerable target appdocker compose -f tests/docker/docker-compose.test.yml up -d --build
# Wait until both containers are healthydocker compose -f tests/docker/docker-compose.test.yml ps

Then configure your MCP client to connect to this ZAP instance:

json
{  "mcpServers": {    "zap": {      "command": "zap-mcp",      "env": {        "ZAP_BASE_URL": "http://localhost:8090",        "ZAP_API_KEY": "test-api-key-for-ci"      }    }  }}

The vulnerable app is accessible at http://target from within the Docker network (used by ZAP), and at http://localhost:8080 from your host machine.

Example 1: Quick Scan

Prompt to agent:

Scan http://target for vulnerabilities. Run a spider crawl, wait for the passive scan to finish, then show me the alert summary and generate an HTML report.

Expected tool flow:

GetVersion          → Verify ZAP connectivityStartSpider         → url: "http://target"GetSpiderStatus     → Poll until 100%GetPassiveScanStatus → Poll until 0 records remainingGetAlertsSummary    → baseUrl: "http://target"GetAlerts           → baseUrl: "http://target"GetHtmlReport       → Generate report

ZAP will discover pages like /search, /login, /users, /about, /contact, and the passive scan will report issues such as missing security headers and CSRF vulnerabilities.

Example 2: Authenticated Scan

The /admin page requires login (username: admin, password: password). An authenticated scan lets ZAP access protected pages.

Prompt to agent:

Set up an authenticated scan for http://target. The login form is at /login with fields "username" and "password" (credentials: admin / password). The logged-in indicator is "Welcome, admin". After configuring authentication, spider the site as the authenticated user and run an active scan.

Expected tool flow:

CreateContext                   → contextName: "target-auth"IncludeInContext                → regex: "http://target.*"SetAuthenticationMethod         → contextId, authMethodName: "formBasedAuthentication",                                  authMethodConfigParams: "loginUrl=http://target/login&loginRequestData=username%3D%7B%25username%25%7D%26password%3D%7B%25password%25%7D"SetLoggedInIndicator            → loggedInIndicatorRegex: "Welcome, admin"CreateUser                      → contextId, name: "admin"SetAuthenticationCredentials    → contextId, userId, authCredentialsConfigParams: "username=admin&password=password"SetUserEnabled                  → contextId, userId, enabled: trueSetForcedUser                   → contextId, userIdSetForcedUserModeEnabled        → enabled: trueStartSpider                     → url: "http://target", contextName: "target-auth"GetSpiderStatus                 → Poll until 100%GetPassiveScanStatus            → Poll until 0 records remainingStartActiveScan                 → url: "http://target"GetActiveScanStatus             → Poll until 100%GetAlertsSummary                → baseUrl: "http://target"GetAlerts                       → baseUrl: "http://target"SetForcedUserModeEnabled        → enabled: false

With authentication configured, ZAP can access /admin and test for vulnerabilities behind the login.

Example 3: Full Vulnerability Assessment

Prompt to agent:

Perform a full vulnerability assessment of http://target. Crawl the site, run an active scan, then give me a detailed breakdown of all discovered vulnerabilities grouped by risk level.

Expected tool flow:

StartSpider          → url: "http://target", recurse: trueGetSpiderStatus      → Poll until 100%GetSpiderResults     → Review discovered URLsGetPassiveScanStatus → Poll until 0 records remainingStartActiveScan      → url: "http://target", recurse: trueGetActiveScanStatus  → Poll until 100%GetAlertsSummary     → baseUrl: "http://target"GetAlerts            → baseUrl: "http://target", riskId: "3" (High)GetAlerts            → baseUrl: "http://target", riskId: "2" (Medium)GetAlerts            → baseUrl: "http://target", riskId: "1" (Low)GetHtmlReport        → Generate final report

The active scan will detect vulnerabilities including:

  • High: SQL Injection (/users?id=), Cross Site Scripting (/search?q=)
  • Medium: CSRF (missing tokens on /login), Open Redirect (/redirect?url=)
  • Low/Informational: Missing security headers, cookie issues, etc.

Cleanup

bash
docker compose -f tests/docker/docker-compose.test.yml down -v

License

MIT

來源:README.md,提交 e9c2b67

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.1.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分