Skip to content

Commit 47ea450

Browse files
committed
feat: support --accept-insecure-certs CLI
1 parent 845bdc8 commit 47ea450

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ The Chrome DevTools MCP server supports the following configuration option:
276276
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.
277277
- **Type:** string
278278

279+
- **`--acceptInsecureCerts`**
280+
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
281+
- **Type:** boolean
282+
279283
<!-- END AUTO GENERATED OPTIONS -->
280284

281285
Pass them via the `args` property in the JSON configuration. For example:

src/browser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export async function ensureBrowserConnected(browserURL: string) {
5757
}
5858

5959
interface McpLaunchOptions {
60+
acceptInsecureCerts?: boolean;
6061
executablePath?: string;
6162
customDevTools?: string;
6263
channel?: Channel;
@@ -116,6 +117,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
116117
pipe: true,
117118
headless,
118119
args,
120+
acceptInsecureCerts: options.acceptInsecureCerts,
119121
});
120122
if (options.logFile) {
121123
// FIXME: we are probably subscribing too late to catch startup logs. We

src/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ export const cliOptions = {
7777
type: 'string' as const,
7878
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.`,
7979
},
80+
acceptInsecureCerts: {
81+
type: 'boolean' as const,
82+
description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,
83+
},
8084
};
8185

8286
export function parseArguments(version: string, argv = process.argv) {

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async function getContext(): Promise<McpContext> {
8484
logFile,
8585
viewport: args.viewport,
8686
args: extraArgs,
87+
acceptInsecureCerts: args.acceptInsecureCerts,
8788
});
8889

8990
if (context?.browser !== browser) {

0 commit comments

Comments
 (0)