pw-mcp
Click on "Install 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., "@pw-mcpResume my browser session and open my email."
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.
pw-pool
One browser per agent session for the Playwright MCP.
@playwright/mcp assumes one server and one browser. If you run two agent sessions on one machine and
they either fail on the profile lock or, with a shared browser, work in the same tab space and
navigate each other's pages. pw-pool gives every session its own Chrome and remembers which one
is whose.
Profiles
Chrome keeps everything about a "person" in a profile directory (--user-data-dir): cookies,
local storage, saved passwords, open tabs. That is what keeps you signed in between runs. Only one
Chrome can use a profile at a time. pw-pool creates one profile per session, keeps it between runs,
and can seed a new one from a template — a copy of the login files of a profile you are already
signed in with — so a new session starts signed in without sharing a browser with anyone.
Related MCP server: playwright-mcp-supercharged
Install
Needs Node 22+ and macOS or Linux.
git clone https://github.com/ckarnell/pw-pool && cd pw-pool
npm install # pins @playwright/mcp and patches it
node bin/pw-pool.js install # checks the setup; offers to download Chrome for Testing if missingOr globally, which puts pw-mcp and pw-pool on your PATH: npm install -g github:ckarnell/pw-pool.
Then use pw-mcp as the Playwright MCP command. Claude Code (~/.claude.json or a project
.mcp.json):
"playwright": { "type": "stdio", "command": "pw-mcp" }(or "command": "node", "args": ["/path/to/pw-pool/bin/pw-mcp.js"] for a clone that is not on PATH).
Other MCP flags (--caps, --output-dir, …) can be added to args; they pass through.
--headless is applied to the pool's launch. --cdp-endpoint, --user-data-dir, --isolated and
--browser are dropped with a warning, because the pool chooses the browser.
By default browsers are Playwright's Chrome for Testing. To use the Chrome already installed on the
machine: pw-pool config set channel '"chrome"' (also chrome-beta, chrome-canary, msedge), or
config.chrome for an explicit path.
Optional, to start every session signed in:
pw-pool template save main --from ~/path/to/a/signed-in/user-data-dir
pw-pool config set defaultTemplate '"main"'Switching while sessions are open
You can change the MCP config at any time; nothing running is affected. An MCP server is started
once per session, so sessions that are already open keep their old server and browser until they
restart. Sessions that start (or restart, for example claude --resume) after the change use
pw-pool. Order that works:
Save a template from the browser you use today and set it as the default (above), so the new browsers are signed in.
Change the MCP entry to
pw-mcp.Nothing else. Old sessions continue; new ones get their own browser.
To go back, restore the old MCP entry. Browsers that pw-pool started are reaped after the idle TTL,
or at once with pw-pool stop all. A browser you ran before (for example a shared one on a fixed
CDP port) is not touched by pw-pool and can keep running beside it.
How it works
session A ─▶ pw-mcp ─▶ registry ─▶ Chrome :9300, profiles/A/ ◀─ @playwright/mcp --cdp-endpoint
session B ─▶ pw-mcp ─▶ registry ─▶ Chrome :9301, profiles/B/ ◀─ @playwright/mcp --cdp-endpointpw-mcpreplacesnpx @playwright/mcpas the MCP server command. It finds out which session is calling, takes that session's browser from the pool (launching one if needed), and runs the bundled@playwright/mcpagainst it over CDP. Stdio passes straight through.When the MCP exits, the browser stays up. A resumed session gets the same browser, tabs and all.
A browser with no open tabs and no active session is stopped at once; one that still has tabs is stopped 1 hour after its session ends (tabs saved). A later start relaunches it on the same profile and reopens the tabs. Unused profiles are deleted after 30 days. An active session holds a lease and is never reaped.
Nothing raises a window: browsers start with no window, and tabs are opened in the background. The bundled MCP carries a two-line patch for the same reason (see Focus).
No daemon. State is a JSON registry under ~/.pw-pool/, guarded by a lock.
Which session is which
pw-mcp needs a stable key per session. In order:
--key/PW_POOL_KEY— explicit. Any harness can set this.PW_POOL_NAMElabels the window.CLAUDE_CODE_SESSION_ID— Claude Code (2.1.239+) sets it in the MCP server's environment.~/.claude/sessions/<parent pid>.json— Claude Code writes its session id, name and cwd there.The parent pid — fallback; the browser is deleted when the lease ends.
Same key, same browser. claude --resume keeps the session id, so it gets its browser back.
Templates
pw-pool template save <name> --from <dir> copies the login files of a profile (cookies, local
storage, IndexedDB, saved passwords, preferences — a few MB; no caches). A new session's profile is
seeded from --template <name>, PW_POOL_TEMPLATE, or config.defaultTemplate, once, when it is
created. After that each profile evolves on its own. --fresh forces an empty profile.
Templates and profiles contain live credentials. Keep ~/.pw-pool/ out of repositories. A template is
a point-in-time copy: save it again after signing in to something new.
CLI
pw-pool install [--yes] first-time setup; asks before downloading Chrome
pw-pool ls registered browsers: key, name, port, pid, status, tabs, leases
pw-pool cdp [key] [--ensure] CDP endpoint of a session's browser (default: the calling session)
pw-pool tabs [key]
pw-pool gc [--force] [--dry-run] reap stale leases, idle browsers, old profiles
pw-pool stop <key|all> [--rm] stop a browser (tabs saved); --rm also deletes its profile
pw-pool template save <name> [--from <dir>] | ls | rm <name>
pw-pool config [get <key> | set <key> <json>]
pw-pool doctor<key> is a full key, a unique prefix, or a session name. pw-pool cdp --ensure lets scripts drive
the same browser as their session's MCP. Every pw-mcp start runs gc; for machines where sessions
are rare, run pw-pool gc from cron or launchd.
Config lives in ~/.pw-pool/config.json (pw-pool config): portRange [9300, 9399],
idleTtlHours 1, profileTtlDays 30, defaultTemplate, sourceProfile, chrome, channel, headless,
sandbox (off, like Playwright's chromiumSandbox), profileTheme, windowCascade, windowSize,
extraChromeArgs, launchTimeoutMs. PW_POOL_HOME moves the whole
state directory; PW_POOL_HEADLESS=1 runs browsers headless (servers, containers).
profileTheme: true tints each browser's toolbar a stable color derived from its key, so several
pool windows are easy to tell apart on screen (macOS Cmd-Tab still shows one icon per instance; this
colors the window itself). A fixed "R,G,B" themes every pool browser the same.
Focus
On macOS, two things activate a Chrome app and take focus from the person using the machine: a
window created at startup, and a tab created in the foreground. pw-pool launches Chrome with
--no-startup-window and opens tabs with CDP's background: true. @playwright/mcp has no option
for this, so scripts/patch-focus.js changes two lines in the bundled copy (browser_tabs new →
background tab, browser_tabs select → no bringToFront). The patch is applied on npm install;
pw-pool doctor verifies it; PW_MCP_FOREGROUND_TABS=1 restores the original behaviour.
One case is outside the patch's reach: when a page itself opens a popup (window.open or a
target="_blank" link on a click), macOS activates the browser to show it, the same as any Chrome.
Browsers are headed by default, matching @playwright/mcp. If that focus-stealing matters on a
shared machine, run headless: pw-pool config set headless true, PW_POOL_HEADLESS=1, or per session
pw-mcp --headless (and --headed to force headed when the default is headless). Headless renders
identically for snapshots and screenshots.
Troubleshooting
The MCP disconnects ("Connection closed") right after a
browser_evaluate. The result was larger than the client's per-message limit (16 MB in Claude Code), so the client closed the connection. This is not specific to pw-pool. The client restarts the server within seconds andpw-mcpreattaches to the same browser, tabs included; call the tool again and return smaller values. Claude Code keeps the server's log under~/Library/Caches/claude-cli-nodejs/<project>/mcp-logs-playwright/."Chrome exited during startup" or "did not answer": the error quotes the end of
~/.pw-pool/logs/<key>.chrome.log. Common causes: no display on Linux (useheadlessor Xvfb), a binary that cannot run (pw-pool doctor).A browser seems to belong to nobody:
pw-pool lsshows leases;!marks a holder that has exited.pw-pool gcclears those;pw-pool stop <key>stops a browser you are sure about.
Development
npm test # unit tests (no browser needed)
npm run test:e2e # real browsers, throwaway pool home: isolation, reattach, concurrency, recovery, templates
npm run test:docker # the same on Linux in a containerThe @playwright/mcp version is pinned. To bump it, change the version, run npm install, and fix
scripts/patch-focus.js if the install fails (the bundle changed shape).
Releasing
Publishing uses npm trusted publishing (OIDC from GitHub Actions) — no tokens. One-time setup on
npmjs.com: the package's Settings → Trusted Publisher → this repo's publish.yml workflow. After that,
release by tagging: npm version patch && git push --follow-tags. The workflow runs the tests and
npm publish --provenance. (The first ever publish, before the package exists, is done once locally
with npm publish --access public --auth-type=web.)
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to authenticate with websites using a real Chromium browser with anti-detection measures and human-in-the-loop support for captchas and 2FA. Features stealth browsing, human-like interactions, and persistent session storage to automate and resume login workflows.
- AlicenseNot gradedqualityDmaintenanceEnables running multiple isolated browser sessions simultaneously and importing cookies from Chrome to authenticate on any site without passwords.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables background control of real Chrome browser sessions with persistent session binding and colored tab groups, allowing automation without interfering with user interaction.MIT
- AlicenseNot gradedqualityBmaintenanceProvides a persistent browser profile for AI agents, enabling them to log in once and maintain sessions across restarts. Supports 20 tools for browsing, navigation, text extraction, and screenshot.1MIT
Related MCP Connectors
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
A paid remote MCP for AI agent browser MCP session, built to return verdicts, receipts, usage logs,
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ckarnell/pw-pool'
If you have feedback or need assistance with the MCP directory API, please join our Discord server