> ## Documentation Index
> Fetch the complete documentation index at: https://docs.panguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 透過 MCP 整合 AI 助手

> 用 MCP 把 Panguard 接上 Claude Desktop、Cursor 或 Windsurf，用自然語言做安全操作。

Panguard 內建 MCP (Model Context Protocol) server，把安全工具暴露給 AI 助手。你可以透過 AI coding 助手用自然語言跑掃描、查 Guard 狀態、查威脅、部署蜜罐。

<Steps>
  <Step title="什麼是 MCP">
    MCP (Model Context Protocol) 是連接 AI 助手和外部工具的開放標準。Panguard 的 MCP server 把安全操作包裝成 AI 助手可以幫你呼叫的工具。

    支援的 AI 助手：

    | 助手                 | Config 位置                                                                 |
    | ------------------ | ------------------------------------------------------------------------- |
    | **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) |
    | **Claude Code**    | `~/.claude/settings.local.json`                                           |
    | **Cursor**         | `~/.cursor/mcp.json`                                                      |
    | **QClaw**          | `~/.qclaw/mcp.json`                                                       |
    | **OpenClaw**       | `~/.openclaw/skills/panguard/SKILL.md`（原生 Skill）                          |
    | **Codex**          | `~/.codex/mcp.json`                                                       |
    | **WorkBuddy**      | `~/.workbuddy/.mcp.json`                                                  |
    | **NemoClaw**       | `~/.nemoclaw/mcp.json`                                                    |
    | **ArkClaw**        | `~/.arkclaw/mcp.json`                                                     |

    <Info>
      跑 `panguard setup` 就能自動偵測並設定所有平台。不需登入。
    </Info>
  </Step>

  <Step title="加入 MCP config">
    把 Panguard MCP server 加到你 AI 助手的 config 檔：

    <Tabs>
      <Tab title="Claude Desktop">
        編輯 `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) 或 `%APPDATA%\Claude\claude_desktop_config.json` (Windows)：

        ```json theme={null}
        {
          "mcpServers": {
            "panguard": {
              "command": "panguard",
              "args": ["mcp", "serve"],
              "env": {}
            }
          }
        }
        ```
      </Tab>

      <Tab title="Cursor">
        在專案根目錄建立或編輯 `.cursor/mcp.json`：

        ```json theme={null}
        {
          "mcpServers": {
            "panguard": {
              "command": "panguard",
              "args": ["mcp", "serve"],
              "env": {}
            }
          }
        }
        ```
      </Tab>

      <Tab title="Windsurf">
        編輯 `~/.windsurf/mcp.json`：

        ```json theme={null}
        {
          "mcpServers": {
            "panguard": {
              "command": "panguard",
              "args": ["mcp", "serve"],
              "env": {}
            }
          }
        }
        ```
      </Tab>
    </Tabs>

    存檔後重啟 AI 助手讓設定生效。
  </Step>

  <Step title="可用的 MCP 工具">
    Panguard MCP server 暴露這些工具給 AI 助手：

    | 工具                      | 說明                |
    | ----------------------- | ----------------- |
    | `scan_system`           | 跑安全掃描，回傳發現        |
    | `guard_status`          | 查 Guard 引擎狀態和近期事件 |
    | `guard_start`           | 啟動 Guard 引擎       |
    | `guard_stop`            | 停止 Guard 引擎       |
    | `get_threats`           | 查威脅情報和 IoC        |
    | `deploy_honeypot`       | 在指定服務/port 部署蜜罐   |
    | `get_attacker_profiles` | 取得攻擊者分析報告         |
    | `generate_report`       | 產生合規報告            |
    | `get_security_score`    | 取得目前風險分數和等級       |
    | `list_events`           | 列出近期 Guard 事件，可篩選 |
  </Step>

  <Step title="用自然語言做安全操作">
    設好之後，你可以直接用自然語言跟 AI 助手互動：

    <AccordionGroup>
      <Accordion title="跑安全掃描">
        **你：**「幫我掃描系統有沒有安全問題」

        助手會呼叫 `scan_system`，把發現、風險分數、建議整理成好讀的格式。
      </Accordion>

      <Accordion title="查防護狀態">
        **你：**「Guard 有在跑嗎？最近有什麼警報？」

        助手會呼叫 `guard_status` 和 `list_events`，給你完整的狀態概覽。
      </Accordion>

      <Accordion title="調查威脅">
        **你：**「查一下 IP 203.0.113.42 的資訊」

        助手會呼叫 `get_threats` 和 `get_attacker_profiles`，彙整威脅情資。
      </Accordion>

      <Accordion title="產生合規報告">
        **你：**「產生 ISO 27001 合規報告」

        助手會用 ISO 27001 框架呼叫 `generate_report` 並呈現結果。
      </Accordion>

      <Accordion title="部署蜜罐">
        **你：**「架 SSH 跟 HTTP 蜜罐來抓攻擊者」

        助手會為每種服務呼叫 `deploy_honeypot`，確認部署完成。
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="驗證連線">
    測試 AI 助手能不能連到 Panguard MCP server：

    ```bash theme={null}
    panguard mcp test
    ```

    ```
      PANGUARD AI - MCP Server

      -- Connection Test ------------------------

      Server:     Running (stdio transport)
      Tools:      10 registered
      Auth:       Authenticated (user@example.com)

      MCP server is ready for AI assistant connections.
    ```
  </Step>
</Steps>

## 下一步

<CardGroup cols={2}>
  <Card title="MCP 產品參考" icon="book" href="/products/mcp/overview">
    MCP server 架構和功能的完整文件。
  </Card>

  <Card title="MCP 工具參考" icon="wrench" href="/products/mcp/tools-reference">
    每個 MCP 工具的 schema，含參數和回傳型別。
  </Card>

  <Card title="第一次掃描" icon="magnifying-glass" href="/guides/first-scan">
    用 AI 輔助掃描之前，先了解掃描輸出。
  </Card>

  <Card title="即時防護" icon="shield-halved" href="/guides/real-time-protection">
    設好 Guard 讓 AI 助手能監控和回應威脅。
  </Card>
</CardGroup>
