MCP Configs2026年4月6日·1 分钟阅读

Playwright MCP — Browser Automation for AI Agents

Official Playwright MCP server that gives AI agents full browser control — navigate pages, fill forms, click buttons, take screenshots, and run end-to-end tests. 3,000+ stars.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Community
入口
Playwright MCP — Browser Automation for AI Agents
安全暂存命令
npx -y tokrepo@latest install c07ce036-3fd5-48ae-8a2d-9c0b02201c50 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Official Playwright MCP server that gives AI agents like Claude Code full control over web browsers for testing and automation.
§01

What it is

Playwright MCP is the official Model Context Protocol server for Playwright browser automation. It gives AI agents like Claude Code full control over web browsers: navigate pages, fill forms, click buttons, extract content, take screenshots, and run end-to-end tests. The agent sees the page structure and can interact with any element through natural language commands.

The server is designed for developers who need AI-assisted web testing, scraping, or workflow automation. It works with Claude Code, Cursor, and any MCP-compatible client. Setup takes under one minute.

§02

How it saves time or tokens

Playwright MCP eliminates the need to write Playwright scripts manually for one-off browser tasks. Instead of writing boilerplate code for navigation, form filling, and assertions, you describe the action in plain English and the agent handles the Playwright API calls. For repetitive QA workflows, this reduces test authoring time significantly. The agent also interprets page structure contextually, reducing the back-and-forth of element selection.

§03

How to use

  1. Add the Playwright MCP server to your .mcp.json:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-playwright"]
    }
  }
}
  1. Restart Claude Code to load the new server.
  1. Ask the agent to perform browser tasks in natural language: 'Open https://example.com, take a screenshot, and describe what you see.'
§04

Example

Common interaction patterns with Playwright MCP:

# Navigation
'Open https://github.com/trending'
'Go back to the previous page'
'Wait for the login form to appear'

# Form interaction
'Click the Sign In button'
'Fill the email field with test@example.com'
'Select Monthly from the billing dropdown'

# Content extraction
'Extract all product names and prices from this page'
'Get the text content of the main article'
'List all links on this page'

The agent translates these into Playwright API calls, executes them against the browser, and returns the results.

§05

Related on TokRepo

§06

Common pitfalls

  • The MCP server launches a new browser instance. Websites requiring login will need you to authenticate first or provide session cookies.
  • Dynamic SPAs with heavy JavaScript may require explicit wait commands. Tell the agent to 'wait for the content to load' before extracting data.
  • Screenshot quality depends on viewport size. Specify dimensions if you need consistent visual output across runs.

常见问题

What browsers does Playwright MCP support?+

Playwright MCP uses Playwright under the hood, which supports Chromium, Firefox, and WebKit. By default it launches Chromium, but you can configure it for other browsers depending on your testing needs.

Can I use Playwright MCP for web scraping?+

Yes. The content extraction tools let you pull text, links, tables, and structured data from any page. The agent navigates JavaScript-heavy SPAs that static scrapers cannot handle, making it effective for modern web applications.

How does Playwright MCP differ from Puppeteer MCP?+

Playwright MCP uses Microsoft Playwright, which supports multiple browsers and has more robust auto-waiting. Puppeteer MCP uses Google Puppeteer, which is Chromium-only. Playwright MCP generally provides better cross-browser testing support.

Is Playwright MCP suitable for production test automation?+

Playwright MCP is best for interactive test exploration and one-off automation tasks. For CI/CD pipelines, you would typically generate Playwright scripts from your MCP session and run them directly without the MCP layer.

Does Playwright MCP work with authentication-protected pages?+

Yes, but you need to handle authentication. You can ask the agent to fill login forms, or provide pre-authenticated session cookies. For SSO or MFA flows, manual intervention may be needed for the initial authentication step.

引用来源 (3)
🙏

来源与感谢

Built on Playwright by Microsoft. Licensed under Apache 2.0.

playwright — ⭐ 70,000+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产