playwright-mcp-router
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@playwright-mcp-router in session checkout-css, open the staging checkout page and screenshot it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
playwright-mcp-router
Session-isolated, multi-account MCP router for
@playwright/mcp— let multiple AI agents share your logged-in Chrome profiles concurrently without hijacking each other's active tab, with meaningful per-task Chrome tab group names.
Why This Exists
When using @playwright/mcp --extension in multi-session AI IDEs / coding agents (Antigravity, Claude Code, Cursor, Codex, etc.):
Most MCP hosts spawn one shared singleton MCP server process across all concurrent conversations.
@playwright/mcptools (browser_navigate,browser_click,browser_snapshot,browser_network_requests, ...) operate on a singlecurrentactive tab pointer — so two concurrent agents inevitably hijack each other's active tab.--session-name(the Chrome tab group label) is fixed at server startup, so you cannot dynamically name tab groups per task.Switching across multiple Chrome accounts/profiles requires duplicating MCP servers (
playwright-1a,playwright-1b,playwright-2, ...).
playwright-mcp-router solves all four problems with a zero-dependency Node.js proxy:
flowchart LR
A1["Agent 1 (session: T1867-api)"] --> R["playwright-mcp-router (Single MCP)"]
A2["Agent 2 (session: home-css)"] --> R
A3["Agent 3 (account: 2, session: rbac)"] --> R
R -->|"account=1 / T1867-api"| W1["@playwright/mcp worker #1"]
R -->|"account=1 / home-css"| W2["@playwright/mcp worker #2"]
R -->|"account=2 / rbac"| W3["@playwright/mcp worker #3"]
W1 -->|"Chrome Default (Tab Group: T1867-api)"| C1["Chrome Profile: Default"]
W2 -->|"Chrome Default (Tab Group: home-css)"| C1
W3 -->|"Chrome Profile 1 (Tab Group: rbac)"| C2["Chrome Profile: Profile 1"]Related MCP server: agent-tab-bridge
Features
Zero Runtime Dependencies: Pure Node.js (
>= 20) ESM, instant startup.True Process-Level Session Isolation: Every
(account, session)pair gets its own@playwright/mcpworker process and Chrome tab group — concurrent agents never steal focus or overwrite each other's active tab.Dynamic Meaningful Tab Group Names: Injects a required
sessionparameter into all proxied Playwright tools so every agent creates a clearly labeled, color-coded Chrome tab group (e.g.T1867-api-debug,checkout-css).Multi-Account Chrome Profile Routing: Configure multiple Chrome profiles (
Default,Profile 1, ...) and Playwright MCP Bridge tokens in one place, with a default primary account and on-demand switching viaaccount.Automatic Lifecycle & Cleanup:
Coalesces concurrent in-flight startup calls for the same session.
Auto-evicts idle sessions after
idleTimeoutMs(default 15 minutes), cleanly closing their Chrome tab groups.Evicts the worker immediately when
browser_closeorrouter_close_sessionis called.Enforces
maxSessionscap and auto-recovers if a worker crashes.
Always Up-to-Date with Official
@playwright/mcp: Dynamically discovers and forwards the exact tool catalog from your installed@playwright/mcpbinary (includingbrowser_network_requests,browser_network_request,browser_evaluate,browser_take_screenshot, etc.).Secret Safe: Never exposes tokens in
router_list_sessionsor redacts accidental leaks from upstream error messages.
Prerequisites
Node.js
>= 20Official
@playwright/mcpinstalled globally (recommended for fast startup):npm install -g @playwright/mcp@latest(For reusing logged-in Chrome sessions) Install the Playwright MCP Bridge Chrome extension in each Chrome profile you want to automate, and copy each profile's
PLAYWRIGHT_MCP_EXTENSION_TOKEN.
Setup
1. Clone the repository
git clone https://github.com/huangzt/playwright-mcp-router.git2. Create your private accounts.json
Store it outside the repository (default path ~/.config/playwright-mcp-router/accounts.json, chmod 600):
mkdir -p ~/.config/playwright-mcp-router
cp accounts.example.json ~/.config/playwright-mcp-router/accounts.json
chmod 600 ~/.config/playwright-mcp-router/accounts.jsonExample ~/.config/playwright-mcp-router/accounts.json:
{
"defaultAccount": "1",
"idleTimeoutMs": 900000,
"maxSessions": 12,
"playwrightArgs": [
"--extension",
"--background",
"--caps=devtools"
],
"accounts": {
"1": {
"label": "Work Account (Chrome Default)",
"profileDirName": "Default",
"token": "YOUR_ACCOUNT_1_EXTENSION_TOKEN",
"colors": ["blue", "cyan", "purple"]
},
"2": {
"label": "Secondary Account (Chrome Profile 1)",
"profileDirName": "Profile 1",
"token": "YOUR_ACCOUNT_2_EXTENSION_TOKEN",
"colors": ["green", "orange", "yellow"]
}
}
}Tip:
tokenalso supports${ENV_VAR}interpolation if you prefer keeping tokens in environment variables. To find your exact ChromeprofileDirName(Default,Profile 1, etc.), inspect~/Library/Application Support/Google/Chrome/Local State(macOS) or Chrome'schrome://version("Profile Path").
3. Register in your MCP client (mcp_config.json)
{
"mcpServers": {
"playwright": {
"command": "/path/to/node",
"args": [
"/path/to/playwright-mcp-router/bin/playwright-mcp-router.js",
"--config",
"/Users/<you>/.config/playwright-mcp-router/accounts.json",
"--playwright-bin",
"/path/to/node_modules/@playwright/mcp/cli.js"
]
}
}
}Router Tools & Parameters
Every official @playwright/mcp tool is automatically augmented with:
Parameter | Required | Description |
| Yes | Unique, descriptive task name (also shown as the Chrome tab group title, e.g. |
| No | Account key from |
| No | Optional Chrome tab group color override ( |
Additional management tools provided by the router:
router_list_sessions— List active isolated sessions (account, session name, color, PID, idle time) and configured accounts (without tokens).router_close_session— Gracefully close a specific(account, session)and remove its Chrome tab group.router_close_all_sessions— Gracefully close all active sessions.
Testing
Run unit & mock concurrency tests (no browser required):
npm testRun live concurrency test against your real Chrome profiles:
npm run test:liveLicense
Available Tools
41 toolsbrowser_annotateARead-only
Open the Playwright Dashboard in annotation mode for the current page and wait for the user to draw annotations. Returns the annotated screenshot, ARIA snapshot, and the list of annotations.
Inputs: session (required), color, account.
browser_clickCDestructive
Perform click on a web page
Inputs: target (required), session (required), color, button, +4 more.
browser_closeBDestructive
Close the browser and all open tabs.
Inputs: session (required), color, account.
browser_console_messagesCRead-only
Returns all console messages
Inputs: level (required), session (required), all, color, +2 more.
browser_dragCDestructive
Perform drag and drop between two elements
Inputs: session (required), endTarget (required), startTarget (required), color, +3 more.
browser_dropADestructive
Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
Inputs: target (required), session (required), data, color, +3 more.
browser_emulate_mediaADestructive
Emulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged; null clears an override.
Inputs: session (required), color, media, account, +4 more.
browser_evaluateCDestructive
Evaluate JavaScript expression on page or element
Inputs: session (required), function (required), color, target, +3 more.
browser_file_uploadCDestructive
Upload one or multiple files
Inputs: session (required), color, paths, account.
browser_fill_formCDestructive
Fill multiple form fields
Inputs: fields (required), session (required), color, account.
browser_findARead-only
Search the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.
Inputs: session (required), text, color, regex, +3 more.
browser_handle_dialogDDestructive
Handle a dialog
Inputs: accept (required), session (required), color, account, +1 more.
browser_hide_highlightARead-only
Remove a highlight overlay previously added for the element.
Inputs: session (required), color, target, account, +1 more.
browser_highlightBRead-only
Show a persistent highlight overlay around the element on the page.
Inputs: target (required), session (required), color, style, +2 more.
browser_hoverCDestructive
Hover over element on page
Inputs: target (required), session (required), color, account, +1 more.
browser_network_requestARead-only
Returns full details (headers and body) of a single network request, or a single part if part is set. Use the number from browser_network_requests.
Inputs: index (required), session (required), part, color, +2 more.
browser_network_requestsARead-only
Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
Inputs: static (required), session (required), all, color, +3 more.
browser_press_keyCDestructive
Press a key on the keyboard
Inputs: key (required), session (required), color, account.
browser_resizeCDestructive
Resize the browser window
Inputs: width (required), height (required), session (required), color, +1 more.
browser_resumeBDestructive
Resume script execution after it was paused. When called with step set to true, execution will pause again before the next action.
Inputs: session (required), step, color, account, +1 more.
browser_run_code_unsafeBDestructive
Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
Inputs: session (required), code, color, account, +1 more.
browser_select_optionCDestructive
Select an option in a dropdown
Inputs: target (required), values (required), session (required), color, +2 more.
browser_snapshotBRead-only
Capture accessibility snapshot of the current page, this is better than screenshot
Inputs: session (required), boxes, color, depth, +3 more.
browser_start_recordingARead-only
Start recording actions that the user performs in the browser as Playwright code. Use it when the user wants to demonstrate a flow manually. Call browser_stop_recording when the user says they are done to retrieve the recorded actions.
Inputs: session (required), color, account.
browser_start_tracingCRead-only
Start trace recording
Inputs: session (required), color, account.
browser_start_videoCRead-only
Start video recording
Inputs: session (required), fps, size, color, +3 more.
browser_stop_recordingARead-only
Stop the recording started with browser_start_recording and return the recorded actions as Playwright code.
Inputs: session (required), color, account.
browser_stop_tracingCRead-only
Stop trace recording
Inputs: session (required), color, account.
browser_stop_videoCRead-only
Stop video recording
Inputs: session (required), color, account.
browser_tabsCDestructive
List, create, close, or select a browser tab.
Inputs: action (required), session (required), url, color, +3 more.
browser_take_screenshotARead-only
Take a screenshot of the current page. Use browser_snapshot for actions by default. With the vision capability enabled, use screenshot coordinates with the coordinate-based mouse tools for elements not exposed in the accessibility snapshot.
Inputs: scale (required), session (required), type, color, +5 more.
browser_typeCDestructive
Type text into editable element
Inputs: text (required), target (required), session (required), color, +4 more.
browser_video_chapterBRead-only
Add a chapter marker to the video recording. Shows a full-screen chapter card with blurred backdrop.
Inputs: title (required), session (required), color, account, +2 more.
browser_video_hide_actionsBRead-only
Stop annotating actions performed on the page.
Inputs: session (required), color, account.
browser_video_show_actionsARead-only
Annotate subsequent actions performed on the page with a callout that names the action and, when styled, marks the action point and highlights the target element. Useful while video recording or screencasting.
Inputs: session (required), color, style, cursor, +3 more.
browser_wait_forBRead-only
Wait for text to appear or disappear or a specified time to pass. When both text and textGone are provided, waits for the first one to happen
Inputs: session (required), text, time, color, +2 more.
router_close_all_sessionsB
Gracefully close all active browser sessions managed by playwright-mcp-router.
Inputs: no named parameters.
router_close_sessionA
Gracefully close a specific isolated browser session (closes its Chrome tab group and terminates its worker process). Always close your session when finished.
Inputs: session (required), account.
router_list_sessionsB
List all active isolated browser sessions managed by playwright-mcp-router, along with configured Chrome accounts (without exposing secrets).
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 41 tools
Core interaction tools (click, type, hover, drag, select_option, press_key) are clearly distinct, but several clusters overlap: browser_network_request vs browser_network_requests differ only by plurality, browser_start_recording / browser_start_tracing / browser_start_video are three near-identical 'start recording' verbs, and router_close_session / router_close_all_sessions / browser_close have unclear boundaries about what gets terminated. browser_evaluate vs browser_run_code_unsafe and browser_highlight vs browser_video_show_actions also require reading the full description to separate.
A predictable prefix scheme (browser_* for page actions, router_* for session management) is applied uniformly across all 41 tools. Within that scheme the ordering drifts between verb-first (browser_take_screenshot) and noun-first (browser_console_messages, browser_snapshot, browser_tabs), and the singular/plural pair browser_network_request(s) is easy to misread, but nothing is chaotic.
41 tools is heavy even for full browser automation, and a meaningful slice of the surface is niche instrumentation rather than core capability (video_chapter, video_show_actions/hide_actions, start/stop_tracing, start/stop_recording, annotate, highlight/hide_highlight, emulate_media). Each earns some place, but the count trends toward over-specialization rather than a tight, well-scoped set.
Coverage of the browser-automation lifecycle is strong: navigation and history, full input/gesture set, snapshots and search, console/network inspection, dialogs, tabs, uploads, tracing, video, and explicit session routing. Remaining gaps are moderate rather than blocking — no cookie/storage-state management, no request interception or network mocking, and no download handling.
Maintenance
Related MCP Connectors
Isolated, fingerprint-protected browser profiles for AI agents: one per task, with its own proxy
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Let AI agents use any website you're logged in to. Sessions stay encrypted on your machine.
Cloud browsers for AI agents: saved logins, residential IPs, live human takeover, 57 browser tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA multi-agent orchestrator that enables multiple AI agents to share a single Chrome browser instance with tab isolation and shared state. It preserves local browser data like cookies and logins while allowing concurrent agent sessions through the official Playwright MCP.10MIT
- FlicenseNot gradedqualityDmaintenanceEnables local AI agents to control Chrome in parallel with isolated tab groups, supporting operations like navigation, clicks, and form filling without interference.-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to securely control a user's existing signed-in Chrome browser through isolated tab groups, with strict per-session ownership and no cookie or token exposure.-
- AlicenseNot gradedqualityBmaintenanceEnables multiple agents to share a single Chrome browser with isolated tabs and shared sessions, allowing coordinated browsing and automation.20 npmMIT