@mcp-b/chrome-devtools-mcp 2.3.1 → 3.0.0-beta.20260529000441

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.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/build/src/DevToolsConnectionAdapter.js +0 -70
  3. package/build/src/DevtoolsUtils.js +0 -290
  4. package/build/src/McpContext.js +0 -687
  5. package/build/src/McpPage.js +0 -95
  6. package/build/src/McpResponse.js +0 -588
  7. package/build/src/Mutex.js +0 -37
  8. package/build/src/PageCollector.js +0 -308
  9. package/build/src/SlimMcpResponse.js +0 -18
  10. package/build/src/WaitForHelper.js +0 -135
  11. package/build/src/bin/chrome-devtools-cli-options.js +0 -651
  12. package/build/src/bin/chrome-devtools-mcp-cli-options.js +0 -317
  13. package/build/src/bin/chrome-devtools-mcp-main.js +0 -35
  14. package/build/src/bin/chrome-devtools-mcp.js +0 -21
  15. package/build/src/bin/chrome-devtools.js +0 -185
  16. package/build/src/bin/cliDefinitions.js +0 -615
  17. package/build/src/browser.js +0 -198
  18. package/build/src/daemon/client.js +0 -152
  19. package/build/src/daemon/daemon.js +0 -206
  20. package/build/src/daemon/types.js +0 -6
  21. package/build/src/daemon/utils.js +0 -108
  22. package/build/src/formatters/ConsoleFormatter.js +0 -234
  23. package/build/src/formatters/IssueFormatter.js +0 -192
  24. package/build/src/formatters/NetworkFormatter.js +0 -215
  25. package/build/src/formatters/SnapshotFormatter.js +0 -131
  26. package/build/src/index.js +0 -202
  27. package/build/src/issue-descriptions.js +0 -39
  28. package/build/src/logger.js +0 -36
  29. package/build/src/polyfill.js +0 -7
  30. package/build/src/telemetry/ClearcutLogger.js +0 -102
  31. package/build/src/telemetry/WatchdogClient.js +0 -60
  32. package/build/src/telemetry/flagUtils.js +0 -45
  33. package/build/src/telemetry/metricUtils.js +0 -14
  34. package/build/src/telemetry/persistence.js +0 -53
  35. package/build/src/telemetry/types.js +0 -33
  36. package/build/src/telemetry/watchdog/ClearcutSender.js +0 -203
  37. package/build/src/telemetry/watchdog/main.js +0 -127
  38. package/build/src/third_party/devtools-formatter-worker.js +0 -7
  39. package/build/src/third_party/index.js +0 -26
  40. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +0 -54183
  41. package/build/src/tools/ToolDefinition.js +0 -72
  42. package/build/src/tools/categories.js +0 -24
  43. package/build/src/tools/console.js +0 -85
  44. package/build/src/tools/emulation.js +0 -55
  45. package/build/src/tools/extensions.js +0 -96
  46. package/build/src/tools/input.js +0 -368
  47. package/build/src/tools/lighthouse.js +0 -123
  48. package/build/src/tools/memory.js +0 -28
  49. package/build/src/tools/network.js +0 -120
  50. package/build/src/tools/pages.js +0 -319
  51. package/build/src/tools/performance.js +0 -190
  52. package/build/src/tools/screencast.js +0 -79
  53. package/build/src/tools/screenshot.js +0 -84
  54. package/build/src/tools/script.js +0 -119
  55. package/build/src/tools/slim/tools.js +0 -81
  56. package/build/src/tools/snapshot.js +0 -56
  57. package/build/src/tools/tools.js +0 -52
  58. package/build/src/tools/webmcp.js +0 -416
  59. package/build/src/trace-processing/parse.js +0 -84
  60. package/build/src/types.js +0 -6
  61. package/build/src/utils/ExtensionRegistry.js +0 -35
  62. package/build/src/utils/files.js +0 -19
  63. package/build/src/utils/keyboard.js +0 -296
  64. package/build/src/utils/pagination.js +0 -49
  65. package/build/src/utils/string.js +0 -36
  66. package/build/src/utils/types.js +0 -6
  67. package/build/src/version.js +0 -9
@@ -1,72 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { zod } from '../third_party/index.js';
7
- export function defineTool(definition) {
8
- if (typeof definition === 'function') {
9
- const factory = definition;
10
- return (args) => {
11
- return factory(args);
12
- };
13
- }
14
- return definition;
15
- }
16
- export function definePageTool(definition) {
17
- if (typeof definition === 'function') {
18
- return (args) => {
19
- const tool = definition(args);
20
- return {
21
- ...tool,
22
- pageScoped: true,
23
- };
24
- };
25
- }
26
- return {
27
- ...definition,
28
- pageScoped: true,
29
- };
30
- }
31
- export const CLOSE_PAGE_ERROR = 'The last open page cannot be closed. It is fine to keep it open.';
32
- export const pageIdSchema = {
33
- pageId: zod.number().optional().describe('Targets a specific page by ID.'),
34
- };
35
- export const timeoutSchema = {
36
- timeout: zod
37
- .number()
38
- .int()
39
- .optional()
40
- .describe(`Maximum wait time in milliseconds. If set to 0, the default timeout will be used.`)
41
- .transform((value) => {
42
- return value && value <= 0 ? undefined : value;
43
- }),
44
- };
45
- export function viewportTransform(arg) {
46
- if (!arg) {
47
- return undefined;
48
- }
49
- const [dimensions, ...tags] = arg.split(',');
50
- const isMobile = tags.includes('mobile');
51
- const hasTouch = tags.includes('touch');
52
- const isLandscape = tags.includes('landscape');
53
- const [width, height, dpr] = dimensions.split('x').map(Number);
54
- return {
55
- width,
56
- height,
57
- deviceScaleFactor: dpr,
58
- isMobile: isMobile,
59
- isLandscape: isLandscape,
60
- hasTouch: hasTouch,
61
- };
62
- }
63
- export function geolocationTransform(arg) {
64
- if (!arg) {
65
- return undefined;
66
- }
67
- const [latitude, longitude] = arg.split('x').map(Number);
68
- return {
69
- latitude,
70
- longitude,
71
- };
72
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export var ToolCategory;
7
- (function (ToolCategory) {
8
- ToolCategory["INPUT"] = "input";
9
- ToolCategory["NAVIGATION"] = "navigation";
10
- ToolCategory["EMULATION"] = "emulation";
11
- ToolCategory["PERFORMANCE"] = "performance";
12
- ToolCategory["NETWORK"] = "network";
13
- ToolCategory["DEBUGGING"] = "debugging";
14
- ToolCategory["EXTENSIONS"] = "extensions";
15
- })(ToolCategory || (ToolCategory = {}));
16
- export const labels = {
17
- [ToolCategory.INPUT]: 'Input automation',
18
- [ToolCategory.NAVIGATION]: 'Navigation automation',
19
- [ToolCategory.EMULATION]: 'Emulation',
20
- [ToolCategory.PERFORMANCE]: 'Performance',
21
- [ToolCategory.NETWORK]: 'Network',
22
- [ToolCategory.DEBUGGING]: 'Debugging',
23
- [ToolCategory.EXTENSIONS]: 'Extensions',
24
- };
@@ -1,85 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { zod } from '../third_party/index.js';
7
- import { ToolCategory } from './categories.js';
8
- import { definePageTool } from './ToolDefinition.js';
9
- const FILTERABLE_MESSAGE_TYPES = [
10
- 'log',
11
- 'debug',
12
- 'info',
13
- 'error',
14
- 'warn',
15
- 'dir',
16
- 'dirxml',
17
- 'table',
18
- 'trace',
19
- 'clear',
20
- 'startGroup',
21
- 'startGroupCollapsed',
22
- 'endGroup',
23
- 'assert',
24
- 'profile',
25
- 'profileEnd',
26
- 'count',
27
- 'timeEnd',
28
- 'verbose',
29
- 'issue',
30
- ];
31
- export const listConsoleMessages = definePageTool({
32
- name: 'list_console_messages',
33
- description: 'List all console messages for the currently selected page since the last navigation.',
34
- annotations: {
35
- category: ToolCategory.DEBUGGING,
36
- readOnlyHint: true,
37
- },
38
- schema: {
39
- pageSize: zod
40
- .number()
41
- .int()
42
- .positive()
43
- .optional()
44
- .describe('Maximum number of messages to return. When omitted, returns all requests.'),
45
- pageIdx: zod
46
- .number()
47
- .int()
48
- .min(0)
49
- .optional()
50
- .describe('Page number to return (0-based). When omitted, returns the first page.'),
51
- types: zod
52
- .array(zod.enum(FILTERABLE_MESSAGE_TYPES))
53
- .optional()
54
- .describe('Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.'),
55
- includePreservedMessages: zod
56
- .boolean()
57
- .default(false)
58
- .optional()
59
- .describe('Set to true to return the preserved messages over the last 3 navigations.'),
60
- },
61
- handler: async (request, response) => {
62
- response.setIncludeConsoleData(true, {
63
- pageSize: request.params.pageSize,
64
- pageIdx: request.params.pageIdx,
65
- types: request.params.types,
66
- includePreservedMessages: request.params.includePreservedMessages,
67
- });
68
- },
69
- });
70
- export const getConsoleMessage = definePageTool({
71
- name: 'get_console_message',
72
- description: `Gets a console message by its ID. You can get all messages by calling ${listConsoleMessages.name}.`,
73
- annotations: {
74
- category: ToolCategory.DEBUGGING,
75
- readOnlyHint: true,
76
- },
77
- schema: {
78
- msgid: zod
79
- .number()
80
- .describe('The msgid of a console message on the page from the listed console messages'),
81
- },
82
- handler: async (request, response) => {
83
- response.attachConsoleMessage(request.params.msgid);
84
- },
85
- });
@@ -1,55 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- *
6
- */
7
- import { zod, PredefinedNetworkConditions } from '../third_party/index.js';
8
- import { ToolCategory } from './categories.js';
9
- import { definePageTool, geolocationTransform, viewportTransform } from './ToolDefinition.js';
10
- const throttlingOptions = [
11
- 'Offline',
12
- ...Object.keys(PredefinedNetworkConditions),
13
- ];
14
- export const emulate = definePageTool({
15
- name: 'emulate',
16
- description: `Emulates various features on the selected page.`,
17
- annotations: {
18
- category: ToolCategory.EMULATION,
19
- readOnlyHint: false,
20
- },
21
- schema: {
22
- networkConditions: zod
23
- .enum(throttlingOptions)
24
- .optional()
25
- .describe(`Throttle network. Omit to disable throttling.`),
26
- cpuThrottlingRate: zod
27
- .number()
28
- .min(1)
29
- .max(20)
30
- .optional()
31
- .describe('Represents the CPU slowdown factor. Omit or set the rate to 1 to disable throttling'),
32
- geolocation: zod
33
- .string()
34
- .optional()
35
- .transform(geolocationTransform)
36
- .describe('Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.'),
37
- userAgent: zod
38
- .string()
39
- .optional()
40
- .describe('User agent to emulate. Set to empty string to clear the user agent override.'),
41
- colorScheme: zod
42
- .enum(['dark', 'light', 'auto'])
43
- .optional()
44
- .describe('Emulate the dark or the light mode. Set to "auto" to reset to the default.'),
45
- viewport: zod
46
- .string()
47
- .optional()
48
- .transform(viewportTransform)
49
- .describe(`Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.`),
50
- },
51
- handler: async (request, _response, context) => {
52
- const page = request.page;
53
- await context.emulate(request.params, page.pptrPage);
54
- },
55
- });
@@ -1,96 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2026 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { zod } from '../third_party/index.js';
7
- import { ToolCategory } from './categories.js';
8
- import { defineTool } from './ToolDefinition.js';
9
- const EXTENSIONS_CONDITION = 'experimentalExtensionSupport';
10
- export const installExtension = defineTool({
11
- name: 'install_extension',
12
- description: 'Installs a Chrome extension from the given path.',
13
- annotations: {
14
- category: ToolCategory.EXTENSIONS,
15
- readOnlyHint: false,
16
- conditions: [EXTENSIONS_CONDITION],
17
- },
18
- schema: {
19
- path: zod
20
- .string()
21
- .describe('Absolute path to the unpacked extension folder.'),
22
- },
23
- handler: async (request, response, context) => {
24
- const { path } = request.params;
25
- const id = await context.installExtension(path);
26
- response.appendResponseLine(`Extension installed. Id: ${id}`);
27
- },
28
- });
29
- export const uninstallExtension = defineTool({
30
- name: 'uninstall_extension',
31
- description: 'Uninstalls a Chrome extension by its ID.',
32
- annotations: {
33
- category: ToolCategory.EXTENSIONS,
34
- readOnlyHint: false,
35
- conditions: [EXTENSIONS_CONDITION],
36
- },
37
- schema: {
38
- id: zod.string().describe('ID of the extension to uninstall.'),
39
- },
40
- handler: async (request, response, context) => {
41
- const { id } = request.params;
42
- await context.uninstallExtension(id);
43
- response.appendResponseLine(`Extension uninstalled. Id: ${id}`);
44
- },
45
- });
46
- export const listExtensions = defineTool({
47
- name: 'list_extensions',
48
- description: 'Lists all extensions via this server, including their name, ID, version, and enabled status.',
49
- annotations: {
50
- category: ToolCategory.EXTENSIONS,
51
- readOnlyHint: true,
52
- conditions: [EXTENSIONS_CONDITION],
53
- },
54
- schema: {},
55
- handler: async (_request, response, _context) => {
56
- response.setListExtensions();
57
- },
58
- });
59
- export const reloadExtension = defineTool({
60
- name: 'reload_extension',
61
- description: 'Reloads an unpacked Chrome extension by its ID.',
62
- annotations: {
63
- category: ToolCategory.EXTENSIONS,
64
- readOnlyHint: false,
65
- conditions: [EXTENSIONS_CONDITION],
66
- },
67
- schema: {
68
- id: zod.string().describe('ID of the extension to reload.'),
69
- },
70
- handler: async (request, response, context) => {
71
- const { id } = request.params;
72
- const extension = context.getExtension(id);
73
- if (!extension) {
74
- throw new Error(`Extension with ID ${id} not found.`);
75
- }
76
- await context.installExtension(extension.path);
77
- response.appendResponseLine('Extension reloaded.');
78
- },
79
- });
80
- export const triggerExtensionAction = defineTool({
81
- name: 'trigger_extension_action',
82
- description: 'Triggers an action in a Chrome extension.',
83
- annotations: {
84
- category: ToolCategory.EXTENSIONS,
85
- readOnlyHint: false,
86
- conditions: [EXTENSIONS_CONDITION],
87
- },
88
- schema: {
89
- id: zod.string().describe('ID of the extension.'),
90
- },
91
- handler: async (request, response, context) => {
92
- const { id } = request.params;
93
- await context.triggerExtensionAction(id);
94
- response.appendResponseLine(`Extension action triggered. Id: ${id}`);
95
- },
96
- });