Blog /
Playwright MCP Cursor Setup: Config, Options and Fixes
Playwright MCP Cursor setup guide: add the server with npx @playwright/mcp@latest, pick options like --headless and --isolated, and fix common errors.

To add Playwright MCP to Cursor, open Cursor Settings → MCP → Add new MCP Server, give it a name such as playwright, choose the command type and enter npx @playwright/mcp@latest, as the Playwright docs for Cursor list it. The same entry can live in a file: .cursor/mcp.json in a project for that project only, or ~/.cursor/mcp.json in your home directory for every project, per Cursor's MCP docs. Restart Cursor after changing it.
A connected playwright entry means Cursor's agent can call browser tools inside the current chat. It does not tell you whether the deployed app still works, and the tools go away when the session ends. Keeping that boundary in mind is what makes this setup useful rather than a false sense of coverage.
How to Add Playwright MCP to Cursor
Playwright MCP runs as a local command server: Cursor starts it as a process on your machine, there is no hosted endpoint. The Playwright client page for Cursor and the Playwright MCP README give the same manual steps (both also offer a one-click "Install in Cursor" button):
Open the MCP panel. Cursor Settings → MCP.
Add a server. Choose Add new MCP Server.
Name it. The README says "name to your liking";
playwrightkeeps it obvious in the list and in config files.Set the type.
command.Enter the command.
npx @playwright/mcp@latest.Check or extend it. "You can also verify the config or add arguments by clicking Edit", as the Playwright page puts it. That is where browser flags go later.
Then confirm the playwright entry shows as connected and start a new chat.
Where the config lives
Cursor's MCP docs name two files: "Create .cursor/mcp.json in your project for project-specific tools" and "Create ~/.cursor/mcp.json in your home directory for tools in every project you open in the editor or CLI." Knowing which one holds the entry explains why a teammate's Cursor behaves differently from yours.
The standard Playwright entry, from the Playwright MCP getting-started page, looks like this:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Commit the project file if the whole team should run the same server definition, and keep personal experiments in the home-directory file. For custom servers, Cursor's FAQ says to "update your local files and restart Cursor."

Because the server runs locally through npx, there is no account to create and no token to rotate. If you are weighing it against other servers, this Scrappey roundup of MCP servers marks which ones are hosted and which run locally.
What the agent gains is a set of browser tools: open a page, click, type, read the page structure through its accessibility snapshot, take a screenshot. Before you trust it with anything that writes data, ask it to open a known URL and describe the page.
Options That Change How the Browser Runs
Four options cover most needs. They go in the args array after the package name. Descriptions are quoted from the Playwright MCP README.
| Option | README description | Use it when |
|---|---|---|
--browser <name> | "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge" | You want a specific engine or a second one |
--headless | "run browser in headless mode, headed by default" | The machine has no display, or you don't want a window |
--isolated | "keep the browser profile in memory, do not save it to disk" | Each run must start signed out |
--config <path> | "path to the configuration file" | One set of options should apply to every session in the project |
- Option
--browser <name>- README description
- "browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge"
- Use it when
- You want a specific engine or a second one
- Option
--headless- README description
- "run browser in headless mode, headed by default"
- Use it when
- The machine has no display, or you don't want a window
- Option
--isolated- README description
- "keep the browser profile in memory, do not save it to disk"
- Use it when
- Each run must start signed out
- Option
--config <path>- README description
- "path to the configuration file"
- Use it when
- One set of options should apply to every session in the project
Examples: "args": ["@playwright/mcp@latest", "--headless"] runs the same server without a window, and "args": ["@playwright/mcp@latest", "--browser", "firefox"] switches the engine.
Each option also has an environment variable in the README, for example PLAYWRIGHT_MCP_CONFIG for the config file and PLAYWRIGHT_MCP_HEADLESS for headless mode. The Playwright MCP introduction and the README hold the current option list; read them rather than copying a flag from an older tutorial. For how this server compares with Chrome DevTools MCP, see our side-by-side of the two.
Default rule: leave the flags off for local debugging, add
--headlesswhere there is no display, and add--isolatedfor any run that must sign in fresh.
Keeping Test Accounts and Sessions Safe
The browser session carries the same access as the account it signs in with. If the agent signs in as an administrator, it can do what an administrator can do.
The README is explicit: "Playwright MCP is not a security boundary." Its secrets option replaces matching text in tool responses, and the README calls it "a convenience and not a security feature." So the protections belong to things you own: the account, the profile and the network.
Use a dedicated test account with only the permissions the journey needs. Never an admin account, never a personal one.
Know that the profile persists by default. The README says Playwright MCP runs "with persistent profile like a regular browser (default)", so cookies and logins survive between sessions. Use
--isolatedwhen a run must not reuse them.Treat saved profiles and storage-state files as secrets. They can hold cookies and tokens; keep them out of git.
Scope the network. Keep the server away from internal services you don't intend the agent to reach.
Require approval for destructive steps. Deletions, billing changes and permission edits should be proposed first and confirmed by a person.
Pin the package version if you want behaviour that doesn't change when
@latestmoves, and upgrade deliberately.
The README also notes that "a persistent profile can only be used by one browser instance at a time", so two MCP clients sharing one workspace will conflict.
How to Run a Browser Test from Cursor Chat
The agent drives the browser through tools, so the prompt defines the sequence. A numbered sequence produces a repeatable session; a vague one produces a wandering one.
Name the URL and ask for a read first. Have the agent open the page and report its structure before any click.
Sign in with the dedicated test account. Keep credentials in environment variables rather than pasted into the chat.
State the visible outcome to assert. "The dashboard heading reads Welcome back" is an assertion. "Sign in works" is not.
Ask for evidence. A screenshot and the failed network requests turn a claim into something you can inspect.
Save the prompt in the repository, or better, ask the agent to turn the passing session into a Playwright test so the same journey runs again.

The pitfall behind most false passes
A connected server proves that Cursor can call browser tools. It does not prove that redirects, permissions or embedded content behave correctly.
Picture it: sign-in returns success, the agent reports done, and the page it lands on still reads "Sign in" or "You don't have permission to view this." Every tool call returned without error. The app is broken for that user, and unless the prompt named the expected page, the agent has no reason to say so.
Practical rule: write the expected outcome in plain words before the run, so success can't be redefined after the fact.
Keep one journey per prompt, so a failure points at one flow. If your team also runs scripted suites alongside agent sessions, this Otter guide to website testing automation explains where scripted Playwright, Selenium and Cypress suites fit.
Common Setup Problems and How to Fix Them
| Symptom | Likely cause | Fix |
|---|---|---|
| Playwright missing or not connected after save | Wrong type or command | Type command, command npx @playwright/mcp@latest, then restart Cursor |
| The agent says it has no browser tools | Server not connected in this session | Confirm the entry shows as connected, then start a new chat |
| A browser window opens when you don't want one | Headed is the default | Add --headless to the args |
| Test account stays signed in across runs | The default profile is persistent | Add --isolated to the args |
| Two clients fight over the browser | One persistent profile, two instances | Use --isolated, or a separate --user-data-dir |
| Behaviour changes after an update | @latest resolved to a newer release | Pin a version and upgrade in a separate run |
- Symptom
- Playwright missing or not connected after save
- Likely cause
- Wrong type or command
- Fix
- Type
command, commandnpx @playwright/mcp@latest, then restart Cursor
- Symptom
- The agent says it has no browser tools
- Likely cause
- Server not connected in this session
- Fix
- Confirm the entry shows as connected, then start a new chat
- Symptom
- A browser window opens when you don't want one
- Likely cause
- Headed is the default
- Fix
- Add
--headlessto the args
- Symptom
- Test account stays signed in across runs
- Likely cause
- The default profile is persistent
- Fix
- Add
--isolatedto the args
- Symptom
- Two clients fight over the browser
- Likely cause
- One persistent profile, two instances
- Fix
- Use
--isolated, or a separate--user-data-dir
- Symptom
- Behaviour changes after an update
- Likely cause
@latestresolved to a newer release- Fix
- Pin a version and upgrade in a separate run
If the agent completes the clicks but the page is still broken, the tools worked and the test didn't: the prompt asserted nothing. Configuration problems look like tool problems, and tool problems look like app problems. Rule them out in that order before changing code.
What the Agent's Browser Does Not Cover
An agent session has limits no configuration removes. It ends when the chat ends. It doesn't run when a deploy lands and nobody has a chat open. And the agent that wrote the change is also the one judging whether it works.
Playwright MCP is open source and runs locally, which makes it the better choice for debugging a page during a session and exploring an unfamiliar flow. A scripted Playwright suite in CI is the better choice for fixed regression checks you own. Neither looks at the deployed app on its own after the session is over.
If your team also uses Claude Code, there is a matching walkthrough for Playwright MCP in Claude Code, and an overview of browser options for Claude Code. For scheduled probes against production, this Fivenines guide to synthetic monitoring explains what such checks can and can't detect.
Your agent says “done”. We check your app.
After each deploy and every day, we walk the journeys you choose on your live app and tell your agent what passed and what failed, with screenshots.
claude mcp add --scope user --transport http checkmyapp https://checkmyapp.dev/mcpFree account: $3 of checks, no card · Cursor, Codex and the full install guide
A Separate Check of the Live App
Your agent says "done". CheckMyApp checks your deployed app on its own, walks the journeys that matter, and brings the evidence back to your agent, which still does the fixing. It runs outside the agent's session, and the agent cannot mark anything as passed.
One real case from our own app, JobLander, is on the why page: the sign-in request answered 200, but the user stayed on /login. The check failed the journey, and the fix was merged 2 h 29 min after it was reported.
CheckMyApp connects to Cursor, Claude Code and Codex through MCP; the setup for each is on the install page. For what to look at after a deploy in general, see software deployment testing.
This article was prepared with the help of AI. Found a mistake? Tell us.


