Skip to main content

MCP server for browser automation over Chrome CDP

Project description

web-access-mcp

eze-is/web-access 里真正“可执行”的浏览器能力下沉成一个显式 MCP server,避免依赖 skill 自动激活。

当前版本已完全切到 Python 实现,安装、运行、发布都走 PyPI。

安装

推荐:

pipx install web-access-mcp

或:

pip install web-access-mcp

升级到最新版本:

pipx upgrade web-access-mcp

资源限制

  • MCP 自己创建的受管 tab 最多 10 个
  • 超过 10 个后,new_tab 会直接报错,防止 Chrome target 过多导致卡顿或内存爆掉
  • adopt_tab 接管你原本已打开的 tab 后,不计入这 10 个配额
  • close_tab 会释放配额
  • 默认情况下,用户本来就打开的 Chrome tab 不计入这 10 个配额,除非你显式执行 adopt_tab

已实现能力

  • browser_health: 只验证 MCP server 正常响应,不要求浏览器授权
  • browser_connect: 在浏览器侧授权后,显式完成一次 Chrome CDP 连接验证
  • list_tabs: 列出当前页面 tab,并标记 isManagedmanagedSource
  • new_tab: 新建后台 tab
  • close_tab: 关闭 tab
  • close_all_managed_tabs: 一键关闭全部受管 tab
  • close_created_tabs: 只关闭 MCP 新开的 created tab,保留接管的 adopted tab
  • adopt_tab: 接管一个用户已打开的 tab
  • navigate: 页面跳转并等待加载
  • go_back: 后退
  • page_info: 读取标题、URL、readyState
  • eval: 在页面内执行 JavaScript
  • click: element.click()
  • click_at: 真实鼠标点击
  • set_files: 给 file input 注入本地文件
  • scroll: 页面滚动
  • screenshot: 截图,支持返回 base64 或落盘

前置条件

  1. Python 3.10+
  2. Chrome 已打开
  3. 在 Chrome 打开 chrome://inspect/#remote-debugging
  4. 勾选 Allow remote debugging for this browser instance

首次验证建议拆成两步:

  1. browser_health,只验证 MCP server 正常响应;这一步不要求浏览器授权
  2. 若浏览器侧弹出授权或尚未勾选 remote debugging,先完成授权,再调 browser_connect

本地开发

开发安装:

pip install -e .

语法检查:

python -m compileall src

直接启动:

python -m web_access_mcp

Codex MCP 配置

推荐直接用 Python module,避免依赖 Windows shell shim:

[mcp_servers.web-access]
command = "C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python313\\python.exe"
args = ["-m", "web_access_mcp"]
startup_timeout_sec = 60.0

如果机器里不存在旧的 npm 全局同名 shim,且 web-access-mcp 已通过 pipxpip 安装进 PATH,也可以直接写:

[mcp_servers.web-access]
command = "web-access-mcp"
startup_timeout_sec = 60.0

MCP 接入示例

其他支持 stdio 的 MCP 客户端也可直接这样配置:

{
  "mcpServers": {
    "web-access": {
      "command": "web-access-mcp"
    }
  }
}

发布到 PyPI

构建:

python -m build

发布:

python -m twine upload dist/*

与原 skill 的差异

  • 原 skill 的“自动选择 WebSearch / WebFetch / Jina / CDP”是提示词层能力,不是脚本层能力
  • 本仓库把稳定、确定、可调用的部分下沉成 MCP tools
  • 如果后续需要,可继续补 fetch_urlfetch_htmlsite_pattern_lookup 等工具

设计取舍

  • 运行时无第三方依赖,WebSocket 与 MCP stdio 都用 Python standard library 自行实现
  • 采用 stdio + JSON-RPC 实现最小 MCP server
  • 保留原仓库的核心思路:复用用户自己的 Chrome 登录态,而不是启动独立浏览器

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web_access_mcp-0.2.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web_access_mcp-0.2.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file web_access_mcp-0.2.1.tar.gz.

File metadata

  • Download URL: web_access_mcp-0.2.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for web_access_mcp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cbb47b21f105361c77cb637f66850ea03366d721ee00fcf313700ec4be07b05a
MD5 ee6bf59ef0ae248f7e5e7e76e4ab1274
BLAKE2b-256 ceb9466ccd77dd8292bbccab61ca894aa44d5b3534423375524edbe601731070

See more details on using hashes here.

File details

Details for the file web_access_mcp-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: web_access_mcp-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for web_access_mcp-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3158bde55d63204de1a1df969e1afe7a1574ee568b3424a91cb5546a2384b0fe
MD5 4082f7a94dea2692a55e02b77e7a3089
BLAKE2b-256 72ed82a93b8bc7f6726c8908f14133bbd1eb2008fa666be0792424de3245c886

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page