Skip to content
MCP Shelf

Pod to App: VS Code

How to install the Playwright MCP server in VS Code

By Sophie Filer · Updated 11 Nov 2026 · Steps checked against Playwright's own docs on 11 Nov 2026

The short answer

Run the code --add-mcp command below, or press Install in VS Code in the Playwright MCP README. After that, Copilot Chat in Agent mode can open pages, click and type in a real browser.

Terminal
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
Needs
Node.js 18 or newer
Used by
Copilot Chat, Agent mode
Sign-in
None
Browser
Chrome, visible by default

Three ways in

RouteWhat to do
Install buttonOpen the Playwright MCP README and press Install in VS Code (or the Insiders button), then confirm in VS Code
VS Code command lineRun the code --add-mcp command at the top of this page; it adds the server to your user settings
Workspace filePut the block below in .vscode/mcp.json so everyone who opens the repo gets it
.vscode/mcp.json
{
  "servers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

First run

  1. Step 1: If you used the workspace file, click Start above the entry. Otherwise VS Code starts the server when Copilot needs it.
  2. Step 2: Open Copilot Chat and choose Agent mode.
  3. Step 3: Open the tools picker in the chat input and check that the Playwright browser tools are ticked.
  4. Step 4: Ask: "Open localhost:5173, resize to a phone width and tell me if anything overflows."
  5. Step 5: Approve each tool call as it comes, or allow them for the session once you trust it.

Settings worth changing

Extra options go in args. A setup that suits front-end work in VS Code:

.vscode/mcp.json
{
  "servers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest", "--device", "iPhone 15", "--caps", "pdf"]
    }
  }
}
  • --device emulates a phone or tablet, handy for checking responsive layouts.
  • --caps pdf lets Copilot save a page as PDF; devtools and vision add more tools.
  • --headless hides the window, useful in Codespaces or remote sessions.
  • --extension drives your own Chrome or Edge with your logins, once the Playwright Extension is installed there.

In Codespaces and Remote SSH

When VS Code is connected to a remote machine, MCP servers in the workspace file run on that machine, where there is usually no screen. Add --headless there, or install the server in your local user settings so the browser opens on your own computer.

If it does not work

What you seeWhat to do
code command not foundIn VS Code, run Shell Command: Install 'code' command in PATH from the command palette, or use the install button.
Server shows an error in the MCP listVS Code could not run npx. Install Node.js 18 or later and reload the window.
Copilot answers without opening a browserSwitch to Agent mode and make sure the Playwright tools are ticked in the tools picker.
Browser fails to open in a remote sessionThere is no display there. Add --headless.

MCP Shelf take

Is Playwright worth adding to VS Code?

Playwright MCP gives Copilot in VS Code something it badly lacks on its own: a way to look at the page it just changed. For layout bugs, form flows and "why is this button not working" questions, that is a real step up. It is less suited to repeatable testing, since each run costs time and tokens. Use it while you build and debug, and ask Copilot to turn the steps it took into a Playwright test file you keep in the repo.

Sophie Filer

Questions

Does Playwright MCP need GitHub Copilot in VS Code?

In VS Code, MCP tools are used through Copilot Chat in Agent mode, so yes, you need Copilot signed in. The server itself is free.

Where does code --add-mcp save the server?

In your user MCP configuration, so it is available in every workspace. Use .vscode/mcp.json instead if you want it only in one project or shared with a team.

Why does VS Code use "servers" instead of "mcpServers"?

That is VS Code's own format. The Playwright entry is otherwise the same as in other apps; only the top key changes.

Sources: the steps on this page are written in our own words from Playwright MCP's own install docs, the README. If they disagree with this page, the project's docs win; please tell us from the server page.