> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/microsoft/playwright-mcp/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration Schema

> Complete reference for the Playwright MCP Config type

The `Config` type defines all configuration options for customizing the Playwright MCP server behavior. All fields are optional.

## Browser Configuration

<ParamField path="browser" type="object" optional>
  Browser-related configuration options.

  <Expandable title="properties">
    <ParamField path="browserName" type="'chromium' | 'firefox' | 'webkit'" optional>
      The type of browser to use. Defaults to `'chromium'`.
    </ParamField>

    <ParamField path="isolated" type="boolean" optional>
      Keep the browser profile in memory, do not save it to disk. When enabled, each session starts fresh.
    </ParamField>

    <ParamField path="userDataDir" type="string" optional>
      Path to a user data directory for browser profile persistence. Temporary directory is created by default.
    </ParamField>

    <ParamField path="launchOptions" type="playwright.LaunchOptions" optional>
      Launch options passed to Playwright's `launchPersistentContext`. See [Playwright LaunchOptions](https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context).

      Useful for settings like `channel`, `headless`, `executablePath`, etc.
    </ParamField>

    <ParamField path="contextOptions" type="playwright.BrowserContextOptions" optional>
      Context options for the browser context. Useful for settings like `viewport`, `userAgent`, `locale`, etc.
    </ParamField>

    <ParamField path="cdpEndpoint" type="string" optional>
      Chrome DevTools Protocol endpoint to connect to an existing browser instance (Chromium family browsers only).
    </ParamField>

    <ParamField path="cdpHeaders" type="Record<string, string>" optional>
      CDP headers to send with the connect request.
    </ParamField>

    <ParamField path="cdpTimeout" type="number" optional>
      Timeout in milliseconds for connecting to CDP endpoint. Defaults to 30000 (30 seconds). Pass 0 to disable timeout.
    </ParamField>

    <ParamField path="remoteEndpoint" type="string" optional>
      Remote endpoint to connect to an existing Playwright server.
    </ParamField>

    <ParamField path="initPage" type="string[]" optional>
      Paths to TypeScript files to add as initialization scripts for Playwright page object. These scripts run with access to the `page` object.
    </ParamField>

    <ParamField path="initScript" type="string[]" optional>
      Paths to JavaScript files to add as initialization scripts. The scripts will be evaluated in every page before any of the page's scripts.
    </ParamField>
  </Expandable>
</ParamField>

## Extension Mode

<ParamField path="extension" type="boolean" optional>
  Connect to a running browser instance (Edge/Chrome only). If specified, `browser` config is ignored.

  Requires the "Playwright MCP Bridge" browser extension to be installed.
</ParamField>

## Server Configuration

<ParamField path="server" type="object" optional>
  HTTP server configuration for SSE or MCP transport.

  <Expandable title="properties">
    <ParamField path="port" type="number" optional>
      The port to listen on for SSE or MCP transport.
    </ParamField>

    <ParamField path="host" type="string" optional>
      The host to bind the server to. Default is `localhost`. Use `0.0.0.0` to bind to all interfaces.
    </ParamField>

    <ParamField path="allowedHosts" type="string[]" optional>
      The hosts this server is allowed to serve from. Defaults to the host server is bound to. This is not for CORS, but rather for DNS rebinding protection.
    </ParamField>
  </Expandable>
</ParamField>

## Capabilities

<ParamField path="capabilities" type="ToolCapability[]" optional>
  List of enabled tool capabilities. See [Tool Capabilities](/api/capabilities) for details.

  Possible values:

  * `'config'` - Configuration tools
  * `'core'` - Core browser automation features
  * `'core-navigation'` - Navigation tools
  * `'core-tabs'` - Tab management
  * `'core-input'` - Input and interaction tools
  * `'core-install'` - Browser installation
  * `'network'` - Network request inspection
  * `'pdf'` - PDF generation
  * `'storage'` - Storage management
  * `'testing'` - Test assertions and verification
  * `'vision'` - Coordinate-based interactions
  * `'devtools'` - Developer tools features
</ParamField>

## Session Recording

<ParamField path="saveSession" type="boolean" optional>
  Whether to save the Playwright session into the output directory.
</ParamField>

<ParamField path="saveTrace" type="boolean" optional>
  Whether to save the Playwright trace of the session into the output directory.
</ParamField>

<ParamField path="saveVideo" type="object" optional>
  If specified, saves the Playwright video of the session into the output directory.

  <Expandable title="properties">
    <ParamField path="width" type="number" required>
      Video width in pixels.
    </ParamField>

    <ParamField path="height" type="number" required>
      Video height in pixels.
    </ParamField>
  </Expandable>
</ParamField>

## Browser Context Sharing

<ParamField path="sharedBrowserContext" type="boolean" optional>
  Reuse the same browser context between all connected HTTP clients.
</ParamField>

## Secrets Management

<ParamField path="secrets" type="Record<string, string>" optional>
  Secrets are used to prevent LLM from getting sensitive data while automating scenarios such as authentication.

  **Note:** Prefer `browser.contextOptions.storageState` over secrets file as a more secure alternative.
</ParamField>

## Output Configuration

<ParamField path="outputDir" type="string" optional>
  The directory to save output files (screenshots, PDFs, traces, etc.).
</ParamField>

<ParamField path="outputMode" type="'file' | 'stdout'" optional>
  Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to `'stdout'`.
</ParamField>

## Console Messages

<ParamField path="console" type="object" optional>
  Console message configuration.

  <Expandable title="properties">
    <ParamField path="level" type="'error' | 'warning' | 'info' | 'debug'" optional>
      The level of console messages to return. Each level includes the messages of more severe levels. Defaults to `'info'`.
    </ParamField>
  </Expandable>
</ParamField>

## Network Configuration

<ParamField path="network" type="object" optional>
  Network request filtering configuration.

  <Expandable title="properties">
    <ParamField path="allowedOrigins" type="string[]" optional>
      List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.

      Supported formats:

      * Full origin: `https://example.com:8080` - matches only that origin
      * Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
    </ParamField>

    <ParamField path="blockedOrigins" type="string[]" optional>
      List of origins to block the browser from requesting. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.

      Supported formats:

      * Full origin: `https://example.com:8080` - matches only that origin
      * Wildcard port: `http://localhost:*` - matches any port on localhost with http protocol
    </ParamField>
  </Expandable>
</ParamField>

## Test ID Attribute

<ParamField path="testIdAttribute" type="string" optional>
  Specify the attribute to use for test ids. Defaults to `'data-testid'`.
</ParamField>

## Timeouts

<ParamField path="timeouts" type="object" optional>
  Timeout configuration for actions and navigation.

  <Expandable title="properties">
    <ParamField path="action" type="number" optional>
      Configures default action timeout. See [Playwright page.setDefaultTimeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout). Defaults to 5000ms.
    </ParamField>

    <ParamField path="navigation" type="number" optional>
      Configures default navigation timeout. See [Playwright page.setDefaultNavigationTimeout](https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout). Defaults to 60000ms.
    </ParamField>
  </Expandable>
</ParamField>

## Image Responses

<ParamField path="imageResponses" type="'allow' | 'omit'" optional>
  Whether to send image responses to the client. Defaults to `'allow'`.
</ParamField>

## Snapshot Configuration

<ParamField path="snapshot" type="object" optional>
  Page snapshot configuration.

  <Expandable title="properties">
    <ParamField path="mode" type="'incremental' | 'full' | 'none'" optional>
      When taking snapshots for responses, specifies the mode to use. Defaults to `'incremental'`.
    </ParamField>
  </Expandable>
</ParamField>

## File Access

<ParamField path="allowUnrestrictedFileAccess" type="boolean" optional>
  Whether to allow file uploads from anywhere on the file system. By default (`false`), file uploads are restricted to paths within the MCP roots only.
</ParamField>

## Code Generation

<ParamField path="codegen" type="'typescript' | 'none'" optional>
  Specify the language to use for code generation. Defaults to `'typescript'`.
</ParamField>

## Complete Example

```typescript theme={null}
import { createConnection } from '@playwright/mcp';

const server = await createConnection({
  browser: {
    browserName: 'chromium',
    isolated: false,
    userDataDir: './browser-profile',
    launchOptions: {
      headless: true,
      args: ['--no-sandbox']
    },
    contextOptions: {
      viewport: { width: 1920, height: 1080 },
      userAgent: 'Custom MCP Agent'
    }
  },
  server: {
    port: 8931,
    host: '0.0.0.0'
  },
  capabilities: ['core', 'pdf', 'vision', 'testing'],
  saveTrace: true,
  saveVideo: {
    width: 1280,
    height: 720
  },
  outputDir: './output',
  outputMode: 'file',
  console: {
    level: 'info'
  },
  network: {
    blockedOrigins: ['https://ads.example.com:*']
  },
  timeouts: {
    action: 10000,
    navigation: 30000
  },
  imageResponses: 'allow',
  snapshot: {
    mode: 'incremental'
  },
  codegen: 'typescript'
});
```

## Related

* [createConnection](/api/create-connection) - Main API function
* [Tool Capabilities](/api/capabilities) - Capability groups reference
