跳到主要内容Skip to main content
← MCP

Playwright MCP ServerPlaywright MCP Server

Microsoft
浏览器Browser 网络Network 本地Local 只读Read-only verified lifecycle: active 核验Checked 2026-10-23

微软维护的浏览器自动化 server。它用无障碍树而非截图驱动,不需要视觉模型。输出是结构化快照。

A browser automation server maintained by Microsoft, driven by the accessibility tree rather than screenshots — no vision model needed, and the output is a structured snapshot.

适合与不适合When to use it, when not to

需要浏览器自动化且要保持会话状态的场景: 探索性自动化、自愈测试、长时自主工作流。

不适合高吞吐编码 agent——README 自己建议这类场景改用 Playwright CLI + SKILLS,因为 MCP 形态要加载大工具 schema 和无障碍树, token 效率更低。

也不适合需要真正网络隔离的场景:官方明确声明来源限制不构成安全边界。

Scenarios where an agent must operate a real browser and read the page as structure rather than as a picture.

Not a fit for visual-only understanding — it drives the accessibility tree, so anything conveyed purely by pixels is out of reach.

中文生态China availability 国产 / 国内可直接用 / 备案状态 · 快照domestic / direct access / CAC filing · snapshot 2026-10-20

出品属地Origin
国外出品foreign-made 国外主体(网信办公示名单未见对应备案主体)。foreign entity (no matching filing entity in the CAC registry).
国内使用Direct access
大陆可直连direct OK 官网仓库在 GitHub,大陆直连波动(同日实测 200/000 混合);npm / PyPI 安装源实测稳定可达。Hosted on GitHub — direct reachability from mainland fluctuates (200/000 mixed on the same day); npm / PyPI install routes measured stable.
备案状态CAC filing
未见于备案名单not in filing list:未见于网信办公示名单(2026-10-20 检索 13 批附件,https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm);该产品未面向大陆公众提供服务,备案不适用。not in the CAC public registry (13 batch attachments searched 2026-10-20, https://www.cac.gov.cn/2024-04/02/c_1713729983803145.htm); the product does not serve the mainland public, so filing does not apply.

备案信息以网信办《生成式人工智能服务已备案信息》公示名单为准(按批次滚动更新,本站只抄编号不解读);「大陆可直连」是本站从大陆网络直连实测的结果,不是厂商承诺。GitHub 类站点当日实测有波动,口径写在依据里。Filing status is quoted from the CAC public registry (updated batch by batch; this site copies the number and does not interpret it). "Direct access" is this site's own reachability measurement from a mainland network, not a vendor promise. GitHub-hosted sites fluctuated on the measurement day — the note says so.

固定坐标系Fixed coordinate system

11 个维度dimensions, 与同分区其他对象逐项可比each comparable item by item against others in the same section.

模型与开放条件Model & openness

本身不调用模型,是被客户端调用的接口实现。 用 Playwright 的无障碍树(accessibility tree)而非像素输入, 因此不需要视觉模型,输出为结构化快照。

It calls no model itself; it is an interface implementation called by clients. It drives Playwright's accessibility tree rather than pixel input, so no vision model is needed and output is structured snapshots.

运行位置Where it runs

本地 Node.js 进程(需 Node.js 18+),通过 stdio 通信。 它也提供 HTTP endpoint 模式。另有浏览器扩展模式(Edge / Chrome)。 默认有头模式,可用 --headless 切换。

A local Node.js process (Node.js 18+ required), communicating over stdio. It also offers an HTTP endpoint mode, plus a browser-extension mode (Edge / Chrome). Headed mode is the default; switch with --headless.

本地文件Local files

无本地文件访问能力。核心能力是浏览器控制。 用户 profile 默认落盘在 Playwright 缓存目录(按 workspace hash 隔离), 用 --isolated 可改为仅存内存。

No local file-access capability. The core capability is browser control. The user profile is persisted by default in the Playwright cache directory (isolated by workspace hash); --isolated switches it to in-memory only.

关机后的任务Tasks after shutdown

浏览器进程可保持常驻。--idle-timeout 控制空闲关闭: headless 默认 1 小时关闭,headed 模式默认永不关闭; 下次工具调用会重新拉起浏览器。

The browser process can stay resident. --idle-timeout controls idle shutdown: headless closes after 1 hour idle by default; headed mode never closes by default; the next tool call relaunches the browser.

工具与扩展Tools & extensions

它提供完整的浏览器自动化工具集。本站已按官方 README 逐条核对,共 72 个工具 (2026-10-08):

  • 导航与标签页
  • 点击 / 拖放 / 悬停
  • 表单与键盘输入
  • 无障碍树快照(snapshot)
  • 截图与 PDF
  • 网络请求与路由(route / unroute)
  • Cookie 与 localStorage / sessionStorage 读写
  • 文件上传
  • 对话框处理
  • 视频录制与 tracing(start / stop)、以及 verify_* 断言组等

输出以无障碍树结构为主,是结构化数据,可直接消费。

It provides a full browser-automation toolset. This site has checked it item by item against the official README: 72 tools in total (2026-10-08):

  • navigation and tabs
  • click / drag-and-drop / hover
  • forms and keyboard input
  • accessibility-tree snapshots
  • screenshots and PDF
  • network requests and routing (route / unroute)
  • reading and writing cookies and localStorage / sessionStorage
  • file uploads
  • dialog handling
  • video recording and tracing (start / stop), plus the verify_* assertion group, etc.

Output is mainly accessibility-tree structure — structured data, ready for direct consumption.

上下文与记忆Context & memory

保持浏览器上下文是本 server 的核心价值—— README 明确指出 MCP 形态适合需要持久状态、 丰富内省与迭代推理的 agentic loop, 例如探索性自动化、自愈测试、长时自主工作流。

Keeping the browser context is this server's core value — the README states explicitly that the MCP form suits agentic loops needing persistent state, rich introspection and iterative reasoning, e.g. exploratory automation, self-healing tests, long-running autonomous workflows.

权限与限制Permissions & limits

需要给浏览器授予权限,且官方明确说明限制手段不是安全边界。

--grant-permissions 可授予 geolocation、clipboard-read、clipboard-write 等权限。

--allowed-origins 与 --blocked-origins 的文档原文明确写着: 「does not serve as a security boundary」且不影响重定向。 默认允许所有来源。

The browser must be granted permissions, and the official docs state plainly that the restriction controls are not a security boundary.

--grant-permissions can grant geolocation, clipboard-read, clipboard-write and similar permissions.

The documentation for --allowed-origins and --blocked-origins states verbatim: "does not serve as a security boundary" and does not affect redirects. All origins are allowed by default.

适合什么任务Best for

需要浏览器自动化且要保持会话状态的场景: 探索性自动化、自愈测试、长时自主工作流。

不适合高吞吐编码 agent——README 自己建议这类场景改用 Playwright CLI + SKILLS,因为 token 效率更高。

Scenarios needing browser automation that must keep session state: exploratory automation, self-healing tests, long-running autonomous workflows.

Not a fit for high-throughput coding agents — the README itself recommends Playwright CLI + SKILLS for those, for better token efficiency.

传输方式Transport

支持 stdio,另提供 HTTP endpoint 模式(--endpoint) 与浏览器扩展连接模式(--extension,需装 Playwright 扩展,仅 Edge / Chrome)。

--shared-browser-context 用于共享浏览器上下文。 多个 HTTP 客户端可共用同一上下文。

Supports stdio, and offers an HTTP endpoint mode (--endpoint) plus a browser-extension connection mode (--extension; requires the Playwright extension, Edge / Chrome only).

--shared-browser-context shares a browser context; multiple HTTP clients can share one context.

认证机制Authentication

stdio 形态无独立认证层,继承客户端用户权限。

HTTP 模式(2026-10-08 核验官方 README):选项表没有 token / auth 相关参数。Docker 示例直接以 --host 0.0.0.0 裸监听。官方明确声明

“Playwright MCP is not a security boundary”,要求按 MCP 安全最佳 实践自行加固(反向代理 / 网络层)。认证要自己加,别默认它有。

The stdio form has no separate authentication layer; it inherits the client user's permissions.

HTTP mode (official README verified 2026-10-08): the options table has no token/auth parameter. The Docker example listens bare with --host 0.0.0.0. The official docs state plainly

"Playwright MCP is not a security boundary", requiring users to harden it themselves (reverse proxy / network layer) per MCP security best practices. Add authentication yourself; do not assume it exists.

权限范围Permission scope

控制的是浏览器而非文件,但风险面同样宽: 默认允许访问所有来源(--allowed-origins 默认放行全部), 且可被授予地理位置、剪贴板读写等浏览器权限。

官方明确声明来源限制不是安全边界, 需要真正隔离时应使用 --isolated 或容器化网络策略。

What it controls is the browser, not files — but the risk surface is just as wide: all origins are allowed by default (--allowed-origins allows everything by default), and browser permissions such as geolocation and clipboard read/write can be granted.

The official docs state plainly that origin restrictions are not a security boundary; for real isolation use --isolated or containerized network policies.

头号误解Top misconception

  • 以为 allowed-origins 能当访问白名单,官方明说不构成安全边界且不防重定向Treating allowed-origins as an access allowlist — the official docs state it is not a security boundary and does not guard against redirects
  • 以为无头模式会常驻,实际 headless 默认 1 小时空闲即关,headed 默认永不关Assuming headless mode stays resident — headless closes after 1 hour idle by default, while headed never closes by default
  • 在高吞吐编码场景硬上 MCP,官方自己建议改用 CLI + SKILLSForcing MCP into high-throughput coding work — the official guidance itself suggests CLI + SKILLS instead

未知项清单Known unknowns

  • 多客户端共用上下文(--shared-browser-context)时的状态隔离程度
  • 重定向绕过来源限制的具体表现
  • How isolated state is when multiple clients share a context (--shared-browser-context)
  • The concrete behaviour of redirects bypassing origin restrictions

证据来源Evidence sources

判断可回到以下一手源复核。本站核验日Every judgement can be rechecked against the primary sources below. Verified on 2026-10-23,内容更新日content updated on 2026-10-08。

类型Type名称Name链接Link
docsMicrosoft · Playwright MCP README(含来源限制免责声明)Microsoft · Playwright MCP README (with the origin-restriction disclaimer)https://github.com/microsoft/playwright-mcp
changelogMicrosoft · Playwright MCP Releases(v0.0.83 / v0.0.82 / v0.0.81)Microsoft · Playwright MCP Releases (v0.0.83 / v0.0.82 / v0.0.81)https://github.com/microsoft/playwright-mcp/releases
changelogMicrosoft · Playwright MCP CommitsMicrosoft · Playwright MCP Commitshttps://github.com/microsoft/playwright-mcp/commits/main
docsModel Context Protocol · 规范Model Context Protocol · specificationhttps://modelcontextprotocol.io/specification

实测记录Measured runs

本档未在真实客户端逐项跑通;工具清单与权限来自官方 README。

实测建议:重点测 token 消耗——同一任务下 MCP 形态 vs 截图形态的 上下文占用差异,这是官方选型建议的核心依据,值得量化。

This site has not completed measured runs. The test protocol is at protocols/mcp/_protocol.md.

Suggested measurement: focus on token consumption — the context-footprint difference between the MCP form and the screenshot form on the same task. That is the core basis of the official selection recommendation and is worth quantifying.

变更记录说明Change-log notes

本对象有独立 releases,可直接引用:

版本日期
v0.0.832026-09-28
v0.0.822026-09-18
v0.0.812026-09-14

版本号仍在 0.0.x,说明接口可能还会变。引用具体工具名时要注意。

This object has its own releases, directly citable:

VersionDate
v0.0.832026-09-28
v0.0.822026-09-18
v0.0.812026-09-14

The version is still 0.0.x, meaning interfaces may still change — take care when citing specific tool names.

核心设计:用无障碍树,不用像素Core design: the accessibility tree, not pixels

Fast and lightweight — Uses Playwright's accessibility tree, not pixel-based input.
LLM-friendly — No vision models needed, operates purely on structured data.
Deterministic tool application — Avoids ambiguity common with screenshot-based approaches.

这三点是这个 server 与其他浏览器自动化方案的根本差异:

方式代价确定性
截图 + 视觉模型token 消耗大,需要视觉能力低(模型可能看错)
无障碍树token 可控高(结构化数据)
Fast and lightweight — Uses Playwright's accessibility tree, not pixel-based input.
LLM-friendly — No vision models needed, operates purely on structured data.
Deterministic tool application — Avoids ambiguity common with screenshot-based approaches.

These three points are the fundamental difference between this server and other browser-automation approaches:

ApproachCostDeterminism
Screenshot + vision modelheavy token consumption, needs vision capabilitylow (the model may misread)
Accessibility treecontrollable tokenshigh (structured data)

官方原文:来源限制不是安全边界⚠ The official self-limitation on origin restrictions (original wording)

--allowed-origins 与 --blocked-origins 的文档里写着:

Important: does not serve as a security boundary and does not affect redirects.

翻译:重要——不构成安全边界,且不影响重定向。

这意味着:

  • 配了 allowed-origins,重定向仍可绕过
  • 它是「减少意外」的工具,不是「阻止访问」的机制

官方主动写出这句话,比我们自己推断更有价值。 这正是本站想做的:把官方自己承认的边界记录下来。

The docs for --allowed-origins and --blocked-origins state:

Important: does not serve as a security boundary and does not affect redirects.

This means:

  • even with allowed-origins configured, redirects can still bypass it
  • it is a tool for "reducing accidents", not a mechanism for "blocking access"

The official docs writing this sentence themselves is worth more than our own inference. That is exactly what this site aims to do: record the boundaries the official side itself acknowledges.

MCP 还是 CLI?官方给了明确建议MCP or CLI? The official docs give a clear recommendation

这是 README 里少见的、直接给出选型建议的一段:

形态官方判断理由
Playwright CLI + SKILLS更适合高吞吐编码 agentCLI 调用 token 效率更高,不用加载大工具 schema 和冗长无障碍树
MCP适合特定 agentic loop需要持久状态、丰富内省、对页面结构做迭代推理时

具体场景:探索性自动化、自愈测试、长时自主工作流。

换句话说:如果你是编码 agent 且要频繁操作浏览器,官方建议你别用 MCP。

This is a rare passage in the README that gives a direct selection recommendation:

FormOfficial judgementReason
Playwright CLI + SKILLSbetter for high-throughput coding agentsCLI calls are more token-efficient; no large tool schemas or verbose accessibility trees to load
MCPbetter for specific agentic loopswhen persistent state, rich introspection and iterative reasoning over page structure are needed

Concrete scenarios: exploratory automation, self-healing tests, long-running autonomous workflows.

In other words: if you are a coding agent frequently driving the browser, the official docs recommend not using MCP.

配置项与安全相关性Configuration options and security relevance

参数默认安全影响
--allowed-origins放行全部官方声明不构成安全边界
--blocked-origins未设置黑名单在白名单前评估;单独使用时未匹配仍放行
--grant-permissions无可授予 geolocation / clipboard-read / clipboard-write
--isolated关开启后 profile 仅存内存,不落盘
--headless关(有头)影响 idle-timeout 行为

--isolated 是这里最值得注意的安全选项。它让浏览器 profile 不落盘。 它适合处理敏感登录态的场景。

FlagDefaultSecurity impact
--allowed-originsallows everythingofficially stated not to be a security boundary
--blocked-originsunsetthe blocklist is evaluated before the allowlist; alone, unmatched origins still pass
--grant-permissionsnonecan grant geolocation / clipboard-read / clipboard-write
--isolatedoffwhen on, the profile is in-memory only, never persisted
--headlessoff (headed)affects idle-timeout behaviour

--isolated is the security option most worth noting here. It keeps the browser profile off disk. It suits scenarios handling sensitive login state.

浏览器生命周期Browser lifecycle

--idle-timeout:空闲多少毫秒后关闭浏览器,下次工具调用会重新拉起。
  headless 默认 1 小时
  headed    默认永不关闭
  0         禁用该行为

这个默认值差异很重要。headless 会自动关(省资源)。headed 常驻(保持登录态)。 如果你依赖登录状态,headed 模式反而更省事。

--idle-timeout: close the browser after this many ms idle; the next tool call relaunches it.
  headless  defaults to 1 hour
  headed    never closes by default
  0         disables the behaviour

This default-value difference matters a lot. Headless closes automatically (saving resources). Headed stays resident (keeping login state). If you depend on login state, headed mode is actually less hassle.

能力边界Capability boundaries

  • ✅ 浏览器自动化、无障碍树快照、结构化输出
  • ✅ stdio / HTTP endpoint / 扩展三种连接方式
  • ❌ 不提供文件访问
  • ⚠ 来源限制不构成安全边界
  • ✅ browser automation, accessibility-tree snapshots, structured output
  • ✅ three connection modes: stdio / HTTP endpoint / extension
  • ❌ provides no file access
  • ⚠ origin restrictions do not constitute a security boundary

相关条目Related entries

本页由This page is generated from the ai-handbook 数据层生成(CC BY 4.0)。data layer (CC BY 4.0). 方法论与坐标系定义见仓库内For the methodology and coordinate definitions, see METHODOLOGY.md.