chrome-devtools-mcp 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/src/browser.js +1 -4
- package/build/src/cli.js +8 -7
- package/build/src/main.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -291,6 +291,10 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
291
291
|
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
|
|
292
292
|
- **Type:** boolean
|
|
293
293
|
|
|
294
|
+
- **`--chromeArg`**
|
|
295
|
+
Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
|
|
296
|
+
- **Type:** array
|
|
297
|
+
|
|
294
298
|
<!-- END AUTO GENERATED OPTIONS -->
|
|
295
299
|
|
|
296
300
|
Pass them via the `args` property in the JSON configuration. For example:
|
package/build/src/browser.js
CHANGED
|
@@ -42,7 +42,7 @@ export async function ensureBrowserConnected(options) {
|
|
|
42
42
|
return browser;
|
|
43
43
|
}
|
|
44
44
|
export async function launch(options) {
|
|
45
|
-
const { channel, executablePath,
|
|
45
|
+
const { channel, executablePath, headless, isolated } = options;
|
|
46
46
|
const profileDirName = channel && channel !== 'stable'
|
|
47
47
|
? `chrome-profile-${channel}`
|
|
48
48
|
: 'chrome-profile';
|
|
@@ -57,9 +57,6 @@ export async function launch(options) {
|
|
|
57
57
|
...(options.args ?? []),
|
|
58
58
|
'--hide-crash-restore-bubble',
|
|
59
59
|
];
|
|
60
|
-
if (customDevTools) {
|
|
61
|
-
args.push(`--custom-devtools-frontend=file://${customDevTools}`);
|
|
62
|
-
}
|
|
63
60
|
if (headless) {
|
|
64
61
|
args.push('--screen-info={3840x2160}');
|
|
65
62
|
}
|
package/build/src/cli.js
CHANGED
|
@@ -39,13 +39,6 @@ export const cliOptions = {
|
|
|
39
39
|
description: 'If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed.',
|
|
40
40
|
default: false,
|
|
41
41
|
},
|
|
42
|
-
customDevtools: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Path to custom DevTools.',
|
|
45
|
-
hidden: true,
|
|
46
|
-
conflicts: 'browserUrl',
|
|
47
|
-
alias: 'd',
|
|
48
|
-
},
|
|
49
42
|
channel: {
|
|
50
43
|
type: 'string',
|
|
51
44
|
description: 'Specify a different Chrome channel that should be used. The default is the stable channel version.',
|
|
@@ -86,6 +79,10 @@ export const cliOptions = {
|
|
|
86
79
|
describe: 'Whether to enable automation over DevTools targets',
|
|
87
80
|
hidden: true,
|
|
88
81
|
},
|
|
82
|
+
chromeArg: {
|
|
83
|
+
type: 'array',
|
|
84
|
+
describe: 'Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
|
|
85
|
+
},
|
|
89
86
|
};
|
|
90
87
|
export function parseArguments(version, argv = process.argv) {
|
|
91
88
|
const yargsInstance = yargs(hideBin(argv))
|
|
@@ -114,6 +111,10 @@ export function parseArguments(version, argv = process.argv) {
|
|
|
114
111
|
'$0 --viewport 1280x720',
|
|
115
112
|
'Launch Chrome with the initial viewport size of 1280x720px',
|
|
116
113
|
],
|
|
114
|
+
[
|
|
115
|
+
`$0 --chrome-arg='--no-sandbox' --chrome-arg='--disable-setuid-sandbox'`,
|
|
116
|
+
'Launch Chrome without sandboxes. Use with caution.',
|
|
117
|
+
],
|
|
117
118
|
]);
|
|
118
119
|
return yargsInstance
|
|
119
120
|
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
package/build/src/main.js
CHANGED
|
@@ -54,7 +54,7 @@ server.server.setRequestHandler(SetLevelRequestSchema, () => {
|
|
|
54
54
|
});
|
|
55
55
|
let context;
|
|
56
56
|
async function getContext() {
|
|
57
|
-
const extraArgs = [];
|
|
57
|
+
const extraArgs = (args.chromeArg ?? []).map(String);
|
|
58
58
|
if (args.proxyServer) {
|
|
59
59
|
extraArgs.push(`--proxy-server=${args.proxyServer}`);
|
|
60
60
|
}
|
|
@@ -67,7 +67,6 @@ async function getContext() {
|
|
|
67
67
|
: await ensureBrowserLaunched({
|
|
68
68
|
headless: args.headless,
|
|
69
69
|
executablePath: args.executablePath,
|
|
70
|
-
customDevTools: args.customDevtools,
|
|
71
70
|
channel: args.channel,
|
|
72
71
|
isolated: args.isolated,
|
|
73
72
|
logFile,
|