feat: add --no-isolated flag to enable persistent browser profile

Adds --no-isolated CLI flag to switch from the default incognito-like
isolated mode to a persistent browser profile. This enables features
that require non-incognito mode, particularly:

- Push API (pushManager.subscribe()) for push notifications
- Service worker persistence across sessions
- Full browser state retention

Usage:
  npx playwright-mcp --no-isolated
  PLAYWRIGHT_MCP_ISOLATED=false npx playwright-mcp

The default behavior (--isolated) remains unchanged for backward
compatibility.
This commit is contained in:
Ryan Malloy 2026-01-12 19:48:17 -07:00
parent d31265d6b0
commit dccba24345
2 changed files with 6 additions and 2 deletions

View File

@ -177,7 +177,10 @@ Playwright MCP server supports following arguments. They can be provided in the
Use 0.0.0.0 to bind to all interfaces. Use 0.0.0.0 to bind to all interfaces.
--ignore-https-errors ignore https errors --ignore-https-errors ignore https errors
--isolated keep the browser profile in memory, do not --isolated keep the browser profile in memory, do not
save it to disk. save it to disk. This is the default.
--no-isolated use a persistent browser profile. Enables
features like Push API that require
non-incognito mode.
--image-responses <mode> whether to send image responses to the client. --image-responses <mode> whether to send image responses to the client.
Can be "allow" or "omit", Defaults to "allow". Can be "allow" or "omit", Defaults to "allow".
--no-snapshots disable automatic page snapshots after --no-snapshots disable automatic page snapshots after

View File

@ -44,7 +44,8 @@ program
.option('--headless', 'run browser in headless mode, headed by default') .option('--headless', 'run browser in headless mode, headed by default')
.option('--host <host>', 'host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.') .option('--host <host>', 'host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.')
.option('--ignore-https-errors', 'ignore https errors') .option('--ignore-https-errors', 'ignore https errors')
.option('--isolated', 'keep the browser profile in memory, do not save it to disk.') .option('--isolated', 'keep the browser profile in memory, do not save it to disk. This is the default.')
.option('--no-isolated', 'use a persistent browser profile. Enables features like Push API that require non-incognito mode.')
.option('--image-responses <mode>', 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".') .option('--image-responses <mode>', 'whether to send image responses to the client. Can be "allow" or "omit", Defaults to "allow".')
.option('--no-snapshots', 'disable automatic page snapshots after interactive operations like clicks. Use browser_snapshot tool for explicit snapshots.') .option('--no-snapshots', 'disable automatic page snapshots after interactive operations like clicks. Use browser_snapshot tool for explicit snapshots.')
.option('--max-snapshot-tokens <tokens>', 'maximum number of tokens allowed in page snapshots before truncation. Use 0 to disable truncation. Default is 10000.', parseInt) .option('--max-snapshot-tokens <tokens>', 'maximum number of tokens allowed in page snapshots before truncation. Use 0 to disable truncation. Default is 10000.', parseInt)