WebExtrator MCP 对接指南
WebExtrator MCP 可以渲染由 JavaScript 加载的网页并返回 HTML,也可以直接从网页中提取文章、商品等结构化内容。较慢的页面可以异步处理。
¶ 连接托管服务
在客户端选择远程 MCP(Streamable HTTP),服务器地址填写 https://webextrator.mcp.acedata.cloud/mcp。选择 OAuth 后,按浏览器提示登录 AI 聚合并授权。
| 客户端 | 如何连接 |
|---|---|
| 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"
}
}
}
}
本地进程仍会调用 AI 聚合 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

