Playwright MCP Server 是官方的吗?
是的。它由 Microsoft 以 `@playwright/mcp` 的名称发布,代码位于 GitHub 上的 microsoft/playwright-mcp 仓库。
@microsoft
Playwright MCP 服务器
使用下面的配置,将此服务器添加到你的 MCP 客户端。
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}Close the page
Resize the browser window
Returns all console messages
Handle a dialog
Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged; null clears an override.
Evaluate JavaScript expression on page or element
Upload one or multiple files
Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
Search the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.
Fill multiple form fields
Press a key on the keyboard
Type text into editable element
Navigate to a URL
Go back to the previous page in the history
Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
Returns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.
Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
Capture accessibility snapshot of the current page, this is better than screenshot
Perform click on a web page
Perform drag and drop between two elements
Hover over element on page
Select an option in a dropdown
List, create, close, or select a browser tab.
Wait for text to appear or disappear or a specified time to pass
Playwright MCP Server 是 Microsoft 官方的 playwright mcp 软件包(@playwright/mcp),通过 Playwright 为 AI 智能体提供浏览器自动化能力。它让 LLM 通过结构化的无障碍快照(accessibility snapshot)而不是截图来读取和操作网页,因此无需视觉模型。
该项目基于 Apache-2.0 许可证开源,维护于 microsoft/playwright-mcp 仓库。默认通过 stdio 在本地运行,也可以作为独立的 HTTP 服务器启动,供 MCP 客户端通过 URL 连接。
前提条件:Node.js 18 或更高版本,以及一个 MCP 客户端,例如 Claude Code、Claude Desktop、Cursor、VS Code、Windsurf、Codex 或 Goose。无需 API 密钥或账号。
标准配置适用于大多数客户端:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
额外选项添加到 args 列表中,例如 "--headless"、"--browser=firefox" 或 "--isolated"。
claude mcp add playwright npx @playwright/mcp@latest
按照 MCP 安装指南操作,将上面的标准配置粘贴到 Claude Desktop 配置文件中。
进入 Cursor Settings -> MCP -> Add new MCP Server,选择 command 类型并输入 npx @playwright/mcp@latest。README 中也提供了一键安装按钮。
在 VS Code 的 MCP 设置中使用标准配置,或通过命令行安装:
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
安装后,该服务器即可供 VS Code 中的 GitHub Copilot agent 使用。
codex mcp add playwright npx "@playwright/mcp@latest"
或添加到 ~/.codex/config.toml:
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
按照 Windsurf MCP 文档操作,使用上面的标准配置。
如需将 playwright mcp server 作为常驻进程运行(例如 IDE 无法打开有界面浏览器的机器上),可指定端口启动:
npx @playwright/mcp@latest --port 8931
然后让客户端指向该端点:
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}
官方还发布了 Docker 镜像(mcr.microsoft.com/playwright/mcp),目前仅支持无头(headless)Chromium。
--browser 可选 chrome、firefox、webkit 或 msedge,--device 或 --mobile 可模拟移动设备。--isolated 开启内存隔离会话并配合 --storage-state,或通过 Playwright 浏览器扩展复用正在运行的 Chrome 或 Edge 标签页。--caps 启用。PLAYWRIGHT_MCP_* 环境变量,也可通过 --config 加载 JSON 配置文件。--allowed-origins 和 --blocked-origins 列表,以及用于 HTTP 服务器的 --allowed-hosts。默认工具集涵盖核心自动化:
browser_navigate、browser_navigate_back、browser_resize、browser_close,以及用于列出、打开、关闭和切换标签页的 browser_tabs。browser_snapshot 捕获智能体用来定位元素的无障碍快照;browser_find 在快照中搜索文本或正则表达式,比完整快照更省资源。browser_take_screenshot 保存图片,但不能用来选择操作目标。browser_click、browser_type、browser_fill_form、browser_select_option、browser_hover、browser_drag、browser_press_key、browser_file_upload、browser_drop 和 browser_handle_dialog。browser_console_messages、browser_network_requests 和查看请求头与正文的 browser_network_request,以及执行 JavaScript 的 browser_evaluate 和等待文本或超时的 browser_wait_for。browser_run_code_unsafe 在服务器进程中运行 Playwright 代码片段;README 将其标注为等同于 RCE(远程代码执行)。可选工具组会增加 browser_pdf_save(--caps=pdf)、browser_mouse_click_xy(--caps=vision)、browser_start_tracing(--caps=devtools)、browser_cookie_list(--caps=storage)、browser_route(--caps=network)和 browser_verify_text_visible(--caps=testing)等工具。
--codegen 选项可设为 TypeScript、Python、Java 或 C#)。--port 8931 自行启动服务器,并通过 url 连接。--isolated 或不同的 --user-data-dir。--caps 启用,例如 --caps=pdf。file:// URL:文件访问默认限制在工作区根目录内。--allow-unrestricted-file-access 可解除此限制,请谨慎使用。是的。它由 Microsoft 以 `@playwright/mcp` 的名称发布,代码位于 GitHub 上的 microsoft/playwright-mcp 仓库。
免费。它以 Apache-2.0 许可证开源,不需要 API 密钥或付费账号;你只需为所使用的 LLM 客户端付费。
可以。Claude Code 使用 `claude mcp add playwright npx @playwright/mcp@latest`,VS Code 支持 `code --add-mcp`,Cursor 可在 MCP 设置中填入 `npx @playwright/mcp@latest` 命令。
不需要。mcp playwright 服务器默认基于无障碍快照工作。只有启用 `--caps=vision` 后才会提供基于坐标的工具。
可以。默认的持久化配置文件会在会话之间保留登录状态,Playwright 浏览器扩展(`--extension`)还可以连接你正在运行的 Chrome 或 Edge 标签页。
可以用 `--port` 将其作为 HTTP 服务器运行(配合 `--host 0.0.0.0` 绑定所有网络接口),或在 Docker 中运行,然后让客户端通过 URL 连接。
README 明确指出它不是安全边界。来源(origin)的允许和阻止列表无法拦截重定向,`browser_run_code_unsafe` 也可以执行任意代码,因此只应在你信任智能体及其访问网站的环境中运行。
通过 `--browser` 选项支持 Chrome、Firefox、WebKit 和 Microsoft Edge,并可通过 `--device` 或 `--mobile` 进行设备模拟。
Fast, lightweight Firecrawl/Tavily alternative in Rust. Web scraper, crawler & search API with MCP server for AI agents. Drop-in Firecrawl-compatible API (/scrape, /crawl, /search). 2.3x faster than Tavily, 1.5x faster than Firecrawl in 1K-URL benchmarks. 6 MB RAM, single binary.
Let Claude Code, Claude Desktop, OpenAI Codex, Kimi and any MCP-capable AI agent create, launch, check and drive browser profiles in Nullprint, the AI antidetect browser. Install with one command.
Give your AI agent the live web. One MCP server for Search, Fetch, Browser, and Agent: browse real sites, extract structured data, fill forms, and run multi-step workflows. Search and Fetch are free.
🔮 Platform-neutral Browser Use for AI agents: real Chrome automation with a CLI + SDKs, no lock-in, dead simple.

MCP server for managing Gologin browser profiles, proxies, fingerprints and cloud browser sessions through AI conversations
评论