一个使用 Playwright 的 Model Context Protocol(模型上下文协议)服务器,为您提供强大的浏览器自动化能力。借助此服务器,大语言模型(LLMs)能够在真实的浏览器环境中,与网页进行交互、截取屏幕、生成测试代码、抓取网页内容以及执行 JavaScript。
Playwright MCP 服务器是一个基于 Playwright 的模型上下文协议服务器,可助力大语言模型与网页进行交互。以下是使用前的安装和配置步骤。
您可以选择以下多种方式安装 Playwright MCP 服务器:
npm install -g @executeautomation/playwright-mcp-server
npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server
要通过 Smithery 自动为 Claude Desktop 安装 Playwright MCP,可执行以下命令:
npx -y @smithery/cli install @executeautomation/playwright-mcp-server --client claude
在 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
文档中未提及相关许可证信息。