Questions? hello@viberation.devGet supportBlogDocsChangelog
Get started
← All of Learn

Playwright MCP without burning your context window

Your AI tool can write a login form. It cannot normally tell you whether the form works, because it cannot see your site. It is reasoning from the code. Playwright MCP closes that gap. It gives your tool a real browser it can drive: open a page, click a button, fill a field, read what came back. When it says the checkout works, it has been through the checkout.

Worth it when you are debugging something you can only see in a browser, checking a change actually rendered, or filling in the same test form for the twentieth time. Not worth it for writing code, explaining an error, or anything where the answer is already in the files. It is a browser, not a brain, and every page it reads costs you context.

Install it in

One command, run in your terminal.

bash

claude mcp add playwright npx @playwright/mcp@latest

What you should see

A line confirming the server was added. Restart Claude Code, then run /mcp to see playwright listed as connected.

That adds it to this project only, and keeps it private to you. That is the default.

bash

claude mcp add --scope user playwright npx @playwright/mcp@latest

What you should see

The same confirmation. Playwright MCP is now available in every project on your machine, still just for you.

Or share it with your team through git, which writes a .mcp.json file in the project for you to commit:

bash

claude mcp add --scope project playwright npx @playwright/mcp@latest

What you should see

The same confirmation, and a .mcp.json file in your project folder. Commit that file so your team gets the same setup.

Check it works. Ask your tool to do something small and verifiable:

Copy this into your AI tool

Using Playwright, open example.com and tell me exactly what the main heading says.

Open it in your AI tool. Clicking copies the prompt, and ChatGPT and Grok open with it already filled in.

More tools

Code editors on your computer. Open app only works once it is installed, so use Get it first if you do not have it.

Want the full list? Browse all app builders and coding editors (IDEs).

It should open a browser window, read the page and answer "Example Domain". If it answers without opening anything, it is working from memory and the server is not connected. Check the MCP list in your tool.

Four habits that fix it. 1. Ask for what you need, not for everything. "Find the submit button" uses a search that returns a few lines. "Look at the page" returns the whole thing. Say what you are after. 2. Skip screenshots unless you need to see it. An image costs far more than the text description, and for "did this button move" the text already answers you. Ask for a screenshot when the question is genuinely visual. 3. Close the tab when you are done. Tabs left open keep showing up in what your tool reads. 4. Start a fresh session after a long browser stretch. Once the context is full of stale page snapshots, clearing it is faster than fighting it.

If you are doing a lot of browser work, the server has flags for this. Turning image responses off stops screenshots eating the budget:

bash

claude mcp add playwright -- npx @playwright/mcp@latest --image-responses omit

What you should see

The same confirmation. Your tool now works from text descriptions only, which is what you want for most debugging.

Add --headless to stop a browser window popping up, and --isolated to throw away cookies and logins between runs rather than keeping a profile on disk. Both go after the -- as well, alongside --image-responses.

When it goes wrong, it is usually one of three things. Nothing happens and your tool answers from memory. The server is not connected. Check the MCP list in your tool, and restart it after installing. npx: command not found. Node.js is not installed, or not on your PATH. Install Node and open a new terminal. It opens the page but sees nothing useful. The page is probably still loading. Ask it to wait for a specific piece of text to appear before reading.