WebExtrator MCP 串接指南

WebExtrator MCP 可以渲染由 JavaScript 載入的網頁並回傳 HTML,也可以直接從網頁中擷取文章、商品等結構化內容。較慢的頁面可以非同步處理。

連線至託管服務

在用戶端選擇遠端 MCP(Streamable HTTP),伺服器位址填寫 https://webextrator.mcp.acedata.cloud/mcp。選擇 OAuth 後,按瀏覽器提示登入 Ace Data Cloud 並授權。

用戶端 如何連線
Claude / Claude Desktop 在「Customize → Connectors」新增自訂連接器,貼上伺服器位址並登入。
Claude Code 執行 claude mcp add --transport http --scope user webextrator https://webextrator.mcp.acedata.cloud/mcp,在工作階段內開啟 /mcp 選擇伺服器並完成授權。
Codex CLI 執行 codex mcp add webextrator --url https://webextrator.mcp.acedata.cloud/mcp,再執行 codex mcp login webextrator。
Cursor 在 MCP 設定中新增 HTTP 伺服器,填入位址,連線時按提示登入。
VS Code 從命令面板執行 MCP: Add Server,選擇 HTTP 並填入位址,再用 MCP: List Servers 查看狀態。

如果使用應用程式 API Key,在應用程式管理頁面選擇通用應用程式或具有 WebExtrator 網頁渲染、智慧擷取及任務查詢權限的應用程式,並檢查允許的 API 與餘額。在用戶端的私密憑證設定中將請求標頭設為 Authorization: Bearer <應用程式 API Key>。應用程式與 API Key

Gemini CLI 和 OpenCode 使用應用程式金鑰

先在啟動用戶端的終端機設定環境變數 ACEDATACLOUD_API_TOKEN 為應用程式 API Key。以下命令使用 macOS 或 Linux 的 shell 引號,儲存的是變數參照。

用戶端 如何連線
Gemini CLI 執行 gemini mcp add --scope user --transport http webextrator https://webextrator.mcp.acedata.cloud/mcp --header 'Authorization: Bearer ${ACEDATACLOUD_API_TOKEN}',再用 gemini mcp list 檢查。
OpenCode 2.x 執行 opencode mcp add webextrator --global --url https://webextrator.mcp.acedata.cloud/mcp --header 'Authorization=Bearer {env:ACEDATACLOUD_API_TOKEN}',再執行 opencode reload 和 opencode mcp list。

OpenCode 1.x 可在個人 opencode.json 的 mcp 物件中新增名為 webextrator 的服務,設定 type 為 remote、url 為上面的位址、oauth 為 false,並將 headers.Authorization 設為 Bearer {env:ACEDATACLOUD_API_TOKEN}。OpenCode 1.x 設定

在本機透過 stdio 連線

安裝 uv,在 Claude Desktop 的開發者設定中開啟本機 MCP 設定,將下列項目合併到使用者設定。將預留位置換成應用程式 API Key,儲存後重新啟動用戶端。其他支援 stdio 的用戶端也可以執行 uvx mcp-webextrator 命令,並將金鑰作為環境變數傳給程序。

{
  "mcpServers": {
    "webextrator": {
      "command": "uvx",
      "args": [
        "mcp-webextrator"
      ],
      "env": {
        "ACEDATACLOUD_API_TOKEN": "YOUR_API_KEY"
      }
    }
  }
}

本機程序仍會呼叫 Ace Data Cloud API。金鑰請保存在個人用戶端設定或憑證管理員中。mcp-webextrator 安裝套件

驗證連線與可用工具

開啟用戶端工具清單,找到 WebExtrator,先讓助理呼叫 webextrator_get_usage_guide,請它說明渲染與擷取各自回傳什麼。這項查詢可以檢查用戶端是否已載入工具,無需提交業務請求。

用途 工具 用法
渲染網頁 webextrator_render 傳入 url 取得渲染後的 HTML。需要等待動態內容時可指定 wait_for_selector。
擷取內容 webextrator_extract 傳入 url,可用 expected_type 指定 article、product 或 general。
查詢任務 webextrator_get_task、webextrator_get_tasks_batch 單筆透過 task_id 或 trace_id 查詢,多筆按回傳的 ID 批次查詢。
查看參數 webextrator_get_usage_guide 查看渲染、結構化擷取及任務參數。

呼叫範例

讓助理「對我提供的公開文章 URL 呼叫 webextrator_extract,將 expected_type 設為 article,整理回傳的標題和正文。」同步請求可直接讀取擷取結果。

如果頁面需要較長時間載入,傳入 async=true 並儲存回傳的 task_id。用 webextrator_get_task 查詢原任務;出現 finished_at 後檢查成功或失敗,成功時從 response 讀取結果。如果目標是留存頁面 HTML,改用 webextrator_render。

實際呼叫前,可在服務頁面查看目前價格和可用範圍。WebExtrator 服務 · 擷取 API · 渲染 API · 任務查詢 API