chrome-devtools-mcp 0.23.0 → 0.25.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 +22 -5
- package/build/src/DevToolsConnectionAdapter.js +1 -0
- package/build/src/DevtoolsUtils.js +1 -0
- package/build/src/HeapSnapshotManager.js +16 -0
- package/build/src/McpContext.js +57 -4
- package/build/src/McpPage.js +10 -4
- package/build/src/McpResponse.js +55 -19
- package/build/src/Mutex.js +1 -0
- package/build/src/PageCollector.js +1 -0
- package/build/src/SlimMcpResponse.js +1 -0
- package/build/src/TextSnapshot.js +13 -7
- package/build/src/WaitForHelper.js +6 -0
- package/build/src/bin/check-latest-version.js +1 -0
- package/build/src/bin/chrome-devtools-cli-options.js +229 -46
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +10 -5
- package/build/src/bin/chrome-devtools-mcp-main.js +1 -5
- package/build/src/bin/chrome-devtools-mcp.js +1 -0
- package/build/src/bin/chrome-devtools.js +5 -13
- package/build/src/browser.js +1 -0
- package/build/src/daemon/client.js +4 -2
- package/build/src/daemon/daemon.js +1 -0
- package/build/src/daemon/types.js +1 -0
- package/build/src/daemon/utils.js +1 -0
- package/build/src/formatters/ConsoleFormatter.js +48 -1
- package/build/src/formatters/HeapSnapshotFormatter.js +18 -2
- package/build/src/formatters/IssueFormatter.js +1 -0
- package/build/src/formatters/NetworkFormatter.js +1 -0
- package/build/src/formatters/SnapshotFormatter.js +2 -1
- package/build/src/index.js +114 -51
- package/build/src/issue-descriptions.js +1 -0
- package/build/src/logger.js +1 -0
- package/build/src/polyfill.js +1 -0
- package/build/src/telemetry/ClearcutLogger.js +13 -1
- package/build/src/telemetry/WatchdogClient.js +1 -0
- package/build/src/telemetry/flagUtils.js +1 -0
- package/build/src/telemetry/metricUtils.js +1 -0
- package/build/src/telemetry/persistence.js +1 -0
- package/build/src/telemetry/toolMetricsUtils.js +2 -1
- package/build/src/telemetry/types.js +1 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +1 -0
- package/build/src/telemetry/watchdog/main.js +1 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +8 -8
- package/build/src/third_party/bundled-packages.json +3 -3
- package/build/src/third_party/devtools-formatter-worker.js +2469 -2933
- package/build/src/third_party/devtools-heap-snapshot-worker.js +50 -26
- package/build/src/third_party/index.js +1107 -407
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +21717 -20261
- package/build/src/tools/ToolDefinition.js +1 -0
- package/build/src/tools/categories.js +10 -3
- package/build/src/tools/console.js +3 -0
- package/build/src/tools/emulation.js +2 -0
- package/build/src/tools/extensions.js +6 -0
- package/build/src/tools/input.js +57 -2
- package/build/src/tools/lighthouse.js +17 -9
- package/build/src/tools/memory.js +34 -1
- package/build/src/tools/network.js +5 -0
- package/build/src/tools/pages.js +14 -5
- package/build/src/tools/performance.js +6 -0
- package/build/src/tools/screencast.js +6 -2
- package/build/src/tools/screenshot.js +3 -0
- package/build/src/tools/script.js +2 -0
- package/build/src/tools/slim/tools.js +4 -0
- package/build/src/tools/snapshot.js +5 -1
- package/build/src/tools/{inPage.js → thirdPartyDeveloper.js} +17 -16
- package/build/src/tools/tools.js +3 -2
- package/build/src/tools/webmcp.js +5 -4
- package/build/src/trace-processing/parse.js +1 -0
- package/build/src/types.js +1 -0
- package/build/src/utils/check-for-updates.js +1 -0
- package/build/src/utils/files.js +5 -10
- package/build/src/utils/id.js +1 -0
- package/build/src/utils/keyboard.js +1 -0
- package/build/src/utils/pagination.js +1 -0
- package/build/src/utils/string.js +1 -0
- package/build/src/utils/types.js +1 -0
- package/build/src/version.js +2 -1
- package/package.json +10 -11
- package/build/src/bin/cliDefinitions.js +0 -621
|
@@ -28,6 +28,36 @@ export const commands = {
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
|
+
click_at: {
|
|
32
|
+
description: 'Clicks at the provided coordinates (requires flag: --experimentalVision=true)',
|
|
33
|
+
category: 'Input automation',
|
|
34
|
+
args: {
|
|
35
|
+
x: {
|
|
36
|
+
name: 'x',
|
|
37
|
+
type: 'number',
|
|
38
|
+
description: 'The x coordinate',
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
y: {
|
|
42
|
+
name: 'y',
|
|
43
|
+
type: 'number',
|
|
44
|
+
description: 'The y coordinate',
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
dblClick: {
|
|
48
|
+
name: 'dblClick',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
description: 'Set to true for double clicks. Default is false.',
|
|
51
|
+
required: false,
|
|
52
|
+
},
|
|
53
|
+
includeSnapshot: {
|
|
54
|
+
name: 'includeSnapshot',
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
description: 'Whether to include a snapshot in the response. Default is false.',
|
|
57
|
+
required: false,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
31
61
|
close_page: {
|
|
32
62
|
description: 'Closes the page by its index. The last open page cannot be closed.',
|
|
33
63
|
category: 'Navigation automation',
|
|
@@ -84,7 +114,7 @@ export const commands = {
|
|
|
84
114
|
geolocation: {
|
|
85
115
|
name: 'geolocation',
|
|
86
116
|
type: 'string',
|
|
87
|
-
description: 'Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.',
|
|
117
|
+
description: 'Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit to clear the geolocation override.',
|
|
88
118
|
required: false,
|
|
89
119
|
},
|
|
90
120
|
userAgent: {
|
|
@@ -124,40 +154,64 @@ export const commands = {
|
|
|
124
154
|
description: 'An optional list of arguments to pass to the function.',
|
|
125
155
|
required: false,
|
|
126
156
|
},
|
|
157
|
+
dialogAction: {
|
|
158
|
+
name: 'dialogAction',
|
|
159
|
+
type: 'string',
|
|
160
|
+
description: 'Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.',
|
|
161
|
+
required: false,
|
|
162
|
+
},
|
|
127
163
|
},
|
|
128
164
|
},
|
|
129
|
-
|
|
130
|
-
description: '
|
|
131
|
-
category: '
|
|
165
|
+
execute_3p_developer_tool: {
|
|
166
|
+
description: 'Executes a tool exposed by the page. (requires flag: --categoryExperimentalThirdParty=true)',
|
|
167
|
+
category: 'Third-party',
|
|
132
168
|
args: {
|
|
133
|
-
|
|
134
|
-
name: '
|
|
169
|
+
toolName: {
|
|
170
|
+
name: 'toolName',
|
|
135
171
|
type: 'string',
|
|
136
|
-
description: 'The
|
|
172
|
+
description: 'The name of the tool to execute',
|
|
137
173
|
required: true,
|
|
138
174
|
},
|
|
139
|
-
|
|
140
|
-
name: '
|
|
175
|
+
params: {
|
|
176
|
+
name: 'params',
|
|
141
177
|
type: 'string',
|
|
142
|
-
description: 'The
|
|
178
|
+
description: 'The JSON-stringified parameters to pass to the tool',
|
|
179
|
+
required: false,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
execute_webmcp_tool: {
|
|
184
|
+
description: 'Executes a WebMCP tool exposed by the page. (requires flag: --categoryExperimentalWebmcp=true)',
|
|
185
|
+
category: 'WebMCP',
|
|
186
|
+
args: {
|
|
187
|
+
toolName: {
|
|
188
|
+
name: 'toolName',
|
|
189
|
+
type: 'string',
|
|
190
|
+
description: 'The name of the WebMCP tool to execute',
|
|
143
191
|
required: true,
|
|
144
192
|
},
|
|
145
|
-
|
|
146
|
-
name: '
|
|
147
|
-
type: '
|
|
148
|
-
description: '
|
|
193
|
+
input: {
|
|
194
|
+
name: 'input',
|
|
195
|
+
type: 'string',
|
|
196
|
+
description: 'The JSON-stringified parameters to pass to the WebMCP tool',
|
|
149
197
|
required: false,
|
|
150
198
|
},
|
|
151
199
|
},
|
|
152
200
|
},
|
|
153
|
-
|
|
154
|
-
description: '
|
|
201
|
+
fill: {
|
|
202
|
+
description: 'Type text into an input, text area or select an option from a <select> element.',
|
|
155
203
|
category: 'Input automation',
|
|
156
204
|
args: {
|
|
157
|
-
|
|
158
|
-
name: '
|
|
159
|
-
type: '
|
|
160
|
-
description: '
|
|
205
|
+
uid: {
|
|
206
|
+
name: 'uid',
|
|
207
|
+
type: 'string',
|
|
208
|
+
description: 'The uid of an element on the page from the page content snapshot',
|
|
209
|
+
required: true,
|
|
210
|
+
},
|
|
211
|
+
value: {
|
|
212
|
+
name: 'value',
|
|
213
|
+
type: 'string',
|
|
214
|
+
description: 'The value to fill in',
|
|
161
215
|
required: true,
|
|
162
216
|
},
|
|
163
217
|
includeSnapshot: {
|
|
@@ -180,6 +234,30 @@ export const commands = {
|
|
|
180
234
|
},
|
|
181
235
|
},
|
|
182
236
|
},
|
|
237
|
+
get_memory_snapshot_details: {
|
|
238
|
+
description: 'Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates. (requires flag: --experimentalMemory=true)',
|
|
239
|
+
category: 'Memory',
|
|
240
|
+
args: {
|
|
241
|
+
filePath: {
|
|
242
|
+
name: 'filePath',
|
|
243
|
+
type: 'string',
|
|
244
|
+
description: 'A path to a .heapsnapshot file to read.',
|
|
245
|
+
required: true,
|
|
246
|
+
},
|
|
247
|
+
pageIdx: {
|
|
248
|
+
name: 'pageIdx',
|
|
249
|
+
type: 'number',
|
|
250
|
+
description: 'The page index for pagination of aggregates.',
|
|
251
|
+
required: false,
|
|
252
|
+
},
|
|
253
|
+
pageSize: {
|
|
254
|
+
name: 'pageSize',
|
|
255
|
+
type: 'number',
|
|
256
|
+
description: 'The page size for pagination of aggregates.',
|
|
257
|
+
required: false,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
183
261
|
get_network_request: {
|
|
184
262
|
description: 'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',
|
|
185
263
|
category: 'Network',
|
|
@@ -193,13 +271,43 @@ export const commands = {
|
|
|
193
271
|
requestFilePath: {
|
|
194
272
|
name: 'requestFilePath',
|
|
195
273
|
type: 'string',
|
|
196
|
-
description: 'The absolute or relative path to save the request body to. If omitted, the body is returned inline.',
|
|
274
|
+
description: 'The absolute or relative path to a .network-request file to save the request body to. If omitted, the body is returned inline.',
|
|
197
275
|
required: false,
|
|
198
276
|
},
|
|
199
277
|
responseFilePath: {
|
|
200
278
|
name: 'responseFilePath',
|
|
201
279
|
type: 'string',
|
|
202
|
-
description: 'The absolute or relative path to save the response body to. If omitted, the body is returned inline.',
|
|
280
|
+
description: 'The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.',
|
|
281
|
+
required: false,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
get_nodes_by_class: {
|
|
286
|
+
description: 'Loads a memory heapsnapshot and returns instances of a specific class with their stable IDs. (requires flag: --experimentalMemory=true)',
|
|
287
|
+
category: 'Memory',
|
|
288
|
+
args: {
|
|
289
|
+
filePath: {
|
|
290
|
+
name: 'filePath',
|
|
291
|
+
type: 'string',
|
|
292
|
+
description: 'A path to a .heapsnapshot file to read.',
|
|
293
|
+
required: true,
|
|
294
|
+
},
|
|
295
|
+
uid: {
|
|
296
|
+
name: 'uid',
|
|
297
|
+
type: 'number',
|
|
298
|
+
description: 'The unique UID for the class, obtained from aggregates listing.',
|
|
299
|
+
required: true,
|
|
300
|
+
},
|
|
301
|
+
pageIdx: {
|
|
302
|
+
name: 'pageIdx',
|
|
303
|
+
type: 'number',
|
|
304
|
+
description: 'The page index for pagination.',
|
|
305
|
+
required: false,
|
|
306
|
+
},
|
|
307
|
+
pageSize: {
|
|
308
|
+
name: 'pageSize',
|
|
309
|
+
type: 'number',
|
|
310
|
+
description: 'The page size for pagination.',
|
|
203
311
|
required: false,
|
|
204
312
|
},
|
|
205
313
|
},
|
|
@@ -241,8 +349,20 @@ export const commands = {
|
|
|
241
349
|
},
|
|
242
350
|
},
|
|
243
351
|
},
|
|
352
|
+
install_extension: {
|
|
353
|
+
description: 'Installs a Chrome extension from the given path. (requires flag: --categoryExtensions=true)',
|
|
354
|
+
category: 'Extensions',
|
|
355
|
+
args: {
|
|
356
|
+
path: {
|
|
357
|
+
name: 'path',
|
|
358
|
+
type: 'string',
|
|
359
|
+
description: 'Absolute path to the unpacked extension folder.',
|
|
360
|
+
required: true,
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
},
|
|
244
364
|
lighthouse_audit: {
|
|
245
|
-
description: 'Get Lighthouse score and reports for accessibility, SEO and
|
|
365
|
+
description: 'Get Lighthouse score and reports for accessibility, SEO, best practices, and agentic browsing. This excludes performance. For performance audits, run performance_start_trace',
|
|
246
366
|
category: 'Debugging',
|
|
247
367
|
args: {
|
|
248
368
|
mode: {
|
|
@@ -269,6 +389,11 @@ export const commands = {
|
|
|
269
389
|
},
|
|
270
390
|
},
|
|
271
391
|
},
|
|
392
|
+
list_3p_developer_tools: {
|
|
393
|
+
description: "Lists all third-party developer tools the page exposes for providing runtime information.\n Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.\n Alternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the\n following command to the script:\n 'window.__dtmcp.executeTool(toolName, params)'\n This might be helpful when the third-party developer tools return non-serializable values or when composing\n third-party developer tools with additional functionality. (requires flag: --categoryExperimentalThirdParty=true)",
|
|
394
|
+
category: 'Third-party',
|
|
395
|
+
args: {},
|
|
396
|
+
},
|
|
272
397
|
list_console_messages: {
|
|
273
398
|
description: 'List all console messages for the currently selected page since the last navigation.',
|
|
274
399
|
category: 'Debugging',
|
|
@@ -276,7 +401,7 @@ export const commands = {
|
|
|
276
401
|
pageSize: {
|
|
277
402
|
name: 'pageSize',
|
|
278
403
|
type: 'integer',
|
|
279
|
-
description: 'Maximum number of messages to return. When omitted, returns all
|
|
404
|
+
description: 'Maximum number of messages to return. When omitted, returns all messages.',
|
|
280
405
|
required: false,
|
|
281
406
|
},
|
|
282
407
|
pageIdx: {
|
|
@@ -300,6 +425,11 @@ export const commands = {
|
|
|
300
425
|
},
|
|
301
426
|
},
|
|
302
427
|
},
|
|
428
|
+
list_extensions: {
|
|
429
|
+
description: 'Lists all the Chrome extensions installed in the browser. This includes their name, ID, version, and enabled status. (requires flag: --categoryExtensions=true)',
|
|
430
|
+
category: 'Extensions',
|
|
431
|
+
args: {},
|
|
432
|
+
},
|
|
303
433
|
list_network_requests: {
|
|
304
434
|
description: 'List all requests for the currently selected page since the last navigation.',
|
|
305
435
|
category: 'Network',
|
|
@@ -332,10 +462,27 @@ export const commands = {
|
|
|
332
462
|
},
|
|
333
463
|
},
|
|
334
464
|
list_pages: {
|
|
335
|
-
description: 'Get a list of pages
|
|
465
|
+
description: 'Get a list of pages open in the browser.',
|
|
336
466
|
category: 'Navigation automation',
|
|
337
467
|
args: {},
|
|
338
468
|
},
|
|
469
|
+
list_webmcp_tools: {
|
|
470
|
+
description: 'Lists all WebMCP tools the page exposes. (requires flag: --categoryExperimentalWebmcp=true)',
|
|
471
|
+
category: 'WebMCP',
|
|
472
|
+
args: {},
|
|
473
|
+
},
|
|
474
|
+
load_memory_snapshot: {
|
|
475
|
+
description: 'Loads a memory heapsnapshot and returns snapshot summary stats. (requires flag: --experimentalMemory=true)',
|
|
476
|
+
category: 'Memory',
|
|
477
|
+
args: {
|
|
478
|
+
filePath: {
|
|
479
|
+
name: 'filePath',
|
|
480
|
+
type: 'string',
|
|
481
|
+
description: 'A path to a .heapsnapshot file to read.',
|
|
482
|
+
required: true,
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
},
|
|
339
486
|
navigate_page: {
|
|
340
487
|
description: 'Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.',
|
|
341
488
|
category: 'Navigation automation',
|
|
@@ -484,6 +631,18 @@ export const commands = {
|
|
|
484
631
|
},
|
|
485
632
|
},
|
|
486
633
|
},
|
|
634
|
+
reload_extension: {
|
|
635
|
+
description: 'Reloads an unpacked Chrome extension by its ID. (requires flag: --categoryExtensions=true)',
|
|
636
|
+
category: 'Extensions',
|
|
637
|
+
args: {
|
|
638
|
+
id: {
|
|
639
|
+
name: 'id',
|
|
640
|
+
type: 'string',
|
|
641
|
+
description: 'ID of the extension to reload.',
|
|
642
|
+
required: true,
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
},
|
|
487
646
|
resize_page: {
|
|
488
647
|
description: "Resizes the selected page's window so that the page has specified dimension",
|
|
489
648
|
category: 'Emulation',
|
|
@@ -502,6 +661,23 @@ export const commands = {
|
|
|
502
661
|
},
|
|
503
662
|
},
|
|
504
663
|
},
|
|
664
|
+
screencast_start: {
|
|
665
|
+
description: 'Starts recording a screencast (video) of the selected page in specified format. (requires flag: --experimentalScreencast=true)',
|
|
666
|
+
category: 'Debugging',
|
|
667
|
+
args: {
|
|
668
|
+
filePath: {
|
|
669
|
+
name: 'filePath',
|
|
670
|
+
type: 'string',
|
|
671
|
+
description: 'Output file path (.webm,.mp4 are supported). Uses mkdtemp to generate a unique path if not provided.',
|
|
672
|
+
required: false,
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
},
|
|
676
|
+
screencast_stop: {
|
|
677
|
+
description: 'Stops the active screencast recording on the selected page. (requires flag: --experimentalScreencast=true)',
|
|
678
|
+
category: 'Debugging',
|
|
679
|
+
args: {},
|
|
680
|
+
},
|
|
505
681
|
select_page: {
|
|
506
682
|
description: 'Select a page as a context for future tool calls.',
|
|
507
683
|
category: 'Navigation automation',
|
|
@@ -521,8 +697,8 @@ export const commands = {
|
|
|
521
697
|
},
|
|
522
698
|
},
|
|
523
699
|
take_memory_snapshot: {
|
|
524
|
-
description: 'Capture a
|
|
525
|
-
category: '
|
|
700
|
+
description: 'Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.',
|
|
701
|
+
category: 'Memory',
|
|
526
702
|
args: {
|
|
527
703
|
filePath: {
|
|
528
704
|
name: 'filePath',
|
|
@@ -553,7 +729,7 @@ export const commands = {
|
|
|
553
729
|
uid: {
|
|
554
730
|
name: 'uid',
|
|
555
731
|
type: 'string',
|
|
556
|
-
description: 'The uid of an element on the page from the page content snapshot. If omitted takes a
|
|
732
|
+
description: 'The uid of an element on the page from the page content snapshot. If omitted, takes a page screenshot.',
|
|
557
733
|
required: false,
|
|
558
734
|
},
|
|
559
735
|
fullPage: {
|
|
@@ -588,6 +764,18 @@ export const commands = {
|
|
|
588
764
|
},
|
|
589
765
|
},
|
|
590
766
|
},
|
|
767
|
+
trigger_extension_action: {
|
|
768
|
+
description: 'Triggers the default action of an extension by its ID. (requires flag: --categoryExtensions=true)',
|
|
769
|
+
category: 'Extensions',
|
|
770
|
+
args: {
|
|
771
|
+
id: {
|
|
772
|
+
name: 'id',
|
|
773
|
+
type: 'string',
|
|
774
|
+
description: 'ID of the extension to trigger the action for.',
|
|
775
|
+
required: true,
|
|
776
|
+
},
|
|
777
|
+
},
|
|
778
|
+
},
|
|
591
779
|
type_text: {
|
|
592
780
|
description: 'Type text using keyboard into a previously focused input',
|
|
593
781
|
category: 'Input automation',
|
|
@@ -606,6 +794,18 @@ export const commands = {
|
|
|
606
794
|
},
|
|
607
795
|
},
|
|
608
796
|
},
|
|
797
|
+
uninstall_extension: {
|
|
798
|
+
description: 'Uninstalls a Chrome extension by its ID. (requires flag: --categoryExtensions=true)',
|
|
799
|
+
category: 'Extensions',
|
|
800
|
+
args: {
|
|
801
|
+
id: {
|
|
802
|
+
name: 'id',
|
|
803
|
+
type: 'string',
|
|
804
|
+
description: 'ID of the extension to uninstall.',
|
|
805
|
+
required: true,
|
|
806
|
+
},
|
|
807
|
+
},
|
|
808
|
+
},
|
|
609
809
|
upload_file: {
|
|
610
810
|
description: 'Upload a file through a provided element.',
|
|
611
811
|
category: 'Input automation',
|
|
@@ -630,22 +830,5 @@ export const commands = {
|
|
|
630
830
|
},
|
|
631
831
|
},
|
|
632
832
|
},
|
|
633
|
-
wait_for: {
|
|
634
|
-
description: 'Wait for the specified text to appear on the selected page.',
|
|
635
|
-
category: 'Navigation automation',
|
|
636
|
-
args: {
|
|
637
|
-
text: {
|
|
638
|
-
name: 'text',
|
|
639
|
-
type: 'array',
|
|
640
|
-
description: 'Non-empty list of texts. Resolves when any value appears on the page.',
|
|
641
|
-
required: true,
|
|
642
|
-
},
|
|
643
|
-
timeout: {
|
|
644
|
-
name: 'timeout',
|
|
645
|
-
type: 'integer',
|
|
646
|
-
description: 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
|
|
647
|
-
required: false,
|
|
648
|
-
},
|
|
649
|
-
},
|
|
650
|
-
},
|
|
651
833
|
};
|
|
834
|
+
//# sourceMappingURL=chrome-devtools-cli-options.js.map
|
|
@@ -183,7 +183,7 @@ export const cliOptions = {
|
|
|
183
183
|
describe: 'Path to ffmpeg executable for screencast recording.',
|
|
184
184
|
implies: 'experimentalScreencast',
|
|
185
185
|
},
|
|
186
|
-
|
|
186
|
+
categoryExperimentalWebmcp: {
|
|
187
187
|
type: 'boolean',
|
|
188
188
|
describe: 'Set to true to enable debugging WebMCP tools. Requires Chrome 149+ with the following flags: `--enable-features=WebMCPTesting,DevToolsWebMCPSupport`',
|
|
189
189
|
},
|
|
@@ -216,10 +216,10 @@ export const cliOptions = {
|
|
|
216
216
|
default: false,
|
|
217
217
|
describe: 'Set to true to include tools related to extensions. Note: This feature is currently only supported with a pipe connection. autoConnect, browserUrl, and wsEndpoint are not supported with this feature until 149 will be released.',
|
|
218
218
|
},
|
|
219
|
-
|
|
219
|
+
categoryExperimentalThirdParty: {
|
|
220
220
|
type: 'boolean',
|
|
221
|
-
|
|
222
|
-
describe: 'Set to true to enable tools exposed by the inspected page itself',
|
|
221
|
+
default: false,
|
|
222
|
+
describe: 'Set to true to enable third-party developer tools exposed by the inspected page itself',
|
|
223
223
|
},
|
|
224
224
|
performanceCrux: {
|
|
225
225
|
type: 'boolean',
|
|
@@ -261,7 +261,7 @@ export const cliOptions = {
|
|
|
261
261
|
default: false,
|
|
262
262
|
},
|
|
263
263
|
};
|
|
264
|
-
export function parseArguments(version, argv = process.argv) {
|
|
264
|
+
export function parseArguments(version, argv = process.argv, env = process.env) {
|
|
265
265
|
const yargsInstance = yargs(hideBin(argv))
|
|
266
266
|
.scriptName('npx chrome-devtools-mcp@latest')
|
|
267
267
|
.options(cliOptions)
|
|
@@ -274,6 +274,10 @@ export function parseArguments(version, argv = process.argv) {
|
|
|
274
274
|
!args.executablePath) {
|
|
275
275
|
args.channel = 'stable';
|
|
276
276
|
}
|
|
277
|
+
if (env['CI'] || env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']) {
|
|
278
|
+
console.error("turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.");
|
|
279
|
+
args.usageStatistics = false;
|
|
280
|
+
}
|
|
277
281
|
return true;
|
|
278
282
|
})
|
|
279
283
|
.example([
|
|
@@ -344,3 +348,4 @@ export function parseArguments(version, argv = process.argv) {
|
|
|
344
348
|
.version(version)
|
|
345
349
|
.parseSync();
|
|
346
350
|
}
|
|
351
|
+
//# sourceMappingURL=chrome-devtools-mcp-cli-options.js.map
|
|
@@ -15,11 +15,6 @@ import { cliOptions, parseArguments } from './chrome-devtools-mcp-cli-options.js
|
|
|
15
15
|
await checkForUpdates('Run `npm install chrome-devtools-mcp@latest` to update.');
|
|
16
16
|
export const args = parseArguments(VERSION);
|
|
17
17
|
const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
|
|
18
|
-
if (process.env['CI'] ||
|
|
19
|
-
process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']) {
|
|
20
|
-
console.error("turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.");
|
|
21
|
-
args.usageStatistics = false;
|
|
22
|
-
}
|
|
23
18
|
if (process.env['CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT'] !== 'true') {
|
|
24
19
|
process.on('unhandledRejection', (reason, promise) => {
|
|
25
20
|
logger('Unhandled promise rejection', promise, reason);
|
|
@@ -35,3 +30,4 @@ logger('Chrome DevTools MCP Server connected');
|
|
|
35
30
|
logDisclaimers(args);
|
|
36
31
|
void clearcutLogger?.logDailyActiveIfNeeded();
|
|
37
32
|
void clearcutLogger?.logServerStart(computeFlagUsage(args, cliOptions));
|
|
33
|
+
//# sourceMappingURL=chrome-devtools-mcp-main.js.map
|
|
@@ -28,20 +28,10 @@ const startCliOptions = {
|
|
|
28
28
|
delete startCliOptions.autoConnect;
|
|
29
29
|
// Missing CLI serialization.
|
|
30
30
|
delete startCliOptions.viewport;
|
|
31
|
-
//
|
|
32
|
-
// tools, they need to be enabled during CLI generation.
|
|
33
|
-
delete startCliOptions.experimentalPageIdRouting;
|
|
34
|
-
delete startCliOptions.experimentalVision;
|
|
35
|
-
delete startCliOptions.experimentalWebmcp;
|
|
36
|
-
delete startCliOptions.experimentalInteropTools;
|
|
37
|
-
delete startCliOptions.experimentalScreencast;
|
|
38
|
-
delete startCliOptions.categoryEmulation;
|
|
39
|
-
delete startCliOptions.categoryPerformance;
|
|
40
|
-
delete startCliOptions.categoryNetwork;
|
|
41
|
-
delete startCliOptions.categoryExtensions;
|
|
42
|
-
// Always on in CLI.
|
|
31
|
+
// Change the defaults for the CLI.
|
|
43
32
|
delete startCliOptions.experimentalStructuredContent;
|
|
44
|
-
|
|
33
|
+
delete startCliOptions.experimentalInteropTools;
|
|
34
|
+
delete startCliOptions.experimentalPageIdRouting;
|
|
45
35
|
if (!('default' in cliOptions.headless)) {
|
|
46
36
|
throw new Error('headless cli option unexpectedly does not have a default');
|
|
47
37
|
}
|
|
@@ -51,6 +41,7 @@ if ('default' in cliOptions.isolated) {
|
|
|
51
41
|
startCliOptions.headless.default = true;
|
|
52
42
|
startCliOptions.isolated.description =
|
|
53
43
|
'If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. Defaults to true unless userDataDir is provided.';
|
|
44
|
+
startCliOptions.categoryExtensions.default = true;
|
|
54
45
|
const y = yargs(hideBin(process.argv))
|
|
55
46
|
.scriptName('chrome-devtools')
|
|
56
47
|
.showHelpOnFail(true)
|
|
@@ -197,3 +188,4 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
|
|
|
197
188
|
});
|
|
198
189
|
}
|
|
199
190
|
await y.parse();
|
|
191
|
+
//# sourceMappingURL=chrome-devtools.js.map
|
package/build/src/browser.js
CHANGED
|
@@ -8,7 +8,7 @@ import fs from 'node:fs';
|
|
|
8
8
|
import net from 'node:net';
|
|
9
9
|
import { logger } from '../logger.js';
|
|
10
10
|
import { PipeTransport } from '../third_party/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { getTempFilePath } from '../utils/files.js';
|
|
12
12
|
import { DAEMON_SCRIPT_PATH, getSocketPath, getPidFilePath, isDaemonRunning, } from './utils.js';
|
|
13
13
|
const FILE_TIMEOUT = 10_000;
|
|
14
14
|
/**
|
|
@@ -141,7 +141,8 @@ export async function handleResponse(response, format) {
|
|
|
141
141
|
}
|
|
142
142
|
const data = Buffer.from(imageData, 'base64');
|
|
143
143
|
const name = crypto.randomUUID();
|
|
144
|
-
const
|
|
144
|
+
const filepath = await getTempFilePath(`${name}${extension}`);
|
|
145
|
+
fs.writeFileSync(filepath, data);
|
|
145
146
|
chunks.push(`Saved to ${filepath}.`);
|
|
146
147
|
}
|
|
147
148
|
else {
|
|
@@ -150,3 +151,4 @@ export async function handleResponse(response, format) {
|
|
|
150
151
|
}
|
|
151
152
|
return format === 'md' ? chunks.join(' ') : JSON.stringify(chunks);
|
|
152
153
|
}
|
|
154
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -131,6 +131,36 @@ export class ConsoleFormatter {
|
|
|
131
131
|
id: this.#id,
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Groups consecutive messages with the same type, text, and argument count.
|
|
136
|
+
* Similar to Chrome DevTools' console grouping behavior.
|
|
137
|
+
*/
|
|
138
|
+
static groupConsecutive(messages) {
|
|
139
|
+
const grouped = [];
|
|
140
|
+
for (const msg of messages) {
|
|
141
|
+
const prev = grouped[grouped.length - 1];
|
|
142
|
+
if (prev &&
|
|
143
|
+
prev.message instanceof ConsoleFormatter &&
|
|
144
|
+
msg instanceof ConsoleFormatter &&
|
|
145
|
+
prev.message.#type === msg.#type &&
|
|
146
|
+
prev.message.#text === msg.#text &&
|
|
147
|
+
prev.message.#argCount === msg.#argCount) {
|
|
148
|
+
prev.count++;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
grouped.push({ message: msg, count: 1 });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return grouped.map(({ message, count }) => count > 1 && message instanceof ConsoleFormatter
|
|
155
|
+
? new GroupedConsoleFormatter({
|
|
156
|
+
id: message.#id,
|
|
157
|
+
type: message.#type,
|
|
158
|
+
text: message.#text,
|
|
159
|
+
argCount: message.#argCount,
|
|
160
|
+
isIgnored: message.isIgnored,
|
|
161
|
+
}, count)
|
|
162
|
+
: message);
|
|
163
|
+
}
|
|
134
164
|
toJSONDetailed() {
|
|
135
165
|
return {
|
|
136
166
|
id: this.#id,
|
|
@@ -144,8 +174,24 @@ export class ConsoleFormatter {
|
|
|
144
174
|
};
|
|
145
175
|
}
|
|
146
176
|
}
|
|
177
|
+
export class GroupedConsoleFormatter extends ConsoleFormatter {
|
|
178
|
+
#count;
|
|
179
|
+
constructor(params, count) {
|
|
180
|
+
super(params);
|
|
181
|
+
this.#count = count;
|
|
182
|
+
}
|
|
183
|
+
toString() {
|
|
184
|
+
return convertConsoleMessageConciseToString(this.toJSON());
|
|
185
|
+
}
|
|
186
|
+
toJSON() {
|
|
187
|
+
const json = super.toJSON();
|
|
188
|
+
json.count = this.#count;
|
|
189
|
+
return json;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
147
192
|
function convertConsoleMessageConciseToString(msg) {
|
|
148
|
-
|
|
193
|
+
const countSuffix = msg.count && msg.count > 1 ? ` [${msg.count} times]` : '';
|
|
194
|
+
return `msgid=${msg.id} [${msg.type}] ${msg.text} (${msg.argsCount} args)${countSuffix}`;
|
|
149
195
|
}
|
|
150
196
|
function convertConsoleMessageConciseDetailedToString(msg) {
|
|
151
197
|
const result = [
|
|
@@ -239,3 +285,4 @@ function formatCause(cause, formatter) {
|
|
|
239
285
|
...formatStackTraceInner(cause.stackTrace, cause.cause, formatter),
|
|
240
286
|
];
|
|
241
287
|
}
|
|
288
|
+
//# sourceMappingURL=ConsoleFormatter.js.map
|
|
@@ -4,13 +4,28 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { stableIdSymbol } from '../utils/id.js';
|
|
7
|
+
export function isNodeLike(item) {
|
|
8
|
+
return (typeof item === 'object' && item !== null && 'id' in item && 'name' in item);
|
|
9
|
+
}
|
|
7
10
|
export class HeapSnapshotFormatter {
|
|
8
11
|
#aggregates;
|
|
9
12
|
constructor(aggregates) {
|
|
10
13
|
this.#aggregates = aggregates;
|
|
11
14
|
}
|
|
15
|
+
static formatNodes(items) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
if (items.length > 0 && isNodeLike(items[0])) {
|
|
18
|
+
lines.push('id,name,type,distance,selfSize,retainedSize');
|
|
19
|
+
}
|
|
20
|
+
for (const item of items) {
|
|
21
|
+
if (isNodeLike(item)) {
|
|
22
|
+
lines.push(`${item.id},"${item.name}",${item.type},${item.distance},${item.selfSize},${item.retainedSize}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return lines.join('\n');
|
|
26
|
+
}
|
|
12
27
|
#getSortedAggregates() {
|
|
13
|
-
return Object.values(this.#aggregates).sort((a, b) => b.
|
|
28
|
+
return Object.values(this.#aggregates).sort((a, b) => b.maxRet - a.maxRet);
|
|
14
29
|
}
|
|
15
30
|
toString() {
|
|
16
31
|
const sorted = this.#getSortedAggregates();
|
|
@@ -33,6 +48,7 @@ export class HeapSnapshotFormatter {
|
|
|
33
48
|
}));
|
|
34
49
|
}
|
|
35
50
|
static sort(aggregates) {
|
|
36
|
-
return Object.entries(aggregates).sort((a, b) => b[1].
|
|
51
|
+
return Object.entries(aggregates).sort((a, b) => b[1].maxRet - a[1].maxRet);
|
|
37
52
|
}
|
|
38
53
|
}
|
|
54
|
+
//# sourceMappingURL=HeapSnapshotFormatter.js.map
|