---
title: "Playwright：Claude、Cursor、Codex 配置指南 · DotsAgent"
description: "通过无障碍快照控制真实浏览器，让 agent 能够浏览页面、点击元素和填写表单。 在 13 个 MCP 客户端中配置 Playwright。"
url: https://dotsagent.io/zh/mcp/servers/playwright
---

浏览器自动化 · Microsoft

# 配置 Playwright

通过无障碍快照控制真实浏览器，让 agent 能够浏览页面、点击元素和填写表单。

- **发布者**: Microsoft 官方
- **本地运行**: `npx @playwright/mcp@latest`
- **传输方式**: stdio, streamable-http
- **身份验证**: 无需身份验证。
- **可访问内容**: 在浏览器会话中执行操作：点击、输入和提交。
- **许可证**: Apache-2.0
- **源码**: [github.com/microsoft/playwright-mcp](https://github.com/microsoft/playwright-mcp)
- **状态**: 活跃

## 安装

此服务器会在你的本机上作为客户端的子进程运行。你需要安装其命令所用的运行时，例如 npx 需要 Node.js、uvx 需要 uv，或者使用 Docker；还需要设置 Environment 下列出的变量。

### Claude Code

`shell`

```
claude mcp add --scope project playwright -- npx @playwright/mcp@latest
```

### Cursor

`.cursor/mcp.json`

```
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
```

### Codex

`~/.codex/config.toml`

```
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
```

[其他客户端的配置 →](https://dotsagent.io/zh/mcp/config#add=playwright)

## 浏览器自动化 中的其他服务器

- [Chrome DevTools](https://dotsagent.io/zh/mcp/servers/chrome-devtools): 控制 Chrome 并读取 DevTools 数据，例如网络请求、控制台输出和性能跟踪。

## 来源

1. [github.com](https://github.com/microsoft/playwright-mcp)/microsoft/playwright-mcp

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
