![]() |
![]() |
MseeP.ai 安全评估 | 特别感谢 Warp,开发者的人工智能终端 |
这是一个使用 Playwright 提供浏览器自动化功能的模型上下文协议服务器。该服务器使 LLM 能够与网页交互、截图、生成测试代码、抓取网页并在真实的浏览器环境中执行 JavaScript。
您可以使用 npm、mcp-get 或 Smithery 安装该包:
使用 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 @smithery/cli install @executeautomation/playwright-mcp-server --client claude
使用以下按钮之一在 VS Code 中安装 Playwright MCP 服务器:
或者,您可以使用 VS Code CLI 安装 Playwright MCP 服务器:
# 对于 VS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'

# 对于 VS Code Insiders
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'

安装后,ExecuteAutomation Playwright MCP 服务器将可在 VS Code 中与您的 GitHub Copilot 代理一起使用。
以下是 Claude Desktop 配置以使用 Playwright 服务器:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@executeautomation/playwright-mcp-server"]
}
}
}

该项目使用 Jest 进行测试。测试位于 src/__tests__
目录中。
您可以使用以下命令之一运行测试:
# 使用自定义脚本运行测试(带覆盖率)
node run-tests.cjs
# 使用 npm 脚本运行测试
npm test # 运行测试,不带覆盖率
npm run test:coverage # 运行测试,带覆盖率
npm run test:custom # 使用自定义脚本运行测试(与 node run-tests.cjs 相同)

测试覆盖率报告将在 coverage
目录中生成。
评估包加载一个 mcp 客户端,然后运行 index.ts 文件,因此在测试之间无需重新构建。您可以通过在 npx 命令前添加前缀来加载环境变量。完整文档可以在此处找到 这里。
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/tools/codegen/index.ts
在添加新工具时,请注意工具名称的长度。某些客户端(如 Cursor)对服务器和工具名称的组合(server_name:tool_name
)有 60 个字符的限制。
我们的服务器名称是 playwright-mcp
。请确保您的工具名称足够短,不要超过此限制。