playwright-mcp-skill
Original:🇺🇸 English
Translated
1 scripts
Run browser automation through @playwright/mcp over UXC stdio MCP, with daemon-friendly session reuse and safe action guardrails. Use when tasks need deterministic page navigation, DOM snapshots, and scripted browser interaction from CLI.
11installs
Sourceholon-run/uxc
Added on
NPX Install
npx skill4agent add holon-run/uxc playwright-mcp-skillTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Playwright MCP Skill
Use this skill to run Playwright MCP operations through using fixed stdio endpoints.
uxcReuse the skill for generic protocol discovery, auth/error handling, and envelope parsing rules.
uxcPrerequisites
- is installed and available in
uxc.PATH - is available in
npx(Node.js installed).PATH - Network access for first-time package fetch.
@playwright/mcp - Browser runtime can start locally (headless mode is default in this skill).
Core Workflow (Playwright-Specific)
Endpoint candidate inputs before finalizing:
- Raw package form from docs:
npx @playwright/mcp@latest - Reliable non-interactive form:
npx -y @playwright/mcp@latest - Isolated/headless stable form (default for this skill):
npx -y @playwright/mcp@latest --headless --isolated- Shared-profile headless form (for persistent login state):
npx -y @playwright/mcp@latest --headless --user-data-dir ~/.uxc/playwright-profile- Shared-profile headed form (for interactive debug with same login state):
npx -y @playwright/mcp@latest --user-data-dir ~/.uxc/playwright-profile
- Verify protocol/path from official source and probe:
- Official source:
https://github.com/microsoft/playwright-mcp - probe candidate endpoints with:
uxc "npx -y @playwright/mcp@latest --headless --isolated" -h
- Confirm protocol is MCP stdio (in envelope).
protocol == "mcp"
- Official source:
- Detect auth requirement explicitly:
- Run host help or a minimal read call and inspect envelope.
- default flow is no OAuth/API key for local stdio use.
@playwright/mcp
- Use fixed link command by default:
command -v playwright-mcp-cli- If missing, create it:
uxc link playwright-mcp-cli "npx -y @playwright/mcp@latest --headless --isolated"
- Optional shared-profile dual command setup for persistent sessions:
command -v playwright-mcp-headlesscommand -v playwright-mcp-uiuxc link --daemon-exclusive ~/.uxc/playwright-profile playwright-mcp-headless "npx -y @playwright/mcp@latest --headless --user-data-dir ~/.uxc/playwright-profile"uxc link --daemon-exclusive ~/.uxc/playwright-profile playwright-mcp-ui "npx -y @playwright/mcp@latest --user-data-dir ~/.uxc/playwright-profile"
playwright-mcp-cli -h- If command conflict is detected and cannot be safely reused, stop and ask skill maintainers to pick another fixed command name.
- Inspect operation schema before execution:
playwright-mcp-cli browser_navigate -hplaywright-mcp-cli browser_snapshot -hplaywright-mcp-cli browser_click -h
- Prefer read-first interaction:
- Start with navigation/snapshot before mutating page state.
- Execute actions with explicit confirmation when impact is high:
- Confirm before form submission, checkout, delete/destructive actions, or irreversible multi-step flows.
Guardrails
- Keep automation on JSON output envelope; do not rely on .
--text - Parse stable fields first: ,
ok,kind,protocol,data.error - Use as default command path.
playwright-mcp-cli - is equivalent to
playwright-mcp-cli <operation> ....uxc "npx -y @playwright/mcp@latest --headless --isolated" <operation> ... - Use direct only as temporary fallback when link setup is unavailable.
uxc "<endpoint>" ... - If browser profile conflict appears, keep in endpoint and retry via the same fixed link command.
--isolated - When using shared , run headless/headed links serially (not concurrently).
--user-data-dir - To enable seamless switching between headed UI login and headless CLI automation using the same profile directory, set a daemon exclusive key:
- Prefer link-level setup (recommended above), or set for ad-hoc runs.
UXC_DAEMON_EXCLUSIVE=~/.uxc/playwright-profile - If the profile is still busy (another session is actively running), fallback:
uxc daemon stop
- Prefer link-level setup (recommended above), or set
- Prefer over screenshots for model-action loops.
browser_snapshot
References
- Invocation patterns:
references/usage-patterns.md