首页
学习
活动
专区
圈层
工具
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
首页
学习
活动
专区
圈层
工具
MCP广场
MCP广场 >详情页
mcp-playwright2025-05-279分享
github
提供llm与网页交互能力,截取屏幕截图,生成测试代码,网页和在浏览器环境中执行JavaScript等功能。
By executeautomation
2025-05-279
github
详情内容
MseeP.ai安全评估徽章 Warp赞助支持
MseeP.ai安全评估 特别感谢Warp——开发者AI终端

Playwright MCP服务器 🎭

smithery徽章

这是一个基于Playwright的模型上下文协议(MCP)服务器,提供浏览器自动化能力。该服务器使大型语言模型(LLM)能够:

  • 与网页交互
  • 截取屏幕截图
  • 生成测试代码
  • 爬取网页内容
  • 在真实浏览器环境中执行JavaScript

mcp-playwright MCP服务器

功能截图

Playwright + Claude

文档 | 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安装(自动为Claude Desktop安装Playwright MCP):

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

在VS Code中安装

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

在VS Code中安装
在VS Code Insiders中安装

或者使用VS Code CLI安装:

# 对于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代理一起使用。

使用Playwright服务器的配置

以下是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目录中。

运行评估

evals包会加载一个mcp客户端来运行index.ts文件,因此测试之间无需重新构建。您可以通过在npx命令前添加环境变量前缀来加载环境变量。完整文档请参阅这里

OPENAI_API_KEY=your-key  npx mcp-eval src/evals/evals.ts src/tools/codegen/index.ts

星标历史记录

星标历史图表

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档