playwright-mcp-server
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-servertake a screenshot of https://example.com"
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-server
A small, self-contained Playwright helper you can drop into other Node projects.
Use it as:
A class —
PlaywrightSessionManageropens isolated browser sessions, then gives you the real Playwrightpagewhen you need click, fill, screenshot, or anything else.An MCP server — the same manager exposed as tools over stdio, so an agent can drive a browser.
Node 20+ and Chromium (via Playwright) are the only runtime requirements.
Install in another project
From GitHub:
npm install github:james8128/playwright-mcp-server
npx playwright install chromiumFrom a local clone:
npm install ../playwright-mcp-server
npx playwright install chromiumThis package depends on playwright. After install, Chromium still needs a one-time browser download (npx playwright install chromium).
Related MCP server: mcp-browser
30-second library use
import { PlaywrightSessionManager } from "playwright-mcp-server";
const pw = new PlaywrightSessionManager();
const { sessionId, title } = await pw.openPage({
url: "https://example.com",
headless: true,
});
console.log(title);
await pw.use(sessionId, async ({ page }) => {
await page.screenshot({ path: "example.png" });
});
await pw.close(sessionId);use() is the escape hatch. Anything Playwright can do, you can do inside that callback while the session stays locked and alive.
Full method list: docs/api.md.
MCP server
npm start
# same as: node server.jsPoint an MCP client at node /path/to/playwright-mcp-server/server.js.
Tools: openPage, getTitle, waitForElement, listSessions, closeBrowser, closeAll.
Details: docs/mcp.md.
Why this exists
Raw Playwright works, but a long-running helper still has to:
isolate each job in its own browser context
close browsers on failed navigation and on process exit
cap how many sessions can exist
time out idle sessions
reject non-http(s) URLs
serialize work so close cannot race with a click
That is what PlaywrightSessionManager does. Other projects should not have to reimplement it.
Layout
Path | What it is |
| The class other projects import |
| Public library exports |
| MCP adapter ( |
| Stdio MCP process |
| Class API |
| MCP tools and client config |
| Copy-paste starters |
Scripts
npm test # unit + Chromium integration tests
npm start # run the MCP server on stdio
npm run install-browser # download Chromium for PlaywrightDefaults
Setting | Default | Override |
Max sessions | 8 | constructor |
Idle close | 5 minutes | constructor |
Navigation timeout | 60s |
|
Retries | 1 extra attempt |
|
Headless |
|
|
License
ISC. See LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
- TabfleetOAuthcom.tabfleet
Launch, inspect, control, and share isolated cloud browsers for your agents.
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- FlicenseBqualityDmaintenancePlaywright wrapper for MCP that enables LLM-powered clients to control a browser for automation tasks.101-
- FlicenseNot gradedqualityDmaintenanceExposes Playwright browser automation as MCP tools, enabling AI assistants to control a real browser tab-by-tab for form filling, navigation, and more, while preserving the user's active session.-
- AlicenseNot gradedqualityBmaintenanceEnables autonomous web QA by exposing Playwright browser control as MCP tools for navigation, accessibility snapshotting, interaction, and bug detection.2 npmMIT
- AlicenseAqualityBmaintenanceEnables MCP clients to automate a real Chrome browser via Playwright, supporting session sharing and tools for navigation, clicking, typing, and more.112MIT