playwright-mcp
playwright-mcp の使い方
導入
playwright-mcp(Model Context Protocol)は、AIアシスタントとブラウザ自動化のギャップを埋める強力なツールです。AIモデルがウェブブラウザと対話し、DOM要素を検査し、ユーザーインタラクションを記録し、より高精度なPlaywrightテストスクリプトを生成することを可能にします。このガイドでは、playwright-mcpの効果的な設定と使用方法について説明します。
Related MCP server: browser-devtools-mcp
ツール
ブラウザ インターフェースで利用可能なツール:
ブラウザツールボックス
DOMを選択 (🎯): クリックすると、ページからHTML要素を選択してキャプチャします。テストケースのセレクターを記録する際に使用します。
画像を選択 (📸): 特定の要素のスクリーンショットをキャプチャします。ビジュアルテストやドキュメント作成に便利です。
インタラクションの記録 (📋): クリック、入力、ナビゲーションといったブラウザインタラクションを記録します。これらのインタラクションは自動的にセレクターを生成し、Claude や Cursor などの MCP クライアントにコンテキストとして渡すことで、テストケースの作成に役立ちます。
MCPコマンド
init-browser: Playwright ブラウザを初期化します。get-context: テストケースの作成に使用するウェブサイトのコンテキストを取得します。execute-code: 現在のページに対してカスタム Playwright JS コードを実行します。get-screenshot: 現在のページのスクリーンショットを取得するget-full-dom: 現在のページの完全なDOMを取得します。(代わりにget-context使用をお勧めします)
もっと詳しく知る
さらに詳しく知りたいですか? 完全なドキュメントをご覧ください。
Available Tools
5 toolsexecute-codeA
Execute custom Playwright JS code against the current page
Inputs: code (required).
get-contextB
Get the website context which would be used to write the testcase
Inputs: no named parameters.
get-full-domA
Get the full DOM of the current page. (Deprecated, use get-context instead)
Inputs: no named parameters.
get-screenshotB
Get a screenshot of the current page
Inputs: no named parameters.
init-browserC
Initialize a browser with a URL
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools have distinct purposes, but get-context and get-full-dom overlap significantly, with the latter deprecated in favor of the former. This creates ambiguity about which to use for DOM-related tasks, though the deprecation note helps clarify.
The tools follow a consistent verb_noun pattern with hyphens, such as execute-code and get-screenshot. The only minor deviation is init-browser, which uses 'init' instead of a more standard verb like 'initialize', but overall the naming is predictable and readable.
With 5 tools, the count is reasonable for a Playwright automation server, covering core operations like initialization, execution, and inspection. It might benefit from additional tools for actions like navigation or element interaction, but it's well-scoped for basic functionality.
The tools cover initialization, code execution, and page inspection, but there are notable gaps for common Playwright workflows, such as navigation (e.g., go-to-url), element interaction (e.g., click, fill), or test assertion. This limits the server's ability to handle full automation tasks without workarounds.
Maintenance
Related MCP Connectors
Run, debug, and triage tests from your IDE using natural language, no dashboard switching, no manual data transfers. The TestMu AI (formerly LambdaTest) MCP Server is a single remote server exposing four tool suites: HyperExecute — analyze your project, generate YAML configs and test runner commands, then monitor jobs and sessions. Automation — pull a TestID's details plus command, network, and console logs into one chat for instant root-cause analysis. Includes mobile app upload. SmartUI — explain pixel, layout, DOM, and perceptual changes in a visual regression run, with context-aware React/HTML/CSS fixes. Accessibility — audit any public URL or a local React app against WCAG and get ready-to-apply remediation steps. Connects over https://mcp.lambdatest.com/mcp using OAuth 2.1 — no API keys in your config. One-click install in Cursor; works with Claude, GitHub Copilot, Cline, and any MCP client. Tests execute on the TestMu AI cloud: 3,000+ browsers and 10,000+ real devices.
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Live browser debugging for AI assistants — DOM, console, network via MCP.
MCP server for Mint — AI-powered QA that runs your app in a real browser on every PR.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI-powered browser automation, web scraping, and testing using Playwright across Chromium, Firefox, and WebKit. It allows users to perform actions like navigation, clicking, typing, and taking screenshots through natural language interfaces.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides AI coding assistants with comprehensive browser automation and debugging capabilities using Playwright, including visual inspection, DOM debugging, and execution monitoring.MIT
- AlicenseNot gradedqualityDmaintenancePlaywright-powered browser automation and debugging for VS Code and Cursor via the Model Context Protocol (MCP).52MIT
- AlicenseCqualityCmaintenanceAn MCP server that enables AI agents to autonomously test, debug, and analyze web interfaces visually using Playwright, with 30 tools for screenshots, workflows, performance, and visual comparison.3029 npm84ISC