Skip to main content
Glama

playwright-multi-mcp

A multi-browser automation, web auditing, and DevTools Model Context Protocol (MCP) server built natively on Playwright and CDP.

playwright-multi-mcp lets AI agents launch, isolate, and concurrently control multiple independent browser sessions (separate browser processes/contexts, cookies, localStorage, proxies, viewports, browser engines, and optional persistent userDataDir profiles) while combining full-page interaction, performance & accessibility auditing, trace profiling, device/network emulation, and deep CSS & network inspection in a single unified browser_* toolset.


Features

  • True Multi-Browser Session Management:

    • browser_session_create: Launch isolated chromium, firefox, or webkit instances with custom sessionId, label, userDataDir, proxy, viewport, userAgent, locale, timezoneId, storageState, headless/headed, and initialUrl.

    • browser_session_list: Inspect all active sessions, engines, labels, tabs, and URLs.

    • browser_session_switch: Change the default active session.

    • browser_session_close: Close a specific session, the active session, or all: true.

    • browser_session_storage_state: Export cookies & localStorage from a session (or save to disk) to inspect or clone auth state into another session.

  • Hybrid Session Targeting:

    • Every browser_* tool accepts an optional sessionId.

    • Pass sessionId to operate on a specific browser directly (even concurrently across multiple sessions!).

    • Omit sessionId to target the currently active session—or auto-launch a default session if none exist yet.

  • Structured Accessibility Snapshots ([ref=eN]):

    • Uses Playwright accessibility snapshots with deterministic element refs (e1, e2, ...) so LLMs reason over structured UI trees instead of heavy pixel coordinates.

  • Full Core Toolset:

    • Navigation: browser_navigate, browser_navigate_back

    • Interaction: browser_click, browser_type, browser_fill_form, browser_select_option, browser_hover, browser_drag, browser_press_key, browser_file_upload, browser_handle_dialog

    • Inspection: browser_snapshot, browser_take_screenshot, browser_console_messages, browser_network_requests, browser_network_details, browser_wait_for, browser_evaluate, browser_run_code, browser_css_styles

    • Tabs & Window: browser_tabs, browser_resize, browser_close

    • Web Auditing & Core Web Vitals:

      • browser_audit: Run Performance, Accessibility, Best Practices, and SEO audits (mobile / desktop, navigation / snapshot, optional Slow 4G + 4x CPU throttling) with Core Web Vitals, optimization opportunities, and failing DOM node selectors.

      • browser_performance_score: Streamlined performance score (0–1), FCP, LCP, TBT, CLS, TTFB, and actionable optimization diagnostics.

    • DevTools Tracing, Emulation & Runtime Profiling:

      • browser_trace_start / browser_trace_stop: Record Chromium DevTools performance traces (.json / .json.gz), compute Core Web Vitals, Long Tasks, TBT, and main-thread breakdown.

      • browser_trace_insight: Drill into WebVitals, LongTasks, MainThreadBreakdown, LayoutShifts, or CdpMetrics from the latest trace.

      • browser_performance_metrics: Live JS heap usage, DOM node count, layout/style recalc counts, and paint timings without reloading.

      • browser_emulate: Emulate network throttling (Offline, Slow 3G, Fast 3G, Slow 4G, Fast 4G), CPU slowdown, device viewport, user-agent, geolocation, media features (colorScheme, reducedMotion, forcedColors, contrast), and extra HTTP headers.

  • Dual Transports:

    • Stdio (default, for Claude Desktop, Cursor, Windsurf, Antigravity, VS Code)

    • Streamable HTTP (--port 8931, with /mcp and /health endpoints)


Related MCP server: Browser Control MCP Server

Installation

npm install -g playwright-multi-mcp
npx playwright install chromium

Or run directly without global installation using npx -y playwright-multi-mcp (ensure Playwright Chromium is installed via npx playwright install chromium).

(Optional: run npx playwright install firefox webkit if you plan to launch Firefox or WebKit sessions.)


MCP Client Configuration

Stdio (Claude Desktop / Cursor / Windsurf / Antigravity)

{
  "mcpServers": {
    "playwright-multi": {
      "command": "npx",
      "args": [
        "-y",
        "playwright-multi-mcp"
      ]
    }
  }
}

Pass --headed in args if you want to watch multiple browser windows side-by-side:

{
  "mcpServers": {
    "playwright-multi": {
      "command": "npx",
      "args": [
        "-y",
        "playwright-multi-mcp",
        "--headed"
      ]
    }
  }
}

Streamable HTTP Mode

npx -y playwright-multi-mcp --port 8931 --host 127.0.0.1

Connect your MCP client to http://127.0.0.1:8931/mcp.


CLI Options

Flag

Description

Default

--browser <chromium|firefox|webkit>

Default browser engine

chromium

--channel <name>

Browser channel (e.g. chrome, msedge)

unset

--headed

Show visible browser windows

false

--headless

Run browsers headlessly

true

--viewport-size <WxH>

Default viewport dimensions

1280x720

--port <port>

Start Streamable HTTP server on port

stdio

--host <host>

HTTP bind host

127.0.0.1

--auth-token <token>

Bearer token for HTTP transport (or MCP_AUTH_TOKEN)

unset

--allowed-origins <list>

Comma-separated allowed Origin headers for HTTP

same host/loopback

--allowed-roots <dirs>

Comma-separated allowed directories for file reads/writes

cwd + tmpdir

--allow-any-path

Disable path root confinement

false

--allow-file-urls

Allow file:// URL navigation

false

--block-private-networks

Block RFC1918/loopback targets via DNS & route checks

false (stdio), true (non-loopback HTTP)

--allow-run-code

Enable browser_run_code in HTTP mode

true (stdio), false (HTTP)

--disable-run-code

Disable browser_run_code in all modes

false

--max-sessions <n>

Maximum concurrent browser sessions

10

--max-tabs <n>

Maximum open tabs per session

20

--no-auto-snapshot

Disable automatic snapshots after actions

false

--snapshot-max-chars <n>

Truncate snapshots above N characters

unlimited

Set LOG_FORMAT=json and LOG_LEVEL=debug|info|warn|error to configure structured logging on stderr.


Example Multi-Browser Agent Workflow

  1. Create two isolated sessions:

    • browser_session_create({ sessionId: "admin", label: "Admin portal", initialUrl: "https://app.example.com/login" })

    • browser_session_create({ sessionId: "buyer", label: "Buyer storefront", initialUrl: "https://app.example.com/shop", setActive: false })

  2. Target each session explicitly without losing state or cookies:

    • browser_type({ sessionId: "admin", ref: "e4", text: "admin@example.com" })

    • browser_click({ sessionId: "buyer", ref: "e12" })

  3. Inspect all open sessions at any time:

    • browser_session_list()

  4. Clean up when finished:

    • browser_session_close({ all: true })


Development & Tests

npm run typecheck
npm run build
npm run test:build

Available Tools

35 tools
browser_auditB

Run a comprehensive page audit (Performance, Accessibility, Best Practices, SEO) on the target session's page or a given URL with mobile/desktop emulation and optional network/CPU throttling.

Inputs: url, mode, device, savePath, +3 more.

browser_clickC

Perform a click on a web page element identified by its snapshot ref.

Inputs: ref (required), button, element, modifiers, +2 more.

browser_closeA

Close the target browser session (alias of browser_session_close for single-session compatibility).

Inputs: sessionId.

browser_console_messagesA

Retrieve captured browser console messages (logs, warnings, errors) for the target session.

Inputs: clear, level, sessionId.

browser_css_stylesA

Inspect computed CSS styles, inline styles, and matched CSS cascade rules for an element ref from browser_snapshot.

Inputs: ref (required), element, maxRules, sessionId, +2 more.

browser_dragB

Perform drag and drop between two elements identified by their snapshot refs.

Inputs: endRef (required), startRef (required), sessionId, endElement, +1 more.

browser_emulateC

Emulate network conditions, CPU throttling, viewport/mobile device metrics, userAgent, geolocation, CSS media features (colorScheme, reducedMotion, forcedColors, contrast), or extra HTTP headers on a session.

Inputs: contrast, viewport, sessionId, userAgent, +7 more.

browser_evaluateC

Evaluate a JavaScript expression or function in the browser page context (or on a specific element ref).

Inputs: function (required), ref, element, sessionId.

browser_file_uploadB

Upload one or more files to a file input or trigger the next file chooser.

Inputs: ref, paths, element, sessionId.

browser_fill_formB

Fill multiple form fields at once using their snapshot refs.

Inputs: fields (required), sessionId.

browser_handle_dialogB

Accept or dismiss a pending browser JavaScript dialog (alert, confirm, prompt).

Inputs: accept (required), sessionId, promptText.

browser_hoverB

Hover the mouse pointer over an element identified by its snapshot ref.

Inputs: ref (required), element, sessionId.

browser_navigateC

Navigate to a URL in the target browser session.

Inputs: url (required), sessionId, waitUntil.

browser_navigate_backB

Go back to the previous page in the browser history.

Inputs: sessionId.

browser_network_detailsA

Inspect full request/response headers, status, timing, and byte sizes for a specific request ID returned by browser_network_requests.

Inputs: requestId (required), sessionId.

browser_network_requestsB

List HTTP network requests observed in the target browser session, with optional resource type and URL substring filters.

Inputs: clear, sessionId, urlContains, includeStatic, +1 more.

browser_performance_metricsA

Capture live Chromium DevTools performance metrics (JS heap usage, DOM nodes, layout/recalc counts, script duration) and current navigation/paint timings without reloading.

Inputs: sessionId.

browser_performance_scoreA

Measure a focused performance score (0-1), Core Web Vitals (FCP, LCP, TBT, CLS, TTFB), and optimization opportunities for the current page or a target URL.

Inputs: url, mode, device, sessionId, +1 more.

browser_press_keyB

Press a keyboard key or key combination (e.g. 'Enter', 'ArrowDown', 'Control+A').

Inputs: key (required), sessionId.

browser_resizeC

Resize the active browser page viewport in the target session.

Inputs: width (required), height (required), sessionId.

browser_run_codeC

Run a custom async Playwright snippet with page, context, and sessionId in scope.

Inputs: code (required), sessionId.

browser_select_optionA

Select one or more options in a dropdown () element.

Inputs: ref (required), values (required), element, sessionId.

browser_session_closeB

Close a specific browser session, the active session, or all open browser sessions.

Inputs: all, sessionId.

browser_session_createA

Launch a new isolated browser session (instance + context). Use this to run multiple independent browsers, accounts, engines, or proxies concurrently.

Inputs: label, proxy, locale, browser, +11 more.

browser_session_listA

List all open browser sessions with their IDs, labels, engines, active status, tab counts, and current URLs.

Inputs: no named parameters.

browser_session_storage_stateA

Export cookies and localStorage from a browser session (optionally saving to a file) so auth state can be inspected or cloned into another session.

Inputs: savePath, sessionId.

browser_session_switchA

Switch the default active browser session used when sessionId is omitted from subsequent tool calls.

Inputs: sessionId (required).

browser_snapshotA

Capture an accessibility tree snapshot of the current page with element refs (e.g. [ref=e5]). Prefer this over screenshots for reasoning and element targeting.

Inputs: filename, sessionId.

browser_tabsB

List, create, close, or select tabs within a browser session.

Inputs: action (required), url, index, sessionId.

browser_take_screenshotC

Take a visual screenshot of the current page or a specific element.

Inputs: ref, type, element, filename, +2 more.

browser_trace_insightB

Inspect detailed metrics for a specific insight category from the most recent recorded trace in the target session.

Inputs: insight (required), sessionId.

browser_trace_startB

Start a Chrome DevTools CDP performance trace on the target session to measure Core Web Vitals, Long Tasks, TBT, and main-thread breakdown.

Inputs: reload, autoStop, filePath, sessionId, +3 more.

browser_trace_stopA

Stop an active performance trace in the target session, optionally save the raw trace file, and return analyzed performance insights.

Inputs: filePath, sessionId.

browser_typeB

Type text into an editable element identified by its snapshot ref.

Inputs: ref (required), text (required), slowly, submit, +2 more.

browser_wait_forB

Wait for text to appear, text to disappear, or a specified number of seconds in the target session.

Inputs: text, time, textGone, sessionId, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 35 tools

    Disambiguation3/5

    Core interaction tools (click, type, hover, drag, select_option) are distinct, but the performance/audit cluster overlaps heavily: browser_audit, browser_performance_score, browser_performance_metrics, browser_trace_start/stop/insight all measure page performance with subtly different scope. browser_close is explicitly an alias of browser_session_close, and browser_evaluate vs browser_run_code have fuzzy boundaries.

    Naming Consistency4/5

    Nearly all tools use a snake_case browser_<verb>_<noun> pattern (browser_session_create, browser_navigate_back, browser_network_details). Minor deviations exist where the pattern collapses to a bare noun or verb (browser_tabs, browser_snapshot, browser_audit), but the prefix convention makes the set readable and predictable.

    Tool Count2/5

    35 tools is heavy for the domain and includes clear redundancy: a legacy alias (browser_close), four performance-measurement tools, and three overlay-style tools that could be consolidated. Splitting session lifecycle, navigation, interaction, inspection, and performance into this many endpoints creates a large surface to triage.

    Completeness4/5

    Coverage is strong for browser automation: session lifecycle, storage state export, navigation, rich element interaction, file upload, dialogs, snapshots, console/network inspection, emulation, and performance tracing are all present. Minor gaps remain around cookie manipulation, request interception/mocking, downloads, and dedicated iframe handling, which could block some workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to control a real Chromium browser through Playwright, allowing them to navigate pages, click elements, fill forms, extract text or HTML, and capture screenshots in a persistent session.
      6
      ISC
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to open pages, click and type across Chromium, Firefox, and WebKit simultaneously, take screenshots, read consoles, and run cross-engine comparisons while the user watches in the window.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI coding agents to control a real Chromium browser through Playwright using accessibility-tree refs, returning snapshots after actions and supporting persistent sessions, screenshots, dialogs, cookies, downloads, and network routes.
      MIT