What is Playwright MCP?
Playwright MCP is a server that makes browser operations available to an MCP client. Your agent calls tools on the server; the server uses the browser connection. Remote Browser supplies a separate Chromium runtime for those operations.
The Microsoft repository documents CDP attachment through the PLAYWRIGHT_MCP_CDP_ENDPOINT environment variable or the corresponding command-line option. This collection focuses on an existing remote allocation rather than launching a browser on the agent's worker.
Why attach to a remote browser?
The split is useful when a coding agent should inspect a UI without owning a local Chrome process. It also creates an explicit place to manage account profiles, viewer access, and browser lifecycle independently from the MCP client.
Plan the first task around a verifiable result: load a known page, identify its title, and confirm which account and browser allocation were used. Only add longer authenticated workflows after that small test is reliable.
Quick start
Create a dedicated Remote Browser session and provide its endpoint securely to the server environment. In a project with a pinned Playwright MCP dependency, the shell-level configuration is:
export PLAYWRIGHT_MCP_CDP_ENDPOINT="$REMOTE_BROWSER_CDP_URL"
npx @playwright/mcpRegister that process in your MCP client's supported server configuration. The environment must be available to the launched server, not only to an unrelated terminal. The detailed remote MCP guide expands the setup and verification procedure.
Connection methods and browser ownership
MCP is the agent-to-tool interface. CDP is the server-to-browser connection. A saved profile is a runtime state choice. Keep those three configuration decisions separate when diagnosing an unexpected login page or missing browser tab.
Define which component allocates and releases the hosted browser. Test cancellation, server restart, and endpoint expiry. Closing an MCP client should not be your only cleanup mechanism for an externally allocated browser.
Use cases
- A coding agent verifying a deployed application after a code change.
- Authenticated read-only checks using a deliberately selected profile.
- UI troubleshooting with a human observing the same browser.
- Repeated smoke checks whose browser environment is independent of the worker.
Uploads, downloads, screenshots, and traces need an explicit storage path. The MCP server's filesystem and the browser's filesystem may be on different machines. Verify that the final artifact can be retrieved by the person or process that needs it.
FAQ
Can I use the server without changing my agent framework?
An MCP-capable client can configure the server as a tool source. Check that client's process launch, environment, and tool permission settings.
Does creating a new context preserve an existing login?
Do not assume it does. Inspect the contexts and profile behavior of the runtime and use the supported authenticated-session path.
Are the benchmark links MCP performance results?
They describe methodology and a CDP baseline. A full MCP workflow includes client calls, tool execution, navigation, observations, and task verification, which need their own measurements.