Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,使大型语言模型 (LLM) 能够与网页交互、截取屏幕截图、生成测试代码、抓取网页以及在真实的浏览器环境中执行 JavaScript。

Category
访问服务器

Tools

playwright_custom_user_agent

Set a custom User Agent for the browser

playwright_get_visible_text

Get the visible text content of the current page

playwright_get_visible_html

Get the HTML content of the current page

playwright_go_back

Navigate back in browser history

playwright_go_forward

Navigate forward in browser history

start_codegen_session

Start a new code generation session to record Playwright actions

end_codegen_session

End a code generation session and generate the test file

get_codegen_session

Get information about a code generation session

clear_codegen_session

Clear a code generation session without generating a test

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_iframe_click

Click an element in an iframe on the page

playwright_fill

fill out an input field

playwright_select

Select an element on the page with Select tag

playwright_hover

Hover an element on the page

playwright_evaluate

Execute JavaScript in the browser console

playwright_console_logs

Retrieve console logs from the browser with filtering options

playwright_close

Close the browser and release all resources

playwright_get

Perform an HTTP GET request

playwright_post

Perform an HTTP POST request

playwright_put

Perform an HTTP PUT request

playwright_patch

Perform an HTTP PATCH request

playwright_delete

Perform an HTTP DELETE request

playwright_expect_response

Ask Playwright to start waiting for a HTTP response. This tool initiates the wait operation but does not wait for its completion.

playwright_assert_response

Wait for and validate a previously initiated HTTP response wait operation.

playwright_drag

Drag an element to a target location

playwright_press_key

Press a keyboard key

playwright_save_as_pdf

Save the current page as a PDF file

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

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

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选