浏览器自动化服务器

一个基于Playwright的模型上下文协议服务器,提供浏览器自动化能力,支持网页交互、截图、测试代码生成和JavaScript执行。

  • by pvinis
  • TypeScript
  • 本地部署
  • 22 星标
  • 更新于
在 GitHub 查看 pvinis/mcp-playwright-stealth

使用说明

剧作家MCP服务器🎭

使用Playwright提供浏览器自动化功能的模型上下文协议服务器。该服务器使LLM能够在真实的浏览器环境中与网页交互、截图、生成测试代码、抓取网页并执行JavaScript。

截图

文档 | api参考

安装

您可以使用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

通过以下方式自动安装Playwright MCP for Claude Desktop 史密瑟里:

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

在VS代码中安装

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

或者,您可以使用VS Code CLI安装Playwright MCP服务器:

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

安装后,ExecuteAutomation Playwright MCP服务器将可用于VS Code中的GitHub Copilot代理。

使用Playwright服务器的配置

以下是使用Playwright服务器的Claude Desktop配置:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@executeautomation/playwright-mcp-server"]
    }
  }
}

测试

此项目使用Jest进行测试。测试位于 src/__tests__ 目录。

运行测试

您可以使用以下命令之一运行测试:

# Run tests using the custom script (with coverage)
node run-tests.cjs

# Run tests using npm scripts
npm test           # Run tests without coverage
npm run test:coverage  # Run tests with coverage
npm run test:custom    # Run tests with custom script (same as node run-tests.cjs)

测试覆盖率报告将在 coverage 目录。

明星历史