返回 MCP 目录
public公开dns本地运行

mcp-playwright

一个基于Playwright的MCP服务器,为LLM提供浏览器自动化能力

article

README

🚀 Playwright MCP 服务器 🎭

一个使用 Playwright 的 Model Context Protocol(模型上下文协议)服务器,为您提供强大的浏览器自动化能力。借助此服务器,大语言模型(LLMs)能够在真实的浏览器环境中,与网页进行交互、截取屏幕、生成测试代码、抓取网页内容以及执行 JavaScript。

smithery badge

🚀 快速开始

Playwright MCP 服务器是一个基于 Playwright 的模型上下文协议服务器,可助力大语言模型与网页进行交互。以下是使用前的安装和配置步骤。

✨ 主要特性

  • 支持大语言模型(LLMs)在真实浏览器环境中与网页交互。
  • 具备截取屏幕、生成测试代码、抓取网页内容和执行 JavaScript 等功能。
  • 提供多种安装方式,如 npm、mcp - get、Smithery 等,还支持在 VS Code 中安装。

📦 安装指南

您可以选择以下多种方式安装 Playwright MCP 服务器:

使用 npm

npm install -g @executeautomation/playwright-mcp-server

使用 mcp - get

npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server

使用 Smithery

要通过 Smithery 自动为 Claude Desktop 安装 Playwright MCP,可执行以下命令:

npx -y @smithery/cli install @executeautomation/playwright-mcp-server --client claude

在 VS Code 中安装

在 VS Code 中使用以下按钮之一安装 Playwright MCP 服务器:

# 在 VS Code 中使用以下命令进行安装:
# 打开终端并运行:
# 复制以下内容到终端:
command: "extension install"
args: ["https://marketplace.visualstudio.com/items?itemName=vscode_extensions.reposoup.badge_install_now"]

📚 详细文档

🔧 技术细节

配置

在 Claude Desktop 中配置 Playwright 服务器,可参考以下配置示例:

# 在 Claude Desktop 中进行如下配置:
{
  "playwright": {
    "server": "@executeautomation/playwright-mcp-server"
  }
}

测试

使用 Jest 进行测试,并提供以下运行命令:

npm test
npm run test
yarn test

📄 许可证

文档中未提及相关许可证信息。

截图

Playwright + Claude

星历史

Star History Chart

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端