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
string
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_HOSTSstring
Semicolon-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_ORIGINSboolean
Allow 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_ACCESSstring
Semicolon-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_ORIGINSboolean
Block service workers.Environment variable:
PLAYWRIGHT_MCP_BLOCK_SERVICE_WORKERSstring
Browser or chrome channel to use. Possible values:
chrome, firefox, webkit, msedge.Environment variable: PLAYWRIGHT_MCP_BROWSERstring
Comma-separated list of additional capabilities to enable. Possible values:
vision, pdf, devtools.Environment variable: PLAYWRIGHT_MCP_CAPSstring
CDP endpoint to connect to.Environment variable:
PLAYWRIGHT_MCP_CDP_ENDPOINTstring
CDP headers to send with the connect request. Multiple can be specified.Environment variable:
PLAYWRIGHT_MCP_CDP_HEADERnumber
Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000ms.Environment variable:
PLAYWRIGHT_MCP_CDP_TIMEOUTstring
Specify the language to use for code generation. Possible values:
typescript, none. Default is typescript.Environment variable: PLAYWRIGHT_MCP_CODEGENstring
Path to the configuration file.Environment variable:
PLAYWRIGHT_MCP_CONFIGstring
Level of console messages to return:
error, warning, info, debug. Each level includes the messages of more severe levels.Environment variable: PLAYWRIGHT_MCP_CONSOLE_LEVELstring
Device to emulate, for example: “iPhone 15”.Environment variable:
PLAYWRIGHT_MCP_DEVICEstring
Path to the browser executable.Environment variable:
PLAYWRIGHT_MCP_EXECUTABLE_PATHboolean
Connect to a running browser instance (Edge/Chrome only). Requires the “Playwright MCP Bridge” browser extension to be installed.Environment variable:
PLAYWRIGHT_MCP_EXTENSIONstring
List of permissions to grant to the browser context, for example
geolocation, clipboard-read, clipboard-write.Environment variable: PLAYWRIGHT_MCP_GRANT_PERMISSIONSboolean
Run browser in headless mode. Headed by default.Environment variable:
PLAYWRIGHT_MCP_HEADLESSstring
Host to bind server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.Environment variable:
PLAYWRIGHT_MCP_HOSTboolean
Ignore HTTPS errors.Environment variable:
PLAYWRIGHT_MCP_IGNORE_HTTPS_ERRORSstring
Path to TypeScript file to evaluate on Playwright page object.Environment variable:
PLAYWRIGHT_MCP_INIT_PAGEstring
Path 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_SCRIPTboolean
Keep the browser profile in memory, do not save it to disk.Environment variable:
PLAYWRIGHT_MCP_ISOLATEDstring
Whether to send image responses to the client. Can be
allow or omit. Defaults to allow.Environment variable: PLAYWRIGHT_MCP_IMAGE_RESPONSESboolean
Disable the sandbox for all process types that are normally sandboxed.Environment variable:
PLAYWRIGHT_MCP_NO_SANDBOXstring
Path to the directory for output files.Environment variable:
PLAYWRIGHT_MCP_OUTPUT_DIRstring
Whether 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_MODEnumber
Port to listen on for SSE transport.Environment variable:
PLAYWRIGHT_MCP_PORTstring
Comma-separated domains to bypass proxy, for example “.com,chromium.org,.domain.com”.Environment variable:
PLAYWRIGHT_MCP_PROXY_BYPASSstring
Specify proxy server, for example “http://myproxy:3128” or “socks5://myproxy:8080”.Environment variable:
PLAYWRIGHT_MCP_PROXY_SERVERboolean
Enable the sandbox for all process types that are normally not sandboxed.Environment variable:
PLAYWRIGHT_MCP_SANDBOXboolean
Whether to save the Playwright MCP session into the output directory.Environment variable:
PLAYWRIGHT_MCP_SAVE_SESSIONboolean
Whether to save the Playwright Trace of the session into the output directory.Environment variable:
PLAYWRIGHT_MCP_SAVE_TRACEstring
Whether to save the video of the session into the output directory. For example “—save-video=800x600”.Environment variable:
PLAYWRIGHT_MCP_SAVE_VIDEOstring
Path 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_CONTEXTstring
When taking snapshots for responses, specifies the mode to use. Can be
incremental, full, or none. Default is incremental.Environment variable: PLAYWRIGHT_MCP_SNAPSHOT_MODEstring
Path to the storage state file for isolated sessions.Environment variable:
PLAYWRIGHT_MCP_STORAGE_STATEstring
Specify the attribute to use for test ids. Defaults to “data-testid”.Environment variable:
PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTEnumber
Specify 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_NAVIGATIONstring
Specify user agent string.Environment variable:
PLAYWRIGHT_MCP_USER_AGENTstring
Path to the user data directory. If not specified, a temporary directory will be created.Environment variable:
PLAYWRIGHT_MCP_USER_DATA_DIRstring
Specify browser viewport size in pixels, for example “1280x720”.Environment variable:
PLAYWRIGHT_MCP_VIEWPORT_SIZE
