chrome-devtools-mcp 0.20.3 → 0.22.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.
Files changed (55) hide show
  1. package/README.md +97 -20
  2. package/build/src/HeapSnapshotManager.js +94 -0
  3. package/build/src/McpContext.js +26 -49
  4. package/build/src/McpPage.js +16 -0
  5. package/build/src/McpResponse.js +220 -12
  6. package/build/src/PageCollector.js +14 -28
  7. package/build/src/WaitForHelper.js +31 -0
  8. package/build/src/bin/check-latest-version.js +25 -0
  9. package/build/src/bin/chrome-devtools-mcp-cli-options.js +28 -9
  10. package/build/src/bin/chrome-devtools-mcp-main.js +2 -0
  11. package/build/src/bin/chrome-devtools-mcp.js +1 -0
  12. package/build/src/bin/chrome-devtools.js +9 -3
  13. package/build/src/bin/cliDefinitions.js +15 -9
  14. package/build/src/daemon/client.js +1 -1
  15. package/build/src/daemon/daemon.js +2 -6
  16. package/build/src/daemon/utils.js +1 -0
  17. package/build/src/formatters/HeapSnapshotFormatter.js +38 -0
  18. package/build/src/formatters/NetworkFormatter.js +24 -7
  19. package/build/src/index.js +22 -1
  20. package/build/src/telemetry/ClearcutLogger.js +145 -6
  21. package/build/src/telemetry/flagUtils.js +46 -4
  22. package/build/src/telemetry/toolMetricsUtils.js +88 -0
  23. package/build/src/telemetry/types.js +5 -0
  24. package/build/src/telemetry/watchdog/ClearcutSender.js +4 -3
  25. package/build/src/third_party/THIRD_PARTY_NOTICES +1400 -483
  26. package/build/src/third_party/bundled-packages.json +6 -5
  27. package/build/src/third_party/devtools-formatter-worker.js +61 -66
  28. package/build/src/third_party/devtools-heap-snapshot-worker.js +9690 -0
  29. package/build/src/third_party/index.js +61622 -52803
  30. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
  31. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +10589 -4647
  32. package/build/src/tools/categories.js +5 -0
  33. package/build/src/tools/console.js +42 -39
  34. package/build/src/tools/emulation.js +1 -1
  35. package/build/src/tools/extensions.js +5 -11
  36. package/build/src/tools/inPage.js +105 -0
  37. package/build/src/tools/input.js +18 -16
  38. package/build/src/tools/lighthouse.js +3 -3
  39. package/build/src/tools/memory.js +50 -5
  40. package/build/src/tools/network.js +2 -2
  41. package/build/src/tools/pages.js +14 -6
  42. package/build/src/tools/performance.js +1 -1
  43. package/build/src/tools/screencast.js +2 -1
  44. package/build/src/tools/screenshot.js +3 -3
  45. package/build/src/tools/script.js +22 -16
  46. package/build/src/tools/tools.js +4 -0
  47. package/build/src/tools/webmcp.js +63 -0
  48. package/build/src/utils/check-for-updates.js +73 -0
  49. package/build/src/utils/files.js +4 -0
  50. package/build/src/utils/id.js +15 -0
  51. package/build/src/version.js +1 -1
  52. package/package.json +13 -9
  53. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorNoCorpCrossOriginNoCorsRequest.md +0 -3
  54. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoCorpCossOriginNoCorsRequest.md +0 -3
  55. package/build/src/utils/ExtensionRegistry.js +0 -35
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { transformArgName, transformArgType, getZodType, PARAM_BLOCKLIST, } from './ClearcutLogger.js';
7
+ /**
8
+ * Validates that all values in an enum are of the homogeneous primitive type.
9
+ * Returns the primitive type string. Throws an error if heterogeneous.
10
+ */
11
+ export function validateEnumHomogeneity(values) {
12
+ const firstType = typeof values[0];
13
+ for (const val of values) {
14
+ if (typeof val !== firstType) {
15
+ throw new Error('Heterogeneous enum types found');
16
+ }
17
+ }
18
+ return firstType;
19
+ }
20
+ export function applyToExistingMetrics(existing, update) {
21
+ const updated = applyToExisting(existing, update);
22
+ const existingByName = new Map(existing.map(tool => [tool.name, tool]));
23
+ const updatedByName = new Map(update.map(tool => [tool.name, tool]));
24
+ return updated.map(tool => {
25
+ const existingTool = existingByName.get(tool.name);
26
+ const updatedTool = updatedByName.get(tool.name);
27
+ // If the tool still exists in the update, we will update the args.
28
+ if (existingTool && updatedTool) {
29
+ const updatedArgs = applyToExisting(existingTool.args, updatedTool.args);
30
+ return { ...tool, args: updatedArgs };
31
+ }
32
+ return tool;
33
+ });
34
+ }
35
+ function applyToExisting(existing, update) {
36
+ const existingNames = new Set(existing.map(item => item.name));
37
+ const updatedNames = new Set(update.map(item => item.name));
38
+ const result = [];
39
+ // Keep the original ordering.
40
+ for (const entry of existing) {
41
+ const toAdd = { ...entry };
42
+ if (!updatedNames.has(entry.name)) {
43
+ toAdd.isDeprecated = true;
44
+ }
45
+ result.push(toAdd);
46
+ }
47
+ // New entries must be added to the very back of the list.
48
+ for (const entry of update) {
49
+ if (!existingNames.has(entry.name)) {
50
+ result.push({ ...entry });
51
+ }
52
+ }
53
+ return result;
54
+ }
55
+ /**
56
+ * Generates tool metrics from tool definitions.
57
+ */
58
+ export function generateToolMetrics(tools) {
59
+ return tools.map(tool => {
60
+ const args = [];
61
+ for (const [name, schema] of Object.entries(tool.schema)) {
62
+ if (PARAM_BLOCKLIST.has(name)) {
63
+ continue;
64
+ }
65
+ const zodType = getZodType(schema);
66
+ const transformedName = transformArgName(zodType, name);
67
+ let argType = transformArgType(zodType);
68
+ if (argType === 'enum') {
69
+ let values;
70
+ if (schema._def.values?.length > 0) {
71
+ values = schema._def.values;
72
+ }
73
+ else {
74
+ values = schema._def.innerType._def.values;
75
+ }
76
+ argType = validateEnumHomogeneity(values);
77
+ }
78
+ args.push({
79
+ name: transformedName,
80
+ argType,
81
+ });
82
+ }
83
+ return {
84
+ name: tool.name,
85
+ args,
86
+ };
87
+ });
88
+ }
@@ -24,6 +24,11 @@ export var McpClient;
24
24
  McpClient[McpClient["MCP_CLIENT_UNSPECIFIED"] = 0] = "MCP_CLIENT_UNSPECIFIED";
25
25
  McpClient[McpClient["MCP_CLIENT_CLAUDE_CODE"] = 1] = "MCP_CLIENT_CLAUDE_CODE";
26
26
  McpClient[McpClient["MCP_CLIENT_GEMINI_CLI"] = 2] = "MCP_CLIENT_GEMINI_CLI";
27
+ McpClient[McpClient["MCP_CLIENT_DT_MCP_CLI"] = 4] = "MCP_CLIENT_DT_MCP_CLI";
28
+ McpClient[McpClient["MCP_CLIENT_OPENCLAW"] = 5] = "MCP_CLIENT_OPENCLAW";
29
+ McpClient[McpClient["MCP_CLIENT_CODEX"] = 6] = "MCP_CLIENT_CODEX";
30
+ McpClient[McpClient["MCP_CLIENT_ANTIGRAVITY"] = 7] = "MCP_CLIENT_ANTIGRAVITY";
31
+ McpClient[McpClient["MCP_CLIENT_OTHER"] = 3] = "MCP_CLIENT_OTHER";
27
32
  })(McpClient || (McpClient = {}));
28
33
  // IPC types for messages between the main process and the
29
34
  // telemetry watchdog process.
@@ -42,13 +42,14 @@ export class ClearcutSender {
42
42
  this.#sessionId = crypto.randomUUID();
43
43
  this.#sessionCreated = Date.now();
44
44
  }
45
- logger('Enqueing telemetry event', JSON.stringify(event, null, 2));
46
- this.#addToBuffer({
45
+ const eventToSend = {
47
46
  ...event,
48
47
  session_id: this.#sessionId,
49
48
  app_version: this.#appVersion,
50
49
  os_type: this.#osType,
51
- });
50
+ };
51
+ logger('Enqueing telemetry event', JSON.stringify(eventToSend, null, 2));
52
+ this.#addToBuffer(eventToSend);
52
53
  if (!this.#timerStarted) {
53
54
  this.#timerStarted = true;
54
55
  this.#scheduleFlush(this.#flushIntervalMs);