The official Playwright MCP server lets an MCP-compatible AI client control a browser using Playwright. To get started, install Node.js 20 or newer, add the server configuration where your MCP client expects server definitions, and connect the client. The server uses structured accessibility snapshots to represent pages and their interactive elements. Its JavaScript execution capability has an important security warning: Microsoft Playwright says it is equivalent to remote code execution, so enable it only for trusted MCP clients.
What the Playwright MCP server does
Playwright MCP connects browser automation to an MCP client. After connecting, the client can ask the server to navigate to a page and interact with it through browser tools. Instead of making screenshots the primary representation for each interaction, the server provides structured accessibility snapshots. These describe page content and controls in a form the client can use to identify and act on elements.
The server is the Microsoft Playwright project, not a browser or a standalone AI assistant. You need an MCP client to use it. The exact place to configure the server varies by client; the official getting-started guide directs users to their client’s documentation for that location.
Prerequisites and installation
What you need
- Node.js 20 or newer. This is the minimum version listed in the official getting-started guide.
- An MCP client that can start or connect to MCP servers.
- Network access for setup. The general example uses
npxto run the package, and the browser downloads automatically on first use.
Add the general server configuration
Put this JSON in the MCP server configuration file or settings area used by your client:
Recommended Free Tools
#1 Best Overall
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
The server name, playwright, is a label the client uses for this connection. The command runs the package through npx; @latest means this configuration follows the package’s latest published tag rather than pinning a specific release. The current package version is not specified here, so do not treat this as a version pin. If you need repeatable builds, check the official package information and your client’s configuration guidance before choosing a versioning approach.
Save the configuration and use your client’s documented way to start or reconnect MCP servers. The precise menu, file path, and restart behavior are client-specific; do not assume that a configuration location used by one client also applies to another.
Connect it to an MCP client, including Codex
For most clients, the steps are the same in principle: locate the MCP server settings, add the server definition, then restart or reconnect so the client loads it. Follow the client’s own documentation for the exact configuration location and syntax. The JSON example above is the general form documented for clients that use an mcpServers object.
The Microsoft-maintained Playwright MCP repository also provides client-specific routes, including a Codex CLI command and a ~/.codex/config.toml example. Use the current repository instructions for those Codex-specific steps rather than pasting the general JSON into a TOML file: JSON and TOML are different formats, and configuration placement is client-specific.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #2
Make a first browser interaction
- Confirm your MCP client reports the Playwright server as connected.
- Ask the assistant to open the Playwright TodoMVC demo.
- Ask it to add a few todo items, for example “Buy milk” and “Send the report.”
- Review the interaction and the returned page state. The documented model uses browser tools and structured accessibility snapshots as the assistant proceeds.
This small task checks more than whether the server starts: the client must also be able to invoke browser tools, navigate to a page, identify controls, and submit input. For a production workflow, try a page and action that match the kind of sites and interactions you intend to automate.
Choose how the browser runs
Headed or headless
The official guide’s default is headed mode, which opens a visible browser window. Add --headless to the server arguments when you do not want a visible window. For example:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless"]
}
}
}
Headed mode is useful when you need to see what the browser is doing; headless mode avoids displaying a window. This choice changes how the browser is presented, not the need for an MCP client or a working server connection.
Select a browser engine
The guide lists these browser choices: chrome, firefox, webkit, and msedge. Pass the engine with --browser=.... For example, to request Firefox in headless mode:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #3
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--browser=firefox", "--headless"]
}
}
}
Replace firefox with one of the other documented names when you need a different engine. Pick the browser that matches the behavior you want to inspect; support and availability can depend on the current server and browser installation, so consult the official instructions if a selected engine does not start.
Persistent or isolated profile state
Profile mode determines whether browser state carries across use. A persistent profile preserves session information such as cookies and login state, which can be useful for work that must continue in an authenticated session. An isolated profile starts fresh; in-memory state can be discarded when the browser closes.
Choose deliberately. Preserving login state is convenient, but it also means the browser may retain access to accounts and sites. An isolated session is a better fit when you want a clean start or do not want a task to inherit an earlier session. The exact option syntax and storage behavior should be checked in the current official server documentation before you configure a profile.
Run a standalone HTTP server
The official guide documents HTTP transport as an option when a headed browser is needed on a machine without a display or when the server runs from an IDE worker process. Its example starts the server on port 8931 and has the client connect to http://localhost:8931/mcp.
Rank #4
npx @playwright/mcp@latest --port 8931
Configure the MCP client to connect to http://localhost:8931/mcp using the client’s supported HTTP transport settings. This differs from having the client launch the server locally with a command such as npx: in the HTTP arrangement, the server runs separately and the client connects to its endpoint. Keep the endpoint local unless you have a deliberate, secure deployment design; the server can control a browser and should not be exposed casually.
Security: treat JavaScript execution as high risk
Microsoft Playwright’s official documentation warns that the JavaScript execution tool runs arbitrary JavaScript in the Playwright server process and is equivalent to remote code execution. Its instruction is: “only enable it for trusted MCP clients.”
This is not a cosmetic setting. An MCP client that can invoke arbitrary code in the server process has capabilities beyond ordinary page navigation and clicking. Connect only clients you trust, understand which tools they can call, and avoid granting this access to an untrusted client or an agent whose behavior you cannot control. If your workflow does not need JavaScript execution, do not enable it merely because it is available.
Troubleshooting common setup problems
The client does not show Playwright as connected
- Check that the server definition is in the configuration location your client actually reads.
- Verify the structure and quoting: the general example is JSON, while client-specific formats such as Codex configuration may use another syntax.
- Use the client’s documented restart or reconnect action after saving changes.
- Confirm Node.js 20 or newer is installed and available to the process that launches
npx. An IDE or worker may have a different environment from your interactive terminal.
The server starts but the browser does not
- Allow the first-use browser download to complete; the official installation guide says the browser downloads automatically on first use.
- If you selected an engine, check that the name matches one of the documented values:
chrome,firefox,webkit, ormsedge. - If you selected headed mode on a machine without a display, use the documented headless option or the standalone HTTP arrangement appropriate to your environment.
- Check the client or server startup output for the specific failure. The available documentation does not establish one universal fix for every operating system or runtime environment.
The assistant connects but cannot complete the task
- Check whether the page loaded and whether the assistant received a current accessibility snapshot.
- Try a simple public page and a basic action first, such as adding items in the TodoMVC example. This helps distinguish a server connection problem from a site-specific behavior.
- For authenticated pages, decide whether the selected profile should preserve login state or start isolated. Do not assume an isolated session carries cookies from a prior run.
HTTP client connection fails
- Confirm the standalone server is running on the port you configured; the official example uses
8931. - Check that the client URL includes the MCP path,
/mcp, as inhttp://localhost:8931/mcp. - Make sure the client is configured for the matching HTTP transport rather than trying to launch a separate local command.
Or skip the browser setup
If your goal is a screenshot or PDF rather than interactive browser automation, ScreenshotNeo is a website screenshot API and MCP server. A single request can return an image or PDF. Its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses report the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Free tools Windows power users keep installed
One-click scans. No signup required.
For example, this cURL request saves a WebP screenshot of Stripe:
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for the API and its 63 capture options, including full-page and element captures, device and viewport settings, PDF controls, custom CSS and JavaScript, waiting conditions, request blocking, caching, signed links, asynchronous jobs, bulk capture, and usage reporting.
The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan. Sign up for free: get 1,000 screenshots a month with no card.
Performance, reliability, and cost considerations
The Playwright MCP setup described here runs a browser through an MCP server; it is intended for interactive automation, not simply returning a screenshot file from one URL. Browser startup and first-use downloads add setup work, while a persistent profile can avoid repeatedly establishing session state. Headless mode avoids a visible window, but does not remove the need for the browser or a reachable page.
The official material covered here does not provide measured startup times, concurrency limits, uptime guarantees, or a per-use price for the Playwright MCP server. Those should not be assumed. Costs depend on the environment in which you run Node.js and the browser, and any hosting or infrastructure you choose; check the relevant provider terms for your deployment.
Frequently asked questions
Does Playwright MCP use screenshots to understand every page?
No. Its documented interaction representation is structured accessibility snapshots, rather than relying on vision models or screenshot interpretation.
Can I pin a specific Playwright MCP package version?
The general setup shown here uses the moving @latest tag, not a pinned release. Check current package metadata and official installation instructions before selecting a specific version.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

