Related problems
暂无已收录问题。
Member of combos (2)
combo-auto-test— 自动化测试闭环(静态分析 → 沙箱执行 → 浏览器 E2E)combo-web-deploy-verify— 网页部署验证
No conflict-matrix pairs for this tool yet.
# Playwright MCP — Agent Guide
name: playwright-mcp | version_range: 0.0.79~0.0.79 | generated: 2026-08-29
title_en: Playwright MCP - Browser Control for Agents via MCP | desc_en: Gives Agents a browser control surface (navigate/click/fill/screenshot/assert) over the standard MCP protocol.
Preflight
note: Requires Node >= 18; use --headless on GUI-less environments.
node --version
预期输出: see command output
Install
note: npmmirror prefix required in mainland China (verified 3s). Browser engine required once: npx --no-install playwright install chromium (113.9MiB, verified).
npm_config_registry=https://registry.npmmirror.com npm install -g @playwright/mcp
npx --no-install @playwright/mcp --version
预期输出: Version 0.0.79
Operations
Start the MCP server (HTTP+SSE mode)
note: Point client url to /mcp endpoint; default port 8931 (--port to change); stdio mode also supported.
npx --no-install @playwright/mcp --port 8931 --headless --browser chromium
预期输出: Listening on http://localhost:8931
Verify the server is alive
note: Rejecting invalid GET is expected safe behavior; only POST JSON-RPC is accepted.
curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:8931/mcp
预期输出: non-200 (403 on root path verified 2026-08-29)
Headless browser smoke test
note: Proves the browser engine works in this environment.
node -e "const {chromium}=require('@playwright/mcp/node_modules/playwright');(async=>{const b=await chromium.launch({headless:true});const p=await b.newPage;await p.goto('data:text/html,<title>ok</title>');console.log(await p.title);await b.close})"
预期输出: ok
Uninstall
note: Browser engine cache ~/.cache/ms-playwright optional to remove (~114MiB).
npm uninstall -g @playwright/mcp
command -v @playwright/mcp >/dev/null 2>&1 && echo "残留: playwright-mcp 仍存在" || echo "playwright-mcp removed: OK"
预期输出: playwright-mcp removed: OK
Facts
writes: ~/.cache/ms-playwright (browser engine cache), temporary browser profile at runtime | runtime: MCP server (stdio or HTTP+SSE, default port 8931) | notes: no project/user config writes; permissions restricted by default (workspace roots, allowed-hosts); sensitive switches (--allow-unrestricted-file-access) require explicit opt-in; headless mode verified 2026-08-29.
Source: playwright-mcp · validated 2026-08-29 · v0.0.79~0.0.79