playwright-e2e-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | debug | info | warn | error | silent; LOG_LEVEL wins when both LOG_LEVEL and MCP_LOG_LEVEL are set. | info |
| LOG_FORMAT | No | text, or json (also ndjson) for one structured JSON object per line. | text |
| PW_MCP_TOOLS | No | Which tools to expose, as tool names and/or profiles, comma separated (same as the --tools= flag). Profiles: core, triage, inspect, author. | all |
| MCP_LOG_LEVEL | No | Alias of LOG_LEVEL; used when LOG_LEVEL is not set. Default info. | |
| MCP_LOG_FORMAT | No | Alias of LOG_FORMAT; used when LOG_FORMAT is not set. Default text. | |
| PW_MCP_HISTORY | No | Set to 0 to stop recording runs to .playwright-e2e-mcp/history.jsonl. | |
| PW_MCP_HTTP_TOKEN | No | HTTP bridge only: bearer token (16+ characters) that unlocks all tools. | |
| PW_MCP_MAX_CHILDREN | No | HTTP bridge only: how many test runs and browser probes may run at once. | 4 |
| PW_MCP_PROJECT_ROOT | No | Default project root for every tool. Defaults to the server's working directory. | |
| PW_MCP_ALLOWED_HOSTS | No | HTTP bridge only: comma-separated Host allowlist; `*` accepts any. | |
| PW_MCP_ALLOWED_ROOTS | No | Extra directories a caller may pass as projectRoot (`:`-separated, `;` on Windows). | |
| PW_MCP_STORAGE_STATE | No | Default storageState file (inside the project) for the page tools. | |
| PW_MCP_PASSTHROUGH_ENV | No | HTTP bridge only: comma-separated extra variables passed to test runs (e.g. BASE_URL). | |
| PW_MCP_BLOCK_PRIVATE_URLS | No | Set to 1 to make the URL tools refuse loopback, private-network and cloud-metadata addresses. Default off (on for the HTTP bridge). |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| prompts | {
"listChanged": true
} |
| resources | {
"listChanged": true
} |
| extensions | {
"io.modelcontextprotocol/skills": {}
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| run-testA | Run the project's Playwright tests: stats plus each failure's file:line, kind and message. Diagnoses missing installs, dead dev servers, syntax errors, crashes and timeouts (kills the tree, keeps partial results). Reports progress; background: true returns a run id for long suites. Runs are recorded for analyze-history. |
| get-run-statusA | Progress (tests done/total, failures so far) or the final result of a run-test background run; the result becomes the last run for get-failure. waitSeconds waits; cancel stops it. Default: the latest run. |
| get-failureA | Analyze one failure from the most recent run-test execution: full message and code frame, expected vs actual, stack trace, failed network requests (4xx/5xx and dead endpoints), console errors, failure kind (assertion/timeout/browser-crash/syntax/config/server-unreachable) and concrete next steps. Use run-test first. |
| load-reportA | Load a Playwright run that happened elsewhere (a CI job's JSON report, a folder of blob reports from shards, or a GitHub Actions / GitLab CI run URL) so get-failure, suggest-fix and diagnose-flaky work on it like a local run. CI paths are mapped onto this checkout and traces are found in the unpacked test-results artifact; the run is recorded in the history with its commit. |
| suggest-fixA | Patch a failure from the last run: a drifted locator is matched against the DOM at failure (trace, or live url) and replaced with one proven unique; a locator that matches several elements (strict mode) gets the unique one for the intended match; changed copy gets the new expected text. Returns a diff and confidence; apply: true writes it, re-runs the test and reverts if still red. Refuses when the element is truly missing (app bug). |
| inspect-pageA | Open a URL in a fresh headless browser and return its elements with Playwright locators proven unique on the page (role + name first), CSS selectors, visibility, text and console messages. Each call starts clean (no cookies kept): put every step to reach a state, login included, in actions, or open it signed in with storageState/headers. By default it returns the compact locator map; view 'elements' gives the full DOM inventory and view 'aria' returns the accessibility snapshot plus a ready toMatchAriaSnapshot assertion. |
| list-testsA | List the Playwright tests available in the project (file, line, full title, projects), with optional filtering. Uses |
| validate-selectorA | Check a CSS selector, Playwright selector or locator (getByRole/getByTestId…, .first(), .filter(), frameLocator() for iframes) on a live page: validity, match count (actions need exactly 1), sample matches and a sturdier verified locator for each. Counts once after load: use waitFor or actions for late elements. Accepts storageState/headers/actions. |
| audit-accessibilityA | Run axe-core on a live page (WCAG 2.2 AA by default) and return violations worst first, each with the offending elements as verified Playwright locators, the fix, and a regression check to paste into a spec. Accepts storageState/headers/actions to audit pages behind a login or after a step. |
| audit-performanceA | Measure a page's lab Web Vitals (LCP, CLS, TBT, FCP, TTFB, and INP when actions interact) in headless Chromium, optionally as a throttled phone and as the median of several runs. Rates them against Google thresholds or your budgets, names the LCP element and shifting elements as verified locators, lists heavy and render-blocking requests, and returns a budget check for the spec. Accepts storageState/headers/actions/routes. |
| generate-e2e-testA | Scaffold a Playwright test (a .spec.ts, or a test_*.py module in a pytest-playwright project) from a description using the project's REAL selectors. Scans the agent's recent file changes (git working tree / last commit, mtime fallback), extracts data-testid / role / label / placeholder / id locators with their source locations, optionally cross-checks them against the live page, writes a ready-to-run spec, and returns next steps. With |
| compare-visual-stateA | Visual regression check: screenshot a live page (or element), compare it to a stored baseline, and report how many pixels changed, WHERE they changed (bounding regions), and the average color shift ("blue → red"). First call saves the baseline; later calls compare. Writes a red-highlighted diff image for review. |
| diagnose-flakyA | Repeat failing tests (Playwright or pytest-playwright) with retries disabled and return a per-test, evidence-based verdict: CONSISTENTLY FAILING (real bug), FLAKY (pass/fail counts, error-signature variance, duration spread) or NOT REPRODUCING. Runs all repetitions in one process by default. |
| analyze-historyA | Analyze the local run history (.playwright-e2e-mcp/history.jsonl, written by every run and load-report): 'flaky' ranks tests that flip pass/fail and lists broken or regressed ones; 'patterns' groups failures by cause; 'test' shows one test's timeline; 'slow' ranks durations and slowdowns; 'trend' shows stability per day; 'commits' names the commit where each failing or flaky test went bad. |
| audit-testsA | Audit the Playwright test code for flake risks (hard waits, one-shot assertions instead of web-first ones, missing awaits, .only, force clicks, networkidle, element handles, layout selectors, acting right after goto on a server-rendered app before it hydrates) and rank files by how flaky their tests have been in the run history. fix: true rewrites the mechanical ones, re-runs the touched files and restores them if the run fails. TS/JS specs and pytest-playwright modules. |
| bisect-failureA | Find the commit that broke a test: binary-search the git history between a good and a bad commit, running the test at each step in a temporary worktree (your checkout is untouched), and report the first bad commit with its diff summary and failure. good defaults to the newest commit where the run history saw the test pass. |
| check-test-changeA | Heal guard: check that changed tests were not made to pass by checking less. Compares spec files with a git ref (default HEAD = uncommitted changes) or one proposed file (file + after). BLOCK on deleted assertions, skipped/removed tests or .only; WARN on weaker matchers, waitForTimeout, force: true, swallowed errors, raised timeouts or retries. Run it after any AI fix, before committing. |
| check-mocksA | Catch network mocks that drifted from the real API: finds route.fulfill JSON bodies (TS/JS and pytest specs) and routeFromHAR files, GETs each mocked endpoint on the live server (baseUrl) and reports fields the mock has that the API no longer sends, changed types, new nulls and endpoints that are gone. Only GET is sent; write mocks are listed, not replayed. |
| quarantineA | Quarantine flaky tests: they keep running and being reported, but their failures stop failing run-test and the ci command until the entry expires (default 14 days, max 90). add needs owner and reason; list shows what is quarantined and what expired; remove ends it. Stored in playwright-quarantine.json (commit it). |
| save-loginA | Log in once and save the session as a storageState file (default playwright/.auth/.json) for tests and the page tools. If a saved session still passes verify it is reused; expired ones log in again. Secrets stay out of chat: fill values use {{env:E2E_PASSWORD}} and {{totp}} (authenticator code from totpSecretEnv). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| fix-failing-test | Run the tests, diagnose the first failure, apply a verified fix or explain the real bug. |
| triage-flaky-tests | Rank unstable tests from the local run history and diagnose the worst one. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| test-report | The view MCP Apps hosts show for run-test, get-run-status and get-failure results. |
TDQS
Scored across 20 tools
Most tools target clearly distinct phases (run, inspect, generate, fix, audit), and the long descriptions actively spell out boundaries. A few pairs are genuinely adjacent and could still be mispicked: audit-tests vs check-test-change (both audit spec code), diagnose-flaky vs analyze-history (both about flakiness), and inspect-page vs validate-selector (both return verified locators for a live page).
Nearly everything follows a predictable kebab-case verb_noun pattern (run-test, get-failure, audit-accessibility, suggest-fix). The only outlier is the bare verb 'quarantine', which is a minor deviation rather than a convention break.
20 tools sits at the heavy end, but the domain genuinely spans running, debugging, auditing, generating, visual/a11y/perf checks, and session handling, so most tools earn their place. A few (audit-tests/check-test-change, inspect-page/validate-selector) could arguably merge, which keeps it from a 5.
Coverage of the E2E lifecycle is strong: run, list, inspect, generate, heal, bisect, flake-diagnose, history, quarantine, mocks, a11y, perf, visual, and login persistence. Minor gaps remain around directly editing/managing spec files or test config beyond generation, but no core workflow is a dead end.