Skip to content

Commit e96f34d

Browse files
committed
feat: support arbitrary args
1 parent 862c6d5 commit e96f34d

File tree

4 files changed

+2
-14
lines changed

4 files changed

+2
-14
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ The Chrome DevTools MCP server supports the following configuration option:
294294
- **`--chromeArg`**
295295
Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
296296
- **Type:** array
297-
- **Default:** ``
298297

299298
<!-- END AUTO GENERATED OPTIONS -->
300299

src/cli.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export const cliOptions = {
9090
type: 'array',
9191
describe:
9292
'Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
93-
default: [],
9493
},
9594
} satisfies Record<string, YargsOptions>;
9695

@@ -122,7 +121,7 @@ export function parseArguments(version: string, argv = process.argv) {
122121
'Launch Chrome with the initial viewport size of 1280x720px',
123122
],
124123
[
125-
`$0 --chrome-args='--no-sandbox' --chrome-args='--disable-setuid-sandbox'`,
124+
`$0 --chrome-arg='--no-sandbox' --chrome-arg='--disable-setuid-sandbox'`,
126125
'Launch Chrome without sandboxes. Use with caution.',
127126
],
128127
]);

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ server.server.setRequestHandler(SetLevelRequestSchema, () => {
6969

7070
let context: McpContext;
7171
async function getContext(): Promise<McpContext> {
72-
const extraArgs: string[] = [];
72+
const extraArgs: string[] = (args.chromeArg ?? []).map(String);
7373
if (args.proxyServer) {
7474
extraArgs.push(`--proxy-server=${args.proxyServer}`);
7575
}

tests/cli.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ describe('cli args parsing', () => {
1717
isolated: false,
1818
$0: 'npx chrome-devtools-mcp@latest',
1919
channel: 'stable',
20-
'chrome-arg': [],
21-
chromeArg: [],
2220
});
2321
});
2422

@@ -37,8 +35,6 @@ describe('cli args parsing', () => {
3735
'browser-url': 'http://localhost:3000',
3836
browserUrl: 'http://localhost:3000',
3937
u: 'http://localhost:3000',
40-
'chrome-arg': [],
41-
chromeArg: [],
4238
});
4339
});
4440

@@ -58,8 +54,6 @@ describe('cli args parsing', () => {
5854
browserUrl: undefined,
5955
u: undefined,
6056
channel: 'stable',
61-
'chrome-arg': [],
62-
chromeArg: [],
6357
});
6458
});
6559

@@ -78,8 +72,6 @@ describe('cli args parsing', () => {
7872
'executable-path': '/tmp/test 123/chrome',
7973
e: '/tmp/test 123/chrome',
8074
executablePath: '/tmp/test 123/chrome',
81-
'chrome-arg': [],
82-
chromeArg: [],
8375
});
8476
});
8577

@@ -100,8 +92,6 @@ describe('cli args parsing', () => {
10092
width: 888,
10193
height: 777,
10294
},
103-
'chrome-arg': [],
104-
chromeArg: [],
10595
});
10696
});
10797

0 commit comments

Comments
 (0)