Chrome DevTools for coding agents
feat: support --accept-insecure-certs CLI (#231)
Alex Rudenkoefb106dc94af
diff --git a/README.md b/README.mdindex 433dcc41..469ef252 100644--- a/README.md+++ b/README.md@@ -280,6 +280,10 @@ The Chrome DevTools MCP server supports the following configuration option:Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.- **Type:** string+- **`--acceptInsecureCerts`**+ If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.+ - **Type:** boolean+<!-- END AUTO GENERATED OPTIONS -->Pass them via the `args` property in the JSON configuration. For example:diff --git a/src/browser.ts b/src/browser.tsindex baa47e90..1cbaa6da 100644--- a/src/browser.ts+++ b/src/browser.ts@@ -57,6 +57,7 @@ export async function ensureBrowserConnected(browserURL: string) {}interface McpLaunchOptions {+ acceptInsecureCerts?: boolean;executablePath?: string;customDevTools?: string;channel?: Channel;@@ -116,6 +117,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {pipe: true,headless,args,+ acceptInsecureCerts: options.acceptInsecureCerts,});if (options.logFile) {// FIXME: we are probably subscribing too late to catch startup logs. Wediff --git a/src/cli.ts b/src/cli.tsindex 5d0ad78c..880c396f 100644--- a/src/cli.ts+++ b/src/cli.ts@@ -76,6 +76,10 @@ export const cliOptions = {type: 'string' as const,description: `Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.`,},+ acceptInsecureCerts: {+ type: 'boolean' as const,+ description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,+ },};export function parseArguments(version: string, argv = process.argv) {diff --git a/src/main.ts b/src/main.tsindex efc2008d..2663d3c1 100644--- a/src/main.ts+++ b/src/main.ts@@ -84,6 +84,7 @@ async function getContext(): Promise<McpContext> {logFile,viewport: args.viewport,args: extraArgs,+ acceptInsecureCerts: args.acceptInsecureCerts,});if (context?.browser !== browser) {