chrome-devtools-mcp 1.9.0 → 1.10.1

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 (64) hide show
  1. package/build/src/BrowserManager.js +401 -0
  2. package/build/src/McpContext.js +5 -5
  3. package/build/src/McpPage.js +107 -3
  4. package/build/src/McpResponse.js +68 -3
  5. package/build/src/ToolHandler.js +172 -118
  6. package/build/src/bin/chrome-devtools-mcp-main.js +11 -6
  7. package/build/src/bin/chrome-devtools.js +6 -12
  8. package/build/src/collectors/PageCollector.js +66 -3
  9. package/build/src/config/browser-options.js +2 -0
  10. package/build/src/config/category-options.js +13 -4
  11. package/build/src/config/cli-commands.js +26 -0
  12. package/build/src/config/cli-options.js +32 -0
  13. package/build/src/config/mcp-options.js +40 -1
  14. package/build/src/devtools/DevToolsCommentBridge.js +91 -0
  15. package/build/src/formatters/CommentFormatter.js +82 -0
  16. package/build/src/formatters/CssFormatter.js +812 -0
  17. package/build/src/index.js +53 -72
  18. package/build/src/processors/ChunkedTraceParser.js +361 -0
  19. package/build/src/processors/PerformanceTrace.js +60 -13
  20. package/build/src/telemetry/ClearcutLogger.js +91 -34
  21. package/build/src/telemetry/metricsRegistry.js +3 -0
  22. package/build/src/telemetry/persistence.js +17 -7
  23. package/build/src/telemetry/transformation.js +53 -4
  24. package/build/src/telemetry/types.js +1 -0
  25. package/build/src/third_party/THIRD_PARTY_NOTICES +715 -131
  26. package/build/src/third_party/bundled-packages.json +6 -3
  27. package/build/src/third_party/devtools-formatter-worker.js +136 -5
  28. package/build/src/third_party/devtools-heap-snapshot-worker.js +567 -6
  29. package/build/src/third_party/index.js +54948 -35497
  30. package/build/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
  31. package/build/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  32. package/build/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  33. package/build/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
  34. package/build/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
  35. package/build/src/tools/ToolDefinition.js +13 -21
  36. package/build/src/tools/comments.js +169 -0
  37. package/build/src/tools/console.js +3 -3
  38. package/build/src/tools/css.js +45 -0
  39. package/build/src/tools/emulation.js +5 -5
  40. package/build/src/tools/extensions.js +10 -10
  41. package/build/src/tools/input.js +159 -87
  42. package/build/src/tools/lighthouse.js +18 -7
  43. package/build/src/tools/memory.js +26 -26
  44. package/build/src/tools/network.js +4 -4
  45. package/build/src/tools/pages.js +14 -14
  46. package/build/src/tools/performance.js +6 -6
  47. package/build/src/tools/pwa.js +8 -8
  48. package/build/src/tools/screencast.js +4 -4
  49. package/build/src/tools/screenshot.js +2 -2
  50. package/build/src/tools/script.js +7 -7
  51. package/build/src/tools/slim/tools.js +5 -5
  52. package/build/src/tools/snapshot.js +4 -4
  53. package/build/src/tools/thirdPartyDeveloper.js +4 -4
  54. package/build/src/tools/tools.js +6 -9
  55. package/build/src/tools/webmcp.js +4 -4
  56. package/build/src/types.js +4 -1
  57. package/build/src/utils/WaitForHelper.js +14 -8
  58. package/build/src/utils/logger.js +7 -6
  59. package/build/src/version.js +1 -1
  60. package/package.json +8 -5
  61. package/skills/chrome-devtools/SKILL.md +2 -1
  62. package/skills/chrome-devtools-cli/SKILL.md +2 -0
  63. package/build/src/browser.js +0 -233
  64. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
@@ -8,7 +8,7 @@ import { logger } from '../utils/logger.js';
8
8
  import { validateUrl } from '../utils/url.js';
9
9
  import { ToolCategory } from './categories.js';
10
10
  import { CLOSE_PAGE_ERROR, definePageTool, defineTool, timeoutSchema, } from './ToolDefinition.js';
11
- export const listPages = defineTool(args => {
11
+ export const listPages = defineTool((args) => {
12
12
  return {
13
13
  name: 'list_pages',
14
14
  description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,
@@ -26,7 +26,7 @@ export const listPages = defineTool(args => {
26
26
  },
27
27
  };
28
28
  });
29
- export const selectPage = defineTool({
29
+ export const selectPage = defineTool((args) => ({
30
30
  name: 'select_page',
31
31
  description: `Select a page as a context for future tool calls.`,
32
32
  annotations: {
@@ -36,7 +36,7 @@ export const selectPage = defineTool({
36
36
  schema: {
37
37
  pageId: zod
38
38
  .number()
39
- .describe(`The ID of the page to select. Call ${listPages().name} to get available pages.`),
39
+ .describe(`The ID of the page to select. Call ${listPages(args).name} to get available pages.`),
40
40
  bringToFront: zod
41
41
  .boolean()
42
42
  .optional()
@@ -54,8 +54,8 @@ export const selectPage = defineTool({
54
54
  await page.pptrPage.bringToFront();
55
55
  }
56
56
  },
57
- });
58
- export const closePage = defineTool({
57
+ }));
58
+ export const closePage = defineTool(() => ({
59
59
  name: 'close_page',
60
60
  description: `Closes the page by its index. The last open page cannot be closed.`,
61
61
  annotations: {
@@ -84,8 +84,8 @@ export const closePage = defineTool({
84
84
  response.setIncludePages(true);
85
85
  response.setListThirdPartyDeveloperTools();
86
86
  },
87
- });
88
- export const newPage = defineTool(args => {
87
+ }));
88
+ export const newPage = defineTool((args) => {
89
89
  return {
90
90
  name: 'new_page',
91
91
  description: `Open a new tab and load a URL. Use project URL if not specified otherwise.`,
@@ -125,7 +125,7 @@ export const newPage = defineTool(args => {
125
125
  },
126
126
  };
127
127
  });
128
- export const navigatePage = definePageTool(args => {
128
+ export const navigatePage = definePageTool((args) => {
129
129
  return {
130
130
  name: 'navigate_page',
131
131
  description: `Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.`,
@@ -252,7 +252,7 @@ export const navigatePage = definePageTool(args => {
252
252
  },
253
253
  };
254
254
  });
255
- export const resizePage = definePageTool({
255
+ export const resizePage = definePageTool(() => ({
256
256
  name: 'resize_page',
257
257
  description: `Resizes the page's window so that the page has specified dimension`,
258
258
  annotations: {
@@ -289,8 +289,8 @@ export const resizePage = definePageTool({
289
289
  });
290
290
  response.setIncludePages(true);
291
291
  },
292
- });
293
- export const handleDialog = definePageTool({
292
+ }));
293
+ export const handleDialog = definePageTool(() => ({
294
294
  name: 'handle_dialog',
295
295
  description: `If a browser dialog was opened, use this command to handle it`,
296
296
  annotations: {
@@ -341,8 +341,8 @@ export const handleDialog = definePageTool({
341
341
  page.clearDialog();
342
342
  response.setIncludePages(true);
343
343
  },
344
- });
345
- export const getTabId = definePageTool({
344
+ }));
345
+ export const getTabId = definePageTool(() => ({
346
346
  name: 'get_tab_id',
347
347
  description: `Get the tab ID of the page`,
348
348
  annotations: {
@@ -359,5 +359,5 @@ export const getTabId = definePageTool({
359
359
  response.setTabId(tabId);
360
360
  response.appendResponseLine(`Tab ID: ${tabId}`);
361
361
  },
362
- });
362
+ }));
363
363
  //# sourceMappingURL=pages.js.map
@@ -13,7 +13,7 @@ const filePathSchema = zod
13
13
  .string()
14
14
  .optional()
15
15
  .describe('The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).');
16
- export const startTrace = definePageTool({
16
+ export const startTrace = definePageTool(() => ({
17
17
  name: 'performance_start_trace',
18
18
  description: `Start a performance trace on the target webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.`,
19
19
  annotations: {
@@ -94,8 +94,8 @@ export const startTrace = definePageTool({
94
94
  throw error;
95
95
  }
96
96
  },
97
- });
98
- export const stopTrace = definePageTool({
97
+ }));
98
+ export const stopTrace = definePageTool(() => ({
99
99
  name: 'performance_stop_trace',
100
100
  description: 'Stop the active performance trace recording on the target webpage.',
101
101
  annotations: {
@@ -116,8 +116,8 @@ export const stopTrace = definePageTool({
116
116
  const page = request.page;
117
117
  await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
118
118
  },
119
- });
120
- export const analyzeInsight = definePageTool({
119
+ }));
120
+ export const analyzeInsight = definePageTool(() => ({
121
121
  name: 'performance_analyze_insight',
122
122
  description: 'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
123
123
  annotations: {
@@ -142,7 +142,7 @@ export const analyzeInsight = definePageTool({
142
142
  }
143
143
  response.attachTraceInsight(lastRecording, request.params.insightSetId, request.params.insightName);
144
144
  },
145
- });
145
+ }));
146
146
  async function stopTracingAndAppendOutput(page, response, context, filePath) {
147
147
  try {
148
148
  const traceEventsBuffer = await page.pptrPage.tracing.stop();
@@ -19,7 +19,7 @@ const displayModeSchema = zod
19
19
  'tab. Installs via the PWA CDP domain default to "browser" because they ' +
20
20
  'do not simulate the install dialog, so pass "standalone" to get an ' +
21
21
  'app-window experience.');
22
- export const installPwa = defineTool({
22
+ export const installPwa = defineTool(() => ({
23
23
  name: 'install_pwa',
24
24
  description: 'Installs a Progressive Web App (PWA) identified by its manifest ID. ' +
25
25
  'This installs through the PWA CDP domain without a user gesture or install ' +
@@ -58,8 +58,8 @@ export const installPwa = defineTool({
58
58
  response.appendResponseLine(`Display mode set to: ${displayMode}`);
59
59
  }
60
60
  },
61
- });
62
- export const uninstallPwa = defineTool({
61
+ }));
62
+ export const uninstallPwa = defineTool(() => ({
63
63
  name: 'uninstall_pwa',
64
64
  description: 'Uninstalls a Progressive Web App identified by its manifest ID and ' +
65
65
  'closes any open app windows.',
@@ -78,8 +78,8 @@ export const uninstallPwa = defineTool({
78
78
  response.appendResponseLine(`Uninstalled PWA with manifest ID: ${manifestId}`);
79
79
  response.setIncludePages(true);
80
80
  },
81
- });
82
- export const launchPwa = defineTool({
81
+ }));
82
+ export const launchPwa = defineTool(() => ({
83
83
  name: 'launch_pwa',
84
84
  description: 'Launches an installed Progressive Web App using its saved display mode. ' +
85
85
  'Optionally opens a specific URL within the same app instead of the default ' +
@@ -103,8 +103,8 @@ export const launchPwa = defineTool({
103
103
  response.appendResponseLine(`Launched PWA with manifest ID: ${manifestId} (${page.url()})`);
104
104
  response.setIncludePages(true);
105
105
  },
106
- });
107
- export const getOsAppState = defineTool({
106
+ }));
107
+ export const getOsAppState = defineTool(() => ({
108
108
  name: 'get_os_app_state',
109
109
  description: 'Returns the OS integration state (badge count and registered file ' +
110
110
  'handlers) for an installed web app, identified by its manifest ID.',
@@ -124,5 +124,5 @@ export const getOsAppState = defineTool({
124
124
  response.appendResponseLine(`Badge count: ${state.badgeCount}`);
125
125
  response.appendResponseLine(`File handlers: ${JSON.stringify(state.fileHandlers)}`);
126
126
  },
127
- });
127
+ }));
128
128
  //# sourceMappingURL=pwa.js.map
@@ -14,7 +14,7 @@ async function generateTempFilePath() {
14
14
  return path.join(dir, `screencast.mp4`);
15
15
  }
16
16
  const supportedExtensions = ['.webm', '.mp4'];
17
- export const startScreencast = definePageTool(args => ({
17
+ export const startScreencast = definePageTool((args) => ({
18
18
  name: 'screencast_start',
19
19
  description: `Starts recording a screencast (video) of the target page in specified format.`,
20
20
  annotations: {
@@ -87,10 +87,10 @@ export const startScreencast = definePageTool(args => ({
87
87
  throw err;
88
88
  }
89
89
  context.setScreenRecorder({ recorder, filePath: resolvedPath });
90
- response.appendResponseLine(`Screencast recording started. The recording will be saved to ${resolvedPath}. Use ${stopScreencast.name} to stop recording.`);
90
+ response.appendResponseLine(`Screencast recording started. The recording will be saved to ${resolvedPath}. Use ${stopScreencast(args).name} to stop recording.`);
91
91
  },
92
92
  }));
93
- export const stopScreencast = definePageTool({
93
+ export const stopScreencast = definePageTool(() => ({
94
94
  name: 'screencast_stop',
95
95
  description: 'Stops the active screencast recording on the target page.',
96
96
  annotations: {
@@ -115,5 +115,5 @@ export const stopScreencast = definePageTool({
115
115
  context.setScreenRecorder(null);
116
116
  }
117
117
  },
118
- });
118
+ }));
119
119
  //# sourceMappingURL=screencast.js.map
@@ -139,8 +139,8 @@ function computeDownscaleClip(box, maxWidth, maxHeight) {
139
139
  scale,
140
140
  };
141
141
  }
142
- export const screenshot = definePageTool(args => {
143
- const { screenshotFormat, screenshotQuality, screenshotMaxWidth, screenshotMaxHeight, } = args ?? {};
142
+ export const screenshot = definePageTool((args) => {
143
+ const { screenshotFormat, screenshotQuality, screenshotMaxWidth, screenshotMaxHeight, } = args;
144
144
  const defaultFormat = screenshotFormat ?? 'png';
145
145
  return {
146
146
  name: 'take_screenshot',
@@ -58,17 +58,17 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
58
58
  import { zod } from '../third_party/index.js';
59
59
  import { ToolCategory } from './categories.js';
60
60
  import { defineTool, pageIdSchema } from './ToolDefinition.js';
61
- export const evaluateScript = defineTool(cliArgs => {
61
+ export const evaluateScript = defineTool((cliArgs) => {
62
62
  return {
63
63
  name: 'evaluate_script',
64
- description: `Evaluate a JavaScript function inside the target page${cliArgs?.categoryExtensions ? ' or service worker' : ''}. Returns the response as JSON, so returned values have to be JSON-serializable.`,
64
+ description: `Evaluate a JavaScript function inside the target page${cliArgs.categoryExtensions ? ' or service worker' : ''}. Returns the response as JSON, so returned values have to be JSON-serializable.`,
65
65
  annotations: {
66
66
  category: ToolCategory.DEBUGGING,
67
67
  readOnlyHint: false,
68
68
  conditions: ['javascriptEvaluation'],
69
69
  },
70
70
  schema: {
71
- ...(cliArgs?.pageIdRouting
71
+ ...(cliArgs.pageIdRouting
72
72
  ? cliArgs.categoryExtensions
73
73
  ? {
74
74
  pageId: zod
@@ -100,7 +100,7 @@ Example with arguments: \`(el) => el.innerText\`
100
100
  .boolean()
101
101
  .optional()
102
102
  .describe('Whether to wait for the DOM to settle. Pass false if the script only reads data. Defaults to true.'),
103
- ...(cliArgs?.categoryExtensions
103
+ ...(cliArgs.categoryExtensions
104
104
  ? {
105
105
  serviceWorkerId: zod
106
106
  .string()
@@ -117,7 +117,7 @@ Example with arguments: \`(el) => el.innerText\`
117
117
  const env_1 = { stack: [], error: void 0, hasError: false };
118
118
  try {
119
119
  const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, waitForStableDom, } = request.params;
120
- if (cliArgs?.categoryExtensions && serviceWorkerId) {
120
+ if (cliArgs.categoryExtensions && serviceWorkerId) {
121
121
  if (uidArgs && uidArgs.length > 0) {
122
122
  throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
123
123
  }
@@ -141,10 +141,10 @@ Example with arguments: \`(el) => el.innerText\`
141
141
  response.attachWaitForResult(result);
142
142
  return;
143
143
  }
144
- if (cliArgs?.categoryExtensions && cliArgs?.pageIdRouting && !pageId) {
144
+ if (cliArgs.categoryExtensions && cliArgs.pageIdRouting && !pageId) {
145
145
  throw new Error('specify either a pageId or a serviceWorkerId.');
146
146
  }
147
- const mcpPage = cliArgs?.pageIdRouting && request.params.pageId
147
+ const mcpPage = cliArgs.pageIdRouting && request.params.pageId
148
148
  ? context.getPageById(request.params.pageId)
149
149
  : context.getSelectedMcpPage();
150
150
  const page = mcpPage.pptrPage;
@@ -7,7 +7,7 @@ import { zod } from '../../third_party/index.js';
7
7
  import { ToolCategory } from '../categories.js';
8
8
  import { definePageTool } from '../ToolDefinition.js';
9
9
  import { validateUrl } from '../../utils/url.js';
10
- export const screenshot = definePageTool({
10
+ export const screenshot = definePageTool(() => ({
11
11
  name: 'screenshot',
12
12
  description: `Takes a screenshot`,
13
13
  annotations: {
@@ -27,8 +27,8 @@ export const screenshot = definePageTool({
27
27
  const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot.png`);
28
28
  response.appendResponseLine(filepath);
29
29
  },
30
- });
31
- export const navigate = definePageTool(args => {
30
+ }));
31
+ export const navigate = definePageTool((args) => {
32
32
  return {
33
33
  name: 'navigate',
34
34
  description: `Loads a URL`,
@@ -69,7 +69,7 @@ export const navigate = definePageTool(args => {
69
69
  },
70
70
  };
71
71
  });
72
- export const evaluate = definePageTool({
72
+ export const evaluate = definePageTool(() => ({
73
73
  name: 'evaluate',
74
74
  description: `Evaluates a JavaScript script`,
75
75
  annotations: {
@@ -92,5 +92,5 @@ export const evaluate = definePageTool({
92
92
  response.appendResponseLine(String(err.message));
93
93
  }
94
94
  },
95
- });
95
+ }));
96
96
  //# sourceMappingURL=tools.js.map
@@ -6,7 +6,7 @@
6
6
  import { zod } from '../third_party/index.js';
7
7
  import { ToolCategory } from './categories.js';
8
8
  import { definePageTool, timeoutSchema } from './ToolDefinition.js';
9
- export const takeSnapshot = definePageTool({
9
+ export const takeSnapshot = definePageTool(() => ({
10
10
  name: 'take_snapshot',
11
11
  description: `Take a text snapshot of the target page based on the a11y tree. The snapshot lists page elements along with a unique
12
12
  identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
@@ -36,8 +36,8 @@ in the DevTools Elements panel (if any).`,
36
36
  filePath: request.params.filePath,
37
37
  });
38
38
  },
39
- });
40
- export const waitFor = definePageTool({
39
+ }));
40
+ export const waitFor = definePageTool(() => ({
41
41
  name: 'wait_for',
42
42
  description: `Wait for the specified text to appear on the selected page.`,
43
43
  annotations: {
@@ -59,5 +59,5 @@ export const waitFor = definePageTool({
59
59
  response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
60
60
  response.includeSnapshot();
61
61
  },
62
- });
62
+ }));
63
63
  //# sourceMappingURL=snapshot.js.map
@@ -6,7 +6,7 @@
6
6
  import { zod, ajv } from '../third_party/index.js';
7
7
  import { ToolCategory } from './categories.js';
8
8
  import { definePageTool } from './ToolDefinition.js';
9
- export const listThirdPartyDeveloperTools = definePageTool({
9
+ export const listThirdPartyDeveloperTools = definePageTool(() => ({
10
10
  name: 'list_3p_developer_tools',
11
11
  description: `Lists all third-party developer tools the page exposes for providing runtime information.
12
12
  Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.
@@ -25,8 +25,8 @@ third-party developer tools with additional functionality.`,
25
25
  handler: async (_request, response) => {
26
26
  response.setListThirdPartyDeveloperTools();
27
27
  },
28
- });
29
- export const executeThirdPartyDeveloperTool = definePageTool({
28
+ }));
29
+ export const executeThirdPartyDeveloperTool = definePageTool(() => ({
30
30
  name: 'execute_3p_developer_tool',
31
31
  description: `Executes a tool exposed by the page.`,
32
32
  annotations: {
@@ -81,5 +81,5 @@ export const executeThirdPartyDeveloperTool = definePageTool({
81
81
  }
82
82
  await request.page.executeThirdPartyDeveloperTool(toolName, params, response);
83
83
  },
84
- });
84
+ }));
85
85
  //# sourceMappingURL=thirdPartyDeveloper.js.map
@@ -3,7 +3,9 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import * as commentsTools from './comments.js';
6
7
  import * as consoleTools from './console.js';
8
+ import * as cssTools from './css.js';
7
9
  import * as emulationTools from './emulation.js';
8
10
  import * as extensionTools from './extensions.js';
9
11
  import * as inputTools from './input.js';
@@ -24,7 +26,9 @@ export const createTools = (args) => {
24
26
  const rawTools = args.slim
25
27
  ? Object.values(slimTools)
26
28
  : [
29
+ ...(args.devtoolsComments ? Object.values(commentsTools) : []),
27
30
  ...Object.values(consoleTools),
31
+ ...Object.values(cssTools),
28
32
  ...Object.values(emulationTools),
29
33
  ...Object.values(extensionTools),
30
34
  ...Object.values(inputTools),
@@ -43,16 +47,9 @@ export const createTools = (args) => {
43
47
  ];
44
48
  const tools = [];
45
49
  for (const tool of rawTools) {
46
- if (typeof tool === 'function') {
47
- tools.push(tool(args));
48
- }
49
- else {
50
- tools.push(tool);
51
- }
50
+ tools.push(tool(args));
52
51
  }
53
- tools.sort((a, b) => {
54
- return a.name.localeCompare(b.name);
55
- });
52
+ tools.sort((a, b) => a.name.localeCompare(b.name));
56
53
  return tools;
57
54
  };
58
55
  //# sourceMappingURL=tools.js.map
@@ -6,7 +6,7 @@
6
6
  import { zod } from '../third_party/index.js';
7
7
  import { ToolCategory } from './categories.js';
8
8
  import { definePageTool } from './ToolDefinition.js';
9
- export const listWebMcpTools = definePageTool({
9
+ export const listWebMcpTools = definePageTool(() => ({
10
10
  name: 'list_webmcp_tools',
11
11
  description: `Lists all WebMCP tools the page exposes.`,
12
12
  annotations: {
@@ -19,8 +19,8 @@ export const listWebMcpTools = definePageTool({
19
19
  handler: async (_request, response) => {
20
20
  response.setListWebMcpTools();
21
21
  },
22
- });
23
- export const executeWebMcpTool = definePageTool({
22
+ }));
23
+ export const executeWebMcpTool = definePageTool(() => ({
24
24
  name: 'execute_webmcp_tool',
25
25
  description: `Executes a WebMCP tool exposed by the page.`,
26
26
  annotations: {
@@ -62,5 +62,5 @@ export const executeWebMcpTool = definePageTool({
62
62
  const { status, output, errorText } = await tool.execute(input);
63
63
  response.appendResponseLine(JSON.stringify({ status, output, errorText }, null, 2));
64
64
  },
65
- });
65
+ }));
66
66
  //# sourceMappingURL=webmcp.js.map
@@ -3,5 +3,8 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- export {};
6
+ export var CD4ABridgeEvents;
7
+ (function (CD4ABridgeEvents) {
8
+ CD4ABridgeEvents["COMMENT_THREADS_CHANGED"] = "CommentThreadsChanged";
9
+ })(CD4ABridgeEvents || (CD4ABridgeEvents = {}));
7
10
  //# sourceMappingURL=types.js.map
@@ -144,6 +144,9 @@ export class WaitForHelper {
144
144
  }
145
145
  }
146
146
  timeout(time) {
147
+ if (this.#abortController.signal.aborted) {
148
+ return Promise.resolve();
149
+ }
147
150
  return new Promise(res => {
148
151
  const id = setTimeout(res, time);
149
152
  this.#abortController.signal.addEventListener('abort', () => {
@@ -158,15 +161,12 @@ export class WaitForHelper {
158
161
  }
159
162
  const dialogHandler = (dialog) => {
160
163
  this.#dialogDetected = true;
161
- if (!options?.handleDialog) {
162
- return;
163
- }
164
164
  let actionToTake;
165
- if (typeof options.handleDialog === 'object') {
165
+ if (typeof options?.handleDialog === 'object') {
166
166
  actionToTake = options.handleDialog[dialog.type()];
167
167
  }
168
168
  else {
169
- actionToTake = options.handleDialog;
169
+ actionToTake = options?.handleDialog;
170
170
  }
171
171
  if (actionToTake) {
172
172
  this.#dialogHandled = true;
@@ -180,6 +180,9 @@ export class WaitForHelper {
180
180
  void dialog.accept(actionToTake);
181
181
  }
182
182
  }
183
+ else {
184
+ this.#abortController.abort(new Error('Action interrupted by a dialog'));
185
+ }
183
186
  };
184
187
  this.#page.on('dialog', dialogHandler);
185
188
  this.#abortController.signal.addEventListener('abort', () => {
@@ -228,7 +231,7 @@ export class WaitForHelper {
228
231
  // If no navigation occurs, this.#abortController will cancel it in the finally block.
229
232
  const navigationFinished = this.#page
230
233
  .waitForNavigation({
231
- timeout: options?.timeout ?? this.#navigationTimeout,
234
+ timeout: 0,
232
235
  signal: this.#abortController.signal,
233
236
  ignoreSameDocumentNavigation: true,
234
237
  })
@@ -244,7 +247,7 @@ export class WaitForHelper {
244
247
  logger?.(error);
245
248
  });
246
249
  try {
247
- await action();
250
+ await action(this.#abortController.signal);
248
251
  }
249
252
  catch (error) {
250
253
  // Clear up pending promises
@@ -264,7 +267,10 @@ export class WaitForHelper {
264
267
  // Only await navigation if one was actually initiated; otherwise, the
265
268
  // pending waitForNavigation promise will be cancelled when this.#abortController aborts.
266
269
  if (navigationStarted) {
267
- await navigationFinished;
270
+ await Promise.race([
271
+ navigationFinished,
272
+ this.timeout(options?.timeout ?? this.#navigationTimeout),
273
+ ]);
268
274
  }
269
275
  if (this.#dialogDetected) {
270
276
  return this.#getResult();
@@ -36,16 +36,17 @@ export const logger = (...args) => {
36
36
  }
37
37
  };
38
38
  export const puppeteerLogger = (prefix) => {
39
+ const dbg = util.debuglog(prefix);
40
+ if (!dbg.enabled) {
41
+ return;
42
+ }
39
43
  if (logFileStream) {
40
44
  return (...args) => {
41
45
  logFileStream.write(`${new Date().toISOString()} ${prefix} ${util.format(...args)}\n`);
42
46
  };
43
47
  }
44
- const dbg = util.debuglog(prefix);
45
- return dbg.enabled
46
- ? (...args) => {
47
- dbg('%s %s', new Date().toISOString(), util.format(...args));
48
- }
49
- : undefined;
48
+ return (...args) => {
49
+ dbg('%s %s', new Date().toISOString(), util.format(...args));
50
+ };
50
51
  };
51
52
  //# sourceMappingURL=logger.js.map
@@ -5,6 +5,6 @@
5
5
  */
6
6
  // If moved update release-please config
7
7
  // x-release-please-start-version
8
- export const VERSION = '1.9.0';
8
+ export const VERSION = '1.10.1';
9
9
  // x-release-please-end
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp",
3
- "version": "1.9.0",
3
+ "version": "1.10.1",
4
4
  "description": "MCP server for Chrome DevTools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,7 +56,9 @@
56
56
  "@blackwell-systems/gcf": "^2.2.2",
57
57
  "@eslint/js": "^10.0.1",
58
58
  "@google/genai": "^2.0.1",
59
- "@modelcontextprotocol/sdk": "1.30.0",
59
+ "@modelcontextprotocol/client": "2.0.0",
60
+ "@modelcontextprotocol/core": "2.0.0",
61
+ "@modelcontextprotocol/server": "2.0.0",
60
62
  "@rollup/plugin-commonjs": "^29.0.0",
61
63
  "@rollup/plugin-json": "^6.1.0",
62
64
  "@rollup/plugin-node-resolve": "^16.0.3",
@@ -76,15 +78,16 @@
76
78
  "globals": "^17.0.0",
77
79
  "lighthouse": "13.4.1",
78
80
  "prettier": "^3.6.2",
79
- "puppeteer": "25.10.0",
80
- "rollup": "4.62.5",
81
+ "puppeteer": "25.11.0",
82
+ "rollup": "4.63.3",
81
83
  "rollup-plugin-cleanup": "^3.2.1",
82
84
  "rollup-plugin-license": "^3.6.0",
83
85
  "semver": "^7.7.4",
84
86
  "sinon": "^22.0.0",
85
87
  "typescript": "^6.0.2",
86
88
  "typescript-eslint": "^8.43.0",
87
- "yargs": "18.1.0"
89
+ "yargs": "18.1.0",
90
+ "zod": "^4.4.3"
88
91
  },
89
92
  "peerDependencies": {
90
93
  "@blackwell-systems/gcf": "^2.2.2",
@@ -34,7 +34,8 @@ Note: For `evaluate_script`, `pageId` is required when targeting pages. However,
34
34
 
35
35
  - **Automation/interaction**: `take_snapshot` (text-based, faster, better for automation)
36
36
  - **Visual inspection**: `take_screenshot` (when user needs to see visual state)
37
- - **Additional details**: `evaluate_script` for data not in accessibility tree
37
+ - **CSS & Styling inspection**: Use `get_css_styles` to inspect matched rules, cascade, and CSS variables.
38
+ - **Additional details**: Use `evaluate_script` for final resolved values (`getComputedStyle`) or runtime DOM/JS data not in the accessibility tree.
38
39
 
39
40
  ### Parallel execution
40
41
 
@@ -135,6 +135,8 @@ chrome-devtools list_network_requests 1 --includePreservedRequests true # Includ
135
135
  chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1
136
136
  chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1
137
137
  chrome-devtools get_console_message 1 1 # Gets a console message by its ID
138
+ chrome-devtools get_css_styles 1 "1_4" # Retrieves resolved CSS styles (inline, matched, inherited, pseudo) for an element on page 1
139
+ chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 0 # Get CSS styles with pagination on page 1
138
140
  chrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigation
139
141
  chrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile
140
142
  chrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reports