MCP Playwright CDP

by lars-hagen
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

MCP 剧作家 CDP

一个模型上下文协议 (MLM) 服务器,使用支持 Chrome DevTools 协议 (CDP) 的 Playwright 提供浏览器自动化功能。该服务器使 LLM 能够在真实的浏览器环境中与网页交互、截取屏幕截图和执行 JavaScript,并能够通过 CDP 连接到现有的 Chrome 实例。

这是executeautomation/mcp-playwright v0.2.7的一个分支,增强了CDP支持,可以连接到正在运行的Chrome实例。

主要特点

  • 🔗 通过 CDP 连接到现有的 Chrome 实例
  • 🌐 完整的浏览器自动化功能
  • 📸 整个页面或特定元素的屏幕截图
  • 🖱️ 全面的网络交互(导航、点击、表单填写)
  • 📊 控制台日志监控
  • 🔧 在浏览器上下文中执行 JavaScript
  • 🌍 HTTP API 测试支持

安装

您可以使用 npm 或 Smithery 安装该软件包:

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 MCP Playwright CDP:

npx -y @smithery/cli install @lars-hagen/mcp-playwright-cdp --client claude

手动安装

使用 npm:

npm install

配置

将其添加到您的 Claude Desktop 配置文件中:

{ "mcpServers": { "playwright": { "command": "node", "args": ["/path/to/mcp-playwright/dist/index.js"] } } }

/path/to/mcp-playwright替换为您实际的存储库路径。

CDP 连接

此 fork 版本新增了通过 CDP 连接到现有 Chrome 实例的功能。使用方法如下:

  1. 启动启用远程调试的 Chrome:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  1. 在启动新的浏览器之前,服务器将首先自动尝试连接到正在运行的 Chrome 实例。

致谢

该项目是executeautomation/mcp-playwright的一个分支,增强了 CDP 支持以连接正在运行的 Chrome 实例。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

使 LLM 能够通过支持 Chrome DevTools 协议的 Playwright 框架执行浏览器自动化,连接到现有的 Chrome 实例以实现高级 Web 交互和 JavaScript 执行。

  1. Key Features
    1. Installation
      1. Installing via Smithery
      2. Manual Installation
    2. Configuration
      1. CDP Connection
        1. Credits
          1. License
            ID: fdvu5n58kv