playwright-mcp MCP工具 是 AI Skill Hub 本期精选MCP工具之一。在 GitHub 上收获超过 32.5k 颗 Star,综合评分 8.5 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
基于Playwright的MCP协议服务器实现,提供浏览器自动化能力。支持网页交互、截图、数据采集等功能,适合开发者集成到AI应用中进行Web自动化任务处理。
playwright-mcp MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
基于Playwright的MCP协议服务器实现,提供浏览器自动化能力。支持网页交互、截图、数据采集等功能,适合开发者集成到AI应用中进行Web自动化任务处理。
playwright-mcp MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/microsoft/playwright-mcp
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"playwright-mcp-mcp--": {
"command": "npx",
"args": ["-y", "playwright-mcp"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 playwright-mcp MCP工具 执行以下任务... Claude: [自动调用 playwright-mcp MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"playwright-mcp_mcp__": {
"command": "npx",
"args": ["-y", "playwright-mcp"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
First, install the Playwright MCP server with your client.
Standard config works in most of the tools:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code"> <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">
<details> <summary>Amp</summary>
Add via the Amp VS Code extension settings screen or by updating your settings.json file:
"amp.mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
Amp CLI Setup:
Add via the amp mcp addcommand below
amp mcp add playwright -- npx @playwright/mcp@latest
</details>
<details> <summary>Antigravity</summary>
Add via the Antigravity settings or by updating your configuration file:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
</details>
<details> <summary>Claude Code</summary>
Use the Claude Code CLI to add the Playwright MCP server:
claude mcp add playwright npx @playwright/mcp@latest </details>
<details> <summary>Claude Desktop</summary>
Follow the MCP install guide, use the standard config above.
</details>
<details> <summary>Cline</summary>
Follow the instruction in the section Configuring MCP Servers
Example: Local Setup
Add the following to your cline_mcp_settings.json file:
{
"mcpServers": {
"playwright": {
"type": "stdio",
"command": "npx",
"timeout": 30,
"args": [
"-y",
"@playwright/mcp@latest"
],
"disabled": false
}
}
}
</details>
<details> <summary>Codex</summary>
Use the Codex CLI to add the Playwright MCP server:
codex mcp add playwright npx "@playwright/mcp@latest"
Alternatively, create or edit the configuration file ~/.codex/config.toml and add:
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
For more information, see the Codex MCP documentation.
</details>
<details> <summary>Copilot</summary>
Use the Copilot CLI to interactively add the Playwright MCP server:
/mcp add
Alternatively, create or edit the configuration file ~/.copilot/mcp-config.json and add:
{
"mcpServers": {
"playwright": {
"type": "local",
"command": "npx",
"tools": [
"*"
],
"args": [
"@playwright/mcp@latest"
]
}
}
}
For more information, see the Copilot CLI documentation.
</details>
<details> <summary>Cursor</summary>
<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">
Go to Cursor Settings -> MCP -> Add new MCP Server. Name to your liking, use command type with the command npx @playwright/mcp@latest. You can also verify config or add command like arguments via clicking Edit.
</details>
<details> <summary>Factory</summary>
Use the Factory CLI to add the Playwright MCP server:
droid mcp add playwright "npx @playwright/mcp@latest"
Alternatively, type /mcp within Factory droid to open an interactive UI for managing MCP servers.
For more information, see the Factory MCP documentation.
</details>
<details> <summary>Gemini CLI</summary>
Follow the MCP install guide, use the standard config above.
</details>
<details> <summary>Goose</summary>
Go to Advanced settings -> Extensions -> Add custom extension. Name to your liking, use type STDIO, and set the command to npx @playwright/mcp. Click "Add Extension". </details>
<details> <summary>Junie</summary>
To add the Playwright MCP server in Junie CLI:
/mcpCtrl+A to add a new MCP serverAlternatively, add to .junie/mcp/mcp.json:
{
"mcpServers": {
"Playwright": {
"command": "npx",
"args": [
"-y",
"@playwright/mcp@latest"
]
}
}
}
For more information, see the Junie MCP configuration documentation.
</details>
<details> <summary>Kiro</summary>
Follow the MCP Servers documentation. For example in .kiro/settings/mcp.json:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
} </details>
<details> <summary>LM Studio</summary>
Go to Program in the right sidebar -> Install -> Edit mcp.json. Use the standard config above. </details>
<details> <summary>opencode</summary>
Follow the MCP Servers documentation. For example in ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"playwright": {
"type": "local",
"command": [
"npx",
"@playwright/mcp@latest"
],
"enabled": true
}
}
}
</details>
<details> <summary>Qodo Gen</summary>
Open Qodo Gen chat panel in VSCode or IntelliJ → Connect more tools → + Add new MCP → Paste the standard config above.
Click <code>Save</code>. </details>
<details> <summary>VS Code</summary>
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code"> <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">
Follow the MCP install guide, use the standard config above. You can also install the Playwright MCP server using the VS Code CLI:
```bash
Playwright MCP server supports following arguments. They can be provided in the JSON configuration above, as a part of the "args" list:
| Option | Description |
|---|---|
| --allowed-hosts <hosts...> | comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass '*' to disable the host check.<br>*env* PLAYWRIGHT_MCP_ALLOWED_HOSTS |
| --allowed-origins <origins> | semicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all. Important: *does not* serve as a security boundary and *does not* affect redirects.<br>*env* PLAYWRIGHT_MCP_ALLOWED_ORIGINS |
| --allow-unrestricted-file-access | allow access to files outside of the workspace roots. Also allows unrestricted access to file:// URLs. By default access to file system is restricted to workspace root directories (or cwd if no roots are configured) only, and navigation to file:// URLs is blocked.<br>*env* PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS |
| --blocked-origins <origins> | semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed. Important: *does not* serve as a security boundary and *does not* affect redirects.<br>*env* PLAYWRIGHT_MCP_BLOCKED_ORIGINS |
| --block-service-workers | block service workers<br>*env* PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERS |
| --browser <browser> | browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.<br>*env* PLAYWRIGHT_MCP_BROWSER |
| --caps <caps> | comma-separated list of additional capabilities to enable, possible values: vision, pdf, devtools.<br>*env* PLAYWRIGHT_MCP_CAPS |
| --cdp-endpoint <endpoint> | CDP endpoint to connect to.<br>*env* PLAYWRIGHT_MCP_CDP_ENDPOINT |
| --cdp-header <headers...> | CDP headers to send with the connect request, multiple can be specified.<br>*env* PLAYWRIGHT_MCP_CDP_HEADER |
| --cdp-timeout <timeout> | timeout in milliseconds for connecting to CDP endpoint, defaults to 30000ms<br>*env* PLAYWRIGHT_MCP_CDP_TIMEOUT |
| --codegen <lang> | specify the language to use for code generation, possible values: "typescript", "none". Default is "typescript".<br>*env* PLAYWRIGHT_MCP_CODEGEN |
| --config <path> | path to the configuration file.<br>*env* PLAYWRIGHT_MCP_CONFIG |
| --console-level <level> | level of console messages to return: "error", "warning", "info", "debug". Each level includes the messages of more severe levels.<br>*env* PLAYWRIGHT_MCP_CONSOLE_LEVEL |
| --device <device> | device to emulate, for example: "iPhone 15"<br>*env* PLAYWRIGHT_MCP_DEVICE |
| --executable-path <path> | path to the browser executable.<br>*env* PLAYWRIGHT_MCP_EXECUTABLE_PATH |
| --extension | Connect to a running browser instance (Edge/Chrome only). Requires the "Playwright Extension" to be installed.<br>*env* PLAYWRIGHT_MCP_EXTENSION |
| --endpoint <endpoint> | Bound browser endpoint to connect to.<br>*env* PLAYWRIGHT_MCP_ENDPOINT |
| --grant-permissions <permissions...> | List of permissions to grant to the browser context, for example "geolocation", "clipboard-read", "clipboard-write".<br>*env* PLAYWRIGHT_MCP_GRANT_PERMISSIONS |
| --headless | run browser in headless mode, headed by default<br>*env* PLAYWRIGHT_MCP_HEADLESS |
| --host <host> | host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.<br>*env* PLAYWRIGHT_MCP_HOST |
| --ignore-https-errors | ignore https errors<br>*env* PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORS |
| --init-page <path...> | path to TypeScript file to evaluate on Playwright page object<br>*env* PLAYWRIGHT_MCP_INIT_PAGE |
| --init-script <path...> | path to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page's scripts. Can be specified multiple times.<br>*env* PLAYWRIGHT_MCP_INIT_SCRIPT |
| --isolated | keep the browser profile in memory, do not save it to disk.<br>*env* PLAYWRIGHT_MCP_ISOLATED |
| --image-responses <mode> | whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".<br>*env* PLAYWRIGHT_MCP_IMAGE_RESPONSES |
| --no-sandbox | disable the sandbox for all process types that are normally sandboxed.<br>*env* PLAYWRIGHT_MCP_NO_SANDBOX |
| --output-dir <path> | path to the directory for output files.<br>*env* PLAYWRIGHT_MCP_OUTPUT_DIR |
| --output-mode <mode> | whether to save snapshots, console messages, network logs to a file or to the standard output. Can be "file" or "stdout". Default is "stdout".<br>*env* PLAYWRIGHT_MCP_OUTPUT_MODE |
| --port <port> | port to listen on for SSE transport.<br>*env* PLAYWRIGHT_MCP_PORT |
| --proxy-bypass <bypass> | comma-separated domains to bypass proxy, for example ".com,chromium.org,.domain.com"<br>*env* PLAYWRIGHT_MCP_PROXY_BYPASS |
| --proxy-server <proxy> | specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"<br>*env* PLAYWRIGHT_MCP_PROXY_SERVER |
| --sandbox | enable the sandbox for all process types that are normally not sandboxed.<br>*env* PLAYWRIGHT_MCP_SANDBOX |
| --save-session | Whether to save the Playwright MCP session into the output directory.<br>*env* PLAYWRIGHT_MCP_SAVE_SESSION |
| --secrets <path> | path to a file containing secrets in the dotenv format<br>*env* PLAYWRIGHT_MCP_SECRETS_FILE |
| --shared-browser-context | reuse the same browser context between all connected HTTP clients.<br>*env* PLAYWRIGHT_MCP_SHARED_BROWSER_CONTEXT |
| --snapshot-mode <mode> | when taking snapshots for responses, specifies the mode to use. Can be "full" or "none". Default is "full".<br>*env* PLAYWRIGHT_MCP_SNAPSHOT_MODE |
| --storage-state <path> | path to the storage state file for isolated sessions.<br>*env* PLAYWRIGHT_MCP_STORAGE_STATE |
| --test-id-attribute <attribute> | specify the attribute to use for test ids, defaults to "data-testid"<br>*env* PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE |
| --timeout-action <timeout> | specify action timeout in milliseconds, defaults to 5000ms<br>*env* PLAYWRIGHT_MCP_TIMEOUT_ACTION |
| --timeout-navigation <timeout> | specify navigation timeout in milliseconds, defaults to 60000ms<br>*env* PLAYWRIGHT_MCP_TIMEOUT_NAVIGATION |
| --user-agent <ua string> | specify user agent string<br>*env* PLAYWRIGHT_MCP_USER_AGENT |
| --user-data-dir <path> | path to the user data directory. If not specified, a temporary directory will be created.<br>*env* PLAYWRIGHT_MCP_USER_DATA_DIR |
| --viewport-size <size> | specify browser viewport size in pixels, for example "1280x720"<br>*env* PLAYWRIGHT_MCP_VIEWPORT_SIZE |
The Playwright MCP server can be configured using a JSON configuration file. You can specify the configuration file using the --config command line option:
npx @playwright/mcp@latest --config path/to/config.json
<details> <summary>Configuration file schema</summary>
{
/**
* The browser to use.
*/
browser?: {
/**
* The type of browser to use.
*/
browserName?: 'chromium' | 'firefox' | 'webkit';
/**
* Keep the browser profile in memory, do not save it to disk.
*/
isolated?: boolean;
/**
* Path to a user data directory for browser profile persistence.
* Temporary directory is created by default.
*/
userDataDir?: string;
/**
* Launch options passed to
* @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
*
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
*/
launchOptions?: playwright.LaunchOptions;
/**
* Context options for the browser context.
*
* This is useful for settings options like `viewport`.
*/
contextOptions?: playwright.BrowserContextOptions;
/**
* Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
*/
cdpEndpoint?: string;
/**
* CDP headers to send with the connect request.
*/
cdpHeaders?: Record<string, string>;
/**
* Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
*/
cdpTimeout?: number;
/**
* Remote endpoint to connect to an existing Playwright server.
*/
remoteEndpoint?: string;
/**
* Paths to TypeScript files to add as initialization scripts for Playwright page.
*/
initPage?: string[];
/**
* Paths to JavaScript files to add as initialization scripts.
* The scripts will be evaluated in every page before any of the page's scripts.
*/
initScript?: string[];
},
/**
* Connect to a running browser instance (Edge/Chrome only). If specified, `browser`
* config is ignored.
* Requires the "Playwright Extension" to be installed.
*/
extension?: boolean;
server?: {
/**
* The port to listen on for SSE or MCP transport.
*/
port?: number;
/**
* The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
*/
host?: string;
/**
* The hosts this server is allowed to serve from. Defaults to the host server is bound to.
* This is not for CORS, but rather for the DNS rebinding protection.
*/
allowedHosts?: string[];
},
/**
* List of enabled tool capabilities. Possible values:
* - 'core': Core browser automation features.
* - 'pdf': PDF generation and manipulation.
* - 'vision': Coordinate-based interactions.
* - 'devtools': Developer tools features.
*/
capabilities?: ToolCapability[];
/**
* Whether to save the Playwright session into the output directory.
*/
saveSession?: boolean;
/**
* Reuse the same browser context between all connected HTTP clients.
*/
sharedBrowserContext?: boolean;
/**
* Secrets are used to replace matching plain text in the tool responses to prevent the LLM
* from accidentally getting sensitive data. It is a convenience and not a security feature,
* make sure to always examine information coming in and from the tool on the client.
*/
secrets?: Record<string, string>;
/**
* The directory to save output files.
*/
outputDir?: string;
console?: {
/**
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
*/
level?: 'error' | 'warning' | 'info' | 'debug';
},
network?: {
/**
* List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*
* Supported formats:
* - Full origin: `https://example.com:8080` - matches only that origin
* - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
*/
allowedOrigins?: string[];
/**
* List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
*
* Supported formats:
* - Full origin: `https://example.com:8080` - matches only that origin
* - Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
*/
blockedOrigins?: string[];
};
/**
* Specify the attribute to use for test ids, defaults to "data-testid".
*/
testIdAttribute?: string;
timeouts?: {
/*
* Configures default action timeout: https://playwright.dev/docs/api/class-page#page-set-default-timeout. Defaults to 5000ms.
*/
action?: number;
/*
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
*/
navigation?: number;
/**
* Configures default expect timeout: https://playwright.dev/docs/test-timeouts#expect-timeout. Defaults to 5000ms.
*/
expect?: number;
};
/**
* Whether to send image responses to the client. Can be "allow", "omit", or "auto". Defaults to "auto", which sends images if the client can display them.
*/
imageResponses?: 'allow' | 'omit';
snapshot?: {
/**
* When taking snapshots for responses, specifies the mode to use.
*/
mode?: 'full' | 'none';
};
/**
* allowUnrestrictedFileAccess acts as a guardrail to prevent the LLM from accidentally
* wandering outside its intended workspace. It is a convenience defense to catch unintended
* file access, not a secure boundary; a deliberate attempt to reach other directories can be
* easily worked around, so always rely on client-level permissions for true security.
*/
allowUnrestrictedFileAccess?: boolean;
/**
* Specify the language to use for code generation.
*/
codegen?: 'typescript' | 'none';
}
</details>
This package provides MCP interface into Playwright. If you are using a coding agent, you might benefit from using the CLI+SKILLS instead.
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
</details>
<details>
<summary>Warp</summary>
Go to `Settings` -> `AI` -> `Manage MCP Servers` -> `+ Add` to [add an MCP Server](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server). Use the standard config above.
Alternatively, use the slash command `/add-mcp` in the Warp prompt and paste the standard config from above:js { "mcpServers": { "playwright": { "command": "npx", "args": [ "@playwright/mcp@latest" ] } } } ```
</details>
<details> <summary>Windsurf</summary>
Follow Windsurf MCP documentation. Use the standard config above.
</details>
高质量开源项目,3.2万Stars证明生态认可度高。MCP协议实现规范,Playwright成熟稳定,适合Web自动化场景集成。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,playwright-mcp MCP工具 在MCP工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | playwright-mcp |
| 原始描述 | 开源MCP工具:Playwright MCP server。⭐32.5k · TypeScript |
| Topics | 浏览器自动化Web测试数据采集MCP协议TypeScript |
| GitHub | https://github.com/microsoft/playwright-mcp |
| License | Apache-2.0 |
| 语言 | TypeScript |
收录时间:2026-05-14 · 更新时间:2026-05-16 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端