全部插件

DSH / BUNDLE / BUNDLES

hermes-web-mcp

v1.0.0ShadowMiner / hermes-web-mcp11e7937903

可安装组合包组合包与其他模块社区 · Topic 自动分析

概览

hermes-web-mcp

Keyless MCP server providing web_search, web_extract and 7 page_* real-browser (CDP) tools for DSH and any MCP client. No API keys required.

README / ZH

插件文档

hermes-web-mcp

给任意 MCP 客户端提供上网能力的 MCP server —— 无需任何 API key

hermes-web-mcp 是一个 MCP(Model Context Protocol)server, 为 DSH Desktop 及任意 MCP 客户端提供完整的上网工具箱:

  • web_search —— 免 key 搜索: cn.bing 直连, 失败自动切 DuckDuckGo(走代理); 无需搜索引擎 API key。
  • web_extract —— 带 JS 渲染抓取任意网页(local playwright-service + html-to-md 链路, 双 CDP Chrome), 输出干净 Markdown。
  • 7 个 page_* —— 在共享 CDP Chrome 的隔离上下文中操作真实浏览器(绝不触碰宿主浏览器标签页): page_openpage_clickpage_typepage_readpage_shotpage_backpage_close

工具列表

工具 用途 主要参数
web_search 免 key 网页搜索(cn.bing 直连, DDG 兜底)→ 标题/URL/摘要列表 query(string, 必填), max_results(number, 默认 8)
web_extract 经 playwright-service + html-to-md 渲染抓取网页转 Markdown; 双 CDP 互备, 再降级原生 fetch url(必填), via_proxy(boolean), wait_ms(number, 默认 2500)
page_open 在共享 CDP Chrome 打开页面, 返回正文前 4000 字 url(必填), via_proxy(boolean), wait_ms(默认 3000)
page_click 点击当前页面 CSS 选择器命中的元素 selector, wait_ms(默认 1200)
page_type 向输入框填入文本(可选按回车) selector, text, enter(boolean)
page_read 读取当前页面正文文本(最多 12000 字符)
page_shot 截图当前页面到 shots/ 并返回文件路径 full_page(boolean)
page_back 返回上一页
page_close 关闭浏览器隔离上下文(清理; 下次 page_open 自动重建)

共 9 个工具: web_search + web_extract + 7 个 page_* 工具。

工作原理

┌──────────────┐   stdio (MCP)   ┌────────────────────── hermes-web-mcp ──────────────────────┐
│ MCP 客户端    │ ───────────────▶ │ web_search   → cn.bing(免 key) / DDG 兜底                  │
│ (DSH 等)     │                  │ web_extract  → playwright-service (:3003) → html-to-md    │
└──────────────┘                  │                (:8080)  ⇄ CDP Chrome 9333(直连) /          │
                                  │                9334(经 HTTP 代理)                          │
                                  │ page_*       → playwright chromium.connectOverCDP          │
                                  └───────────────────────────────────────────────────────────┘

web_extract 不需要任何抓取 API key: 本地 playwright-service 通过 CDP 渲染页面, html-to-md 服务把 HTML 转成 Markdown。背后是两个 Chrome 实例:

  • CDP 直连(默认, 127.0.0.1:9333)—— 用于国内站点及带登录态的页面。
  • CDP 代理(127.0.0.1:9334)—— 流量经本地 HTTP 代理出去的 Chrome, 用于海外/受限站点。

web_extract 优先走你指定的 CDP, 失败自动切换另一个; 都失败则降级为原生 fetch(无 JS 渲染)。page_* 工具用 Playwright 的 connectOverCDP 连接同一个共享 Chrome, 且运行在隔离上下文里——绝不触碰宿主浏览器的标签页。

环境变量

变量 默认值 含义
WEBMCP_PW D:/path/to/playwright-service/node_modules/playwright Playwright 安装路径(其 chromium 驱动用于 connectOverCDP)
WEBMCP_SCRAPE http://127.0.0.1:3003/scrape playwright-service 抓取端点(POST {url, wait_after_load, cdp_url}{content, pageStatusCode, contentType})
WEBMCP_CONVERT http://127.0.0.1:8080/convert html-to-md 端点(POST {html}{markdown})
WEBMCP_CDP_DIRECT http://127.0.0.1:9333 直连 Chrome 的 CDP 端点
WEBMCP_CDP_PROXY http://127.0.0.1:9334 代理 Chrome 的 CDP 端点

所有变量均可选——不设置时使用上面的默认值。

部署前置

  1. Node.js ≥ 22, 并在本仓库执行 npm install(唯一运行时依赖: @modelcontextprotocol/sdk)。
  2. playwright-service —— 提供 POST /scrape {url, wait_after_load, cdp_url}{content, pageStatusCode, contentType} 的本地服务, 用 Playwright 对着目标 CDP 渲染页面。(firecrawl-lite 项目里有参考实现。)
  3. html-to-md —— 提供 POST /convert {html}{markdown} 的本地服务。
  4. 两个 CDP Chrome 实例:
    • chrome --remote-debugging-port=9333(直连)
    • chrome --remote-debugging-port=9334(流量经本地 HTTP 代理出去, 用于海外/受限站点)。
  5. 一个 WEBMCP_PW 能解析到的 Playwright 安装(或使用默认路径), 供 page_* 工具使用。

默认值假设服务监听 127.0.0.1:3003 / 127.0.0.1:8080, Chrome 在 9333 / 9334。环境不同? 直接设环境变量即可。

MCP 配置示例

通用 MCP 配置(如 Claude Desktop claude_desktop_config.json):

{
  "mcpServers": {
    "hermes-web": {
      "command": "node",
      "args": ["D:/path/to/hermes-web-mcp/hermes-web-mcp.js"],
      "env": {
        "WEBMCP_PW": "D:/path/to/playwright-service/node_modules/playwright",
        "WEBMCP_SCRAPE": "http://127.0.0.1:3003/scrape",
        "WEBMCP_CONVERT": "http://127.0.0.1:8080/convert",
        "WEBMCP_CDP_DIRECT": "http://127.0.0.1:9333",
        "WEBMCP_CDP_PROXY": "http://127.0.0.1:9334"
      }
    }
  }
}

dsh-mcp-client(SQLite 注册表, insert 示例——列名请按你的表结构调整):

INSERT INTO mcp_servers (name, command, args, env) VALUES (
  'hermes-web',
  'node',
  JSON_ARRAY('D:/path/to/hermes-web-mcp/hermes-web-mcp.js'),
  JSON_OBJECT(
    'WEBMCP_PW',         'D:/path/to/playwright-service/node_modules/playwright',
    'WEBMCP_SCRAPE',     'http://127.0.0.1:3003/scrape',
    'WEBMCP_CONVERT',    'http://127.0.0.1:8080/convert',
    'WEBMCP_CDP_DIRECT', 'http://127.0.0.1:9333',
    'WEBMCP_CDP_PROXY',  'http://127.0.0.1:9334'
  )
);

Smoke 测试说明

前置服务就绪后:

npm install
node smoke.js

smoke.js 通过真实 MCP stdio 拉起 server, 列出已注册工具, 然后依次调用 web_searchweb_extractpage_open(代理)与 page_shot 并打印输出。需要 playwright-service、html-to-md 服务与两个 CDP Chrome 都在运行。

License

MIT —— Copyright (c) 2026 ShadowMiner。