Command-Line Arguments
All configuration options can be provided as command-line arguments in theargs array of your MCP server configuration:
Environment Variables
Every command-line option has a corresponding environment variable with thePLAYWRIGHT_MCP_ prefix:
Configuration File
You can use a JSON configuration file for more complex setups. Specify the file path using the--config option:
Configuration File Schema
Available Options
Comma-separated list of hosts this server is allowed to serve from. Defaults to the host the server is bound to. Pass ’*’ to disable the host check.Environment variable:
PLAYWRIGHT_MCP_ALLOWED_HOSTSSemicolon-separated list of TRUSTED origins to allow the browser to request. Default is to allow all. Important: does not serve as a security boundary and does not affect redirects.Environment variable:
PLAYWRIGHT_MCP_ALLOWED_ORIGINSAllow access to files outside of the workspace roots. Also allows unrestricted access to file:// URLs. By default access to file system is restricted to workspace root directories (or cwd if no roots are configured) only, and navigation to file:// URLs is blocked.Environment variable:
PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESSSemicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed. Important: does not serve as a security boundary and does not affect redirects.Environment variable:
PLAYWRIGHT_MCP_BLOCKED_ORIGINSBlock service workers.Environment variable:
PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERSBrowser or chrome channel to use. Possible values:
chrome, firefox, webkit, msedge.Environment variable: PLAYWRIGHT_MCP_BROWSERComma-separated list of additional capabilities to enable. Possible values:
vision, pdf, devtools.Environment variable: PLAYWRIGHT_MCP_CAPSCDP endpoint to connect to.Environment variable:
PLAYWRIGHT_MCP_CDP_ENDPOINTCDP headers to send with the connect request. Multiple can be specified.Environment variable:
PLAYWRIGHT_MCP_CDP_HEADERTimeout in milliseconds for connecting to CDP endpoint. Defaults to 30000ms.Environment variable:
PLAYWRIGHT_MCP_CDP_TIMEOUTSpecify the language to use for code generation. Possible values:
typescript, none. Default is typescript.Environment variable: PLAYWRIGHT_MCP_CODEGENPath to the configuration file.Environment variable:
PLAYWRIGHT_MCP_CONFIGLevel of console messages to return:
error, warning, info, debug. Each level includes the messages of more severe levels.Environment variable: PLAYWRIGHT_MCP_CONSOLE_LEVELDevice to emulate, for example: “iPhone 15”.Environment variable:
PLAYWRIGHT_MCP_DEVICEPath to the browser executable.Environment variable:
PLAYWRIGHT_MCP_EXECUTABLE_PATHConnect to a running browser instance (Edge/Chrome only). Requires the “Playwright MCP Bridge” browser extension to be installed.Environment variable:
PLAYWRIGHT_MCP_EXTENSIONList of permissions to grant to the browser context, for example
geolocation, clipboard-read, clipboard-write.Environment variable: PLAYWRIGHT_MCP_GRANT_PERMISSIONSRun browser in headless mode. Headed by default.Environment variable:
PLAYWRIGHT_MCP_HEADLESSHost to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.Environment variable:
PLAYWRIGHT_MCP_HOSTIgnore HTTPS errors.Environment variable:
PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORSPath to TypeScript file to evaluate on Playwright page object.Environment variable:
PLAYWRIGHT_MCP_INIT_PAGEPath to JavaScript file to add as an initialization script. The script will be evaluated in every page before any of the page’s scripts. Can be specified multiple times.Environment variable:
PLAYWRIGHT_MCP_INIT_SCRIPTKeep the browser profile in memory, do not save it to disk.Environment variable:
PLAYWRIGHT_MCP_ISOLATEDWhether to send image responses to the client. Can be
allow or omit. Defaults to allow.Environment variable: PLAYWRIGHT_MCP_IMAGE_RESPONSESDisable the sandbox for all process types that are normally sandboxed.Environment variable:
PLAYWRIGHT_MCP_NO_SANDBOXPath to the directory for output files.Environment variable:
PLAYWRIGHT_MCP_OUTPUT_DIRWhether to save snapshots, console messages, network logs to a file or to the standard output. Can be
file or stdout. Default is stdout.Environment variable: PLAYWRIGHT_MCP_OUTPUT_MODEPort to listen on for SSE transport.Environment variable:
PLAYWRIGHT_MCP_PORTComma-separated domains to bypass proxy, for example “.com,chromium.org,.domain.com”.Environment variable:
PLAYWRIGHT_MCP_PROXY_BYPASSSpecify proxy server, for example “http://myproxy:3128” or “socks5://myproxy:8080”.Environment variable:
PLAYWRIGHT_MCP_PROXY_SERVEREnable the sandbox for all process types that are normally not sandboxed.Environment variable:
PLAYWRIGHT_MCP_SANDBOXWhether to save the Playwright MCP session into the output directory.Environment variable:
PLAYWRIGHT_MCP_SAVE_SESSIONWhether to save the Playwright Trace of the session into the output directory.Environment variable:
PLAYWRIGHT_MCP_SAVE_TRACEWhether to save the video of the session into the output directory. For example “—save-video=800x600”.Environment variable:
PLAYWRIGHT_MCP_SAVE_VIDEOPath to a file containing secrets in the dotenv format.Environment variable:
PLAYWRIGHT_MCP_SECRETSReuse the same browser context between all connected HTTP clients.Environment variable:
PLAYWRIGHT_MCP_SHARED_BROWSER_CONTEXTWhen taking snapshots for responses, specifies the mode to use. Can be
incremental, full, or none. Default is incremental.Environment variable: PLAYWRIGHT_MCP_SNAPSHOT_MODEPath to the storage state file for isolated sessions.Environment variable:
PLAYWRIGHT_MCP_STORAGE_STATESpecify the attribute to use for test ids. Defaults to “data-testid”.Environment variable:
PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTESpecify action timeout in milliseconds. Defaults to 5000ms.Environment variable:
PLAYWRIGHT_MCP_TIMEOUT_ACTIONSpecify navigation timeout in milliseconds. Defaults to 60000ms.Environment variable:
PLAYWRIGHT_MCP_TIMEOUT_NAVIGATIONSpecify user agent string.Environment variable:
PLAYWRIGHT_MCP_USER_AGENTPath to the user data directory. If not specified, a temporary directory will be created.Environment variable:
PLAYWRIGHT_MCP_USER_DATA_DIRSpecify browser viewport size in pixels, for example “1280x720”.Environment variable:
PLAYWRIGHT_MCP_VIEWPORT_SIZE
