mcp-playwright

mcp-playwright

一个模型上下文协议(Model Context Protocol)服务器,它使用 Playwright 提供浏览器自动化功能。该服务器使大型语言模型(LLMs)能够与网页交互、截取屏幕截图,并在真实的浏览器环境中执行 JavaScript。

远程shell执行
网络自动化与隐身
AI集成系统
访问服务器

Tools

playwright_post

Perform an HTTP POST request

playwright_hover

Hover an element on the page

playwright_put

Perform an HTTP PUT request

playwright_fill

fill out an input field

playwright_evaluate

Execute JavaScript in the browser console

playwright_get

Perform an HTTP GET request

playwright_select

Select an element on the page with Select tag

playwright_iframe_click

Click an element in an iframe on the page

playwright_navigate

Navigate to a URL

playwright_screenshot

Take a screenshot of the current page or a specific element

playwright_click

Click an element on the page

playwright_patch

Perform an HTTP PATCH request

playwright_delete

Perform an HTTP DELETE request

README

Playwright MCP 服务器 🎭

smithery badge

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

<a href="https://glama.ai/mcp/servers/yh4lgtwgbe"><img width="380" height="200" src="https://glama.ai/mcp/servers/yh4lgtwgbe/badge" alt="mcp-playwright MCP server" /></a>

截图

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

要通过 Smithery 自动为 Claude Desktop 安装 Playwright MCP:

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

在 VS Code 中安装

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

<!-- // Generate using?: const config = JSON.stringify({ name: 'playwright', command: 'npx', args: ["-y", "@executeautomation/playwright-mcp-server"] }); const urlForWebsites = vscode:mcp/install?${encodeURIComponent(config)}; // Github markdown does not allow linking to vscode: directly, so you can use our redirect: const urlForGithub = https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForWebsites)}; -->

<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">

或者,您可以使用 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 目录中生成。

Star 历史

Star History Chart

推荐服务器

Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
mult-fetch-mcp-server

mult-fetch-mcp-server

一个多功能的、符合 MCP 规范的网页内容抓取工具,支持多种模式(浏览器/Node)、格式(HTML/JSON/Markdown/文本)和智能代理检测,并提供双语界面(英语/中文)。

精选
本地
AIO-MCP Server

AIO-MCP Server

🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。

精选
本地
Hyperbrowser

Hyperbrowser

欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:

精选
本地
https://github.com/Streen9/react-mcp

https://github.com/Streen9/react-mcp

react-mcp 与 Claude Desktop 集成,能够根据用户提示创建和修改 React 应用程序。

精选
本地
MCP Atlassian

MCP Atlassian

适用于 Atlassian Cloud 产品(Confluence 和 Jira)的 Model Context Protocol (MCP) 服务器。此集成专为 Atlassian Cloud 实例设计,不支持 Atlassian Server 或 Data Center 部署。

精选
any-chat-completions-mcp

any-chat-completions-mcp

将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。

精选