返回市场
MCP-Playwright-CDP

MCP-Playwright-CDP

作者:lars-hagen38 星标更新:2025-02-12

项目介绍

MCP Playwright CDP

smithery 徽章

许可: MIT

这是一个使用Playwright并支持Chrome DevTools Protocol (CDP) 的Model Context Protocol服务器。该服务器使LLMs能够与网页进行交互,抓取整个页面或特定元素的截图,并在真实的浏览器环境中执行JavaScript,同时可以通过CDP连接到现有的Chrome实例。

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

<a href="https://glama.ai/mcp/servers/fdvu5n58kv"><img width="380" height="200" src="https://gips1.baidu.com/it/u=1631933620,3354036468&fm=3081&app=3081&f=PNG?w=760&h=400" alt="Playwright CDP MCP 服务器" /></a>

主要特性

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

安装

您可以使用npm或Smithery来安装此包:

通过Smithery安装

要通过Smithery自动安装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连接

这个分支增加了通过CDP连接到现有Chrome实例的能力。要使用此功能:

  1. 启动带有远程调试功能的Chrome:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  1. 服务器会首先尝试连接到正在运行的Chrome实例,然后再启动新的浏览器。

致谢

本项目是executeautomation/mcp-playwright的一个分支,增加了对连接到正在运行的Chrome实例的支持。

许可证

本项目采用MIT许可证 - 查看LICENSE文件以获取详细信息。