Skip to main content
Playwright MCP can run with persistent profiles like a regular browser (default), in isolated contexts for testing sessions, or connect to your existing browser using the browser extension.

Persistent Profile

By default, all logged-in information and browser state is stored in a persistent profile. This allows you to maintain sessions across MCP server restarts.

Default Profile Locations

The persistent profile is stored at the following locations by default: Windows:
%USERPROFILE%\AppData\Local\ms-playwright\mcp-{channel}-profile
macOS:
~/Library/Caches/ms-playwright/mcp-{channel}-profile
Linux:
~/.cache/ms-playwright/mcp-{channel}-profile

Custom Profile Location

You can specify a custom profile location using the --user-data-dir argument:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest",
        "--user-data-dir",
        "/path/to/custom/profile"
      ]
    }
  }
}

Clearing Browser State

You can delete the persistent profile directory between sessions to clear all offline state, cookies, and logged-in information.

Isolated Mode

In isolated mode, each session starts in a fresh, isolated browser context. When you close the browser, all storage state for that session is lost.

Basic Isolated Mode

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest",
        "--isolated"
      ]
    }
  }
}

Isolated Mode with Initial Storage State

You can provide an initial storage state to the isolated browser context using the --storage-state argument:
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest",
        "--isolated",
        "--storage-state",
        "path/to/storage.json"
      ]
    }
  }
}
Learn more about storage state in the Playwright documentation.

Configuration File Approach

You can also configure isolated mode with initial storage state using a configuration file:
{
  "browser": {
    "isolated": true,
    "contextOptions": {
      "storageState": "path/to/storage.json"
    }
  }
}

Browser Extension Mode

The Playwright MCP Chrome Extension allows you to connect to existing browser tabs and leverage your logged-in sessions and browser state. See the Browser Extension guide for detailed installation and setup instructions.