Skip to content

Commit efb106d

Browse files
authored
feat: support --accept-insecure-certs CLI (#231)
Closes #155 Exposes the Puppeteer option only for the instances launched by the MCP to avoid changing behavior for instances started by other means.
1 parent dfacc75 commit efb106d

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
@@ -280,6 +280,10 @@ The Chrome DevTools MCP server supports the following configuration option:
280280
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.
281281
- **Type:** string
282282

283+
- **`--acceptInsecureCerts`**
284+
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
285+
- **Type:** boolean
286+
283287
<!-- END AUTO GENERATED OPTIONS -->
284288

285289
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
@@ -76,6 +76,10 @@ export const cliOptions = {
7676
type: 'string' as const,
7777
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.`,
7878
},
79+
acceptInsecureCerts: {
80+
type: 'boolean' as const,
81+
description: `If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.`,
82+
},
7983
};
8084

8185
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)