web_read 三档引擎自动降级读正文(实测主流中文站 1.6s 通);screenshot_url 用 Chromium 出真图给公网链接;web_fill 按步骤数组填表提交。
一行命令,工具自动出现在 Agent 的工具列表里。
# Claude Code / Cursor / 任何 MCP 客户端 claude mcp add --transport http mycel-web https://pianam.cn/web-mcp/mcp
标准 JSON-RPC 2.0。initialize 握手不消耗额度,只有 tools/call 计数。
curl -s https://pianam.cn/web-mcp/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'读取任意网页的正文。三档引擎:常驻 Lightpanda CDP(约 1.6s/70MB,实测 10 站全通)→ Lightpanda dump markdown(结构好,保留标题/表格/链接)→ Chromium(完整 JS、可换真 UA)。适合新闻、文章、文档、产品页、博客。自动剥离导航/侧栏/广告、base64 内联图、广告拦截提示。实测 10 个主流中文站 100% 成功、均 1.62s;并发 5 站 2.74s。禁止访问内网地址。
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| url | string | 必填 | — | 完整网址,含 http(s):// 或裸域名 |
| max_chars | integer | 可选 | 8000 | 正文最大字符数,500~20000,默认 8000 |
| engine | string | 可选 | auto | auto(默认,先 Lightpanda 再 Chromium)/ lightpanda / chromium |
curl -s https://pianam.cn/web-mcp/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"web_read","arguments":{"url":"https://pianam.cn","max_chars":800}}}'{
"ok": true,
"url": "https://pianam.cn/",
"title": "Mycel — 中文互联网实时数据,一次调用拿到",
"engine": "lightpanda-cdp",
"elapsed_s": 1.53,
"http_status": null,
"chars": 815,
"truncated": true,
"attempts": [
{
"engine": "lightpanda",
"ok": true,
"elapsed": 1.53,
"error": null,
"http_status": null,
"bot_challenge": null,
"chars": 1722
}
],
"text": "Mycel\n文档 CAD 造物 工作台 控制台 GitHub 运行中\n实时 · 无需注册\n…(正文截断)"
}attempts 记录了每一档引擎的尝试结果和耗时,engine 告诉你最终是哪一档出的活。truncated=true 说明被 max_chars 截断了。
给任意网页截真图(不是文字渲染),返回可直接打开的公网图片链接。常驻 Chromium CDP 渲染,支持整页长截图。实测 163/新浪/虎嗅/IT之家/豆瓣/少数派 6 站全出完整渲染图,3.5~9s;整页长截图 4s。注意:UA 主版本必须跟服务器 Chromium 一致(当前 156),写死旧版 UA 会被网易等站降级成无样式无障碍页(踩过,49KB 废图)。适合页面存档、UI 检查、给用户看效果图。禁止访问内网地址。
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| url | string | 必填 | — | 完整网址,含 http(s):// 或裸域名 |
| width | integer | 可选 | 1280 | 视口宽度,400~2400,默认 1280 |
| height | integer | 可选 | 900 | 视口高度,300~2400,默认 900 |
| full_page | boolean | 可选 | false | 是否整页长截图,默认 False 只截首屏 |
curl -s https://pianam.cn/web-mcp/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"screenshot_url","arguments":{"url":"https://pianam.cn","width":1280,"height":900,"full_page":false}}}'{
"ok": true,
"url": "https://pianam.cn",
"image_url": "https://pianam.cn/shots/shot_20261125_064647_pmze8t.png",
"file": "/opt/aigo/data/shots/shot_20261125_064647_pmze8t.png",
"bytes": 122756,
"width": 1280,
"height": 900,
"viewport": "1280x900",
"full_page": false,
"elapsed_s": 2.67,
"engine": "chromium-cdp",
"hint": "把 image_url 原样给用户,可以直接点开看"
}image_url 是公网可直接访问的链接,可以直接丢给用户或写进 Markdown。
在网页上填表单并提交:支持输入(fill/type)、点击(click)、选下拉(select)、勾选(check/uncheck)、回车(press)、等待(wait/wait_for)、跳转(goto)、滚动(scroll)、悬停(hover)。steps 是动作数组,按顺序执行,每步形如 {"action":"fill","selector":"#user","value":"abc"}。只做机械执行——不想提交就别给最后那个 click,工具不替调用方判断该不该提交。注意:填表固定走 Chromium(Lightpanda DOM 不完整,定位不到表单元素),常驻 CDP 加速,实测 4 步 5.2s。某步失败会停下并返回已完成步数和当时的页面截图;只要动过页面就不会重跑,避免重复提交。禁止访问内网地址。
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
| url | string | 必填 | — | 要打开的网页 |
| steps | array<any> | 必填 | — | 动作数组,例 [{"action":"fill","selector":"#user","value":"abc"}, {"action":"click","selector":"button[type=submit]"}] |
| width | integer | 可选 | 1280 | 视口宽,400~2400,默认 1280 |
| height | integer | 可选 | 900 | 视口高,300~2400,默认 900 |
| screenshot | boolean | 可选 | true | 操作完是否截图,默认 True |
curl -s https://pianam.cn/web-mcp/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"web_fill","arguments":{"url":"https://example.com/login","steps":[{"action":"fill","selector":"#user","value":"abc"},{"action":"click","selector":"#submit"}],"screenshot":true}}}'{
"ok": true,
"url": "https://example.com/login",
"title": "…",
"steps_total": 2,
"steps_done": 2,
"text": "…(页面文本)",
"elapsed_s": 5.2,
"image_url": "https://pianam.cn/shots/shot_xxx.png",
"screenshot": "/opt/aigo/data/shots/shot_xxx.png",
"width": 1280,
"height": 900
}示例返回按代码里的组装逻辑还原,未实测(避免往线上站点提交表单)。某步失败时 ok=false,并带 steps_done 和 hint 说明第几步挂的。
超额返回 -32002,带 X-API-Key 继续用。密钥在 pianam.cn 注册后于控制台创建。