chrome-devtools-mcp 1.5.0 → 1.6.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 (51) hide show
  1. package/README.md +15 -0
  2. package/build/src/HeapSnapshotManager.js +23 -13
  3. package/build/src/McpContext.js +174 -365
  4. package/build/src/McpPage.js +242 -31
  5. package/build/src/McpResponse.js +113 -67
  6. package/build/src/PageCollector.js +48 -122
  7. package/build/src/TextSnapshot.js +20 -2
  8. package/build/src/ToolHandler.js +13 -3
  9. package/build/src/WaitForHelper.js +18 -8
  10. package/build/src/bin/chrome-devtools-cli-options.js +25 -1
  11. package/build/src/bin/chrome-devtools-mcp-cli-options.js +15 -6
  12. package/build/src/bin/chrome-devtools-mcp-main.js +2 -2
  13. package/build/src/browser.js +1 -1
  14. package/build/src/daemon/client.js +33 -3
  15. package/build/src/daemon/daemon.js +2 -1
  16. package/build/src/daemon/utils.js +1 -1
  17. package/build/src/devtools/DevtoolsUtils.js +2 -63
  18. package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +2 -2
  19. package/build/src/formatters/IssueFormatter.js +2 -2
  20. package/build/src/index.js +12 -3
  21. package/build/src/telemetry/ClearcutLogger.js +1 -1
  22. package/build/src/telemetry/WatchdogClient.js +1 -1
  23. package/build/src/telemetry/metricsRegistry.js +2 -9
  24. package/build/src/telemetry/persistence.js +1 -1
  25. package/build/src/telemetry/transformation.js +20 -0
  26. package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
  27. package/build/src/telemetry/watchdog/main.js +1 -1
  28. package/build/src/third_party/THIRD_PARTY_NOTICES +13 -249
  29. package/build/src/third_party/bundled-packages.json +2 -3
  30. package/build/src/third_party/index.js +1527 -1514
  31. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3082 -6343
  32. package/build/src/tools/emulation.js +2 -2
  33. package/build/src/tools/extensions.js +1 -1
  34. package/build/src/tools/input.js +17 -8
  35. package/build/src/tools/lighthouse.js +1 -1
  36. package/build/src/tools/memory.js +16 -2
  37. package/build/src/tools/network.js +4 -4
  38. package/build/src/tools/pages.js +21 -89
  39. package/build/src/tools/performance.js +2 -2
  40. package/build/src/tools/script.js +3 -0
  41. package/build/src/tools/snapshot.js +2 -2
  42. package/build/src/tools/thirdPartyDeveloper.js +1 -1
  43. package/build/src/tools/webmcp.js +1 -1
  44. package/build/src/trace-processing/parse.js +1 -1
  45. package/build/src/{logger.js → utils/logger.js} +1 -1
  46. package/build/src/{polyfill.js → utils/polyfill.js} +1 -1
  47. package/build/src/version.js +1 -1
  48. package/package.json +9 -5
  49. package/skills/memory-leak-debugging/SKILL.md +22 -14
  50. package/build/src/utils/types.js +0 -7
  51. /package/build/src/{Mutex.js → utils/Mutex.js} +0 -0
package/README.md CHANGED
@@ -333,6 +333,16 @@ Alternatively, follow the <a href="https://github.com/google-gemini/gemini-cli/b
333
333
  using the standard config from above.
334
334
  </details>
335
335
 
336
+ <details>
337
+ <summary>Grok Build CLI</summary>
338
+
339
+ ```bash
340
+ grok mcp add chrome-devtools npx chrome-devtools-mcp@latest
341
+ ```
342
+
343
+ See the <a href="https://docs.x.ai/build/features/skills-plugins-marketplaces">docs</a> for more options
344
+ </details>
345
+
336
346
  <details>
337
347
  <summary>JetBrains AI Assistant & Junie</summary>
338
348
 
@@ -744,6 +754,11 @@ The Chrome DevTools MCP server supports the following configuration option:
744
754
  - **Type:** boolean
745
755
  - **Default:** `false`
746
756
 
757
+ - **`--allowUnrestrictedPaths`/ `--allow-unrestricted-paths`**
758
+ If set, disables the default path restriction that applies when the MCP client does not negotiate the roots capability. By default, file-writing tools are restricted to the OS temp directory when no roots are configured. Use this only when connecting a trusted local client that does not implement MCP roots and requires access to paths outside the temp directory.
759
+ - **Type:** boolean
760
+ - **Default:** `false`
761
+
747
762
  <!-- END AUTO GENERATED OPTIONS -->
748
763
 
749
764
  Pass them via the `args` property in the JSON configuration. For example:
@@ -21,24 +21,31 @@ export class HeapSnapshotManager {
21
21
  this.#snapshots.set(absolutePath, {
22
22
  snapshot,
23
23
  worker,
24
- idToClassKey: new Map(),
24
+ idToClassKey: [''],
25
25
  classKeyToId: new Map(),
26
- idGenerator: createIdGenerator(),
27
26
  });
28
27
  return snapshot;
29
28
  }
30
- async getAggregates(filePath) {
29
+ async getAggregates(filePath, filterName) {
31
30
  const snapshot = await this.getSnapshot(filePath);
32
31
  const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
32
+ if (filterName) {
33
+ filter.filterName = filterName;
34
+ }
33
35
  const aggregates = await snapshot.aggregatesWithFilter(filter);
34
- for (const key of Object.keys(aggregates)) {
36
+ let objectCount = 0;
37
+ let totalSelfSize = 0;
38
+ for (const [key, aggregate] of Object.entries(aggregates)) {
35
39
  const id = await this.getOrCreateIdForClassKey(filePath, key);
36
- const aggregate = aggregates[key];
37
- if (aggregate) {
38
- aggregate[stableIdSymbol] = id;
39
- }
40
+ aggregate[stableIdSymbol] = id;
41
+ objectCount += aggregate.count;
42
+ totalSelfSize += aggregate.self;
40
43
  }
41
- return aggregates;
44
+ return {
45
+ aggregates,
46
+ objectCount,
47
+ totalSelfSize,
48
+ };
42
49
  }
43
50
  async getStats(filePath) {
44
51
  const snapshot = await this.getSnapshot(filePath);
@@ -52,15 +59,18 @@ export class HeapSnapshotManager {
52
59
  const cached = this.#getCachedSnapshot(filePath);
53
60
  let id = cached.classKeyToId.get(classKey);
54
61
  if (!id) {
55
- id = cached.idGenerator();
62
+ id = cached.idToClassKey.length;
56
63
  cached.classKeyToId.set(classKey, id);
57
- cached.idToClassKey.set(id, classKey);
64
+ cached.idToClassKey.push(classKey);
58
65
  }
59
66
  return id;
60
67
  }
61
- async getNodesById(filePath, id) {
68
+ async getNodesById(filePath, id, filterName) {
62
69
  const snapshot = await this.getSnapshot(filePath);
63
70
  const filter = new DevTools.HeapSnapshotModel.HeapSnapshotModel.NodeFilter();
71
+ if (filterName) {
72
+ filter.filterName = filterName;
73
+ }
64
74
  const className = await this.resolveClassKeyFromId(filePath, id);
65
75
  if (!className) {
66
76
  throw new Error(`Class with ID ${id} not found in heap snapshot`);
@@ -163,7 +173,7 @@ export class HeapSnapshotManager {
163
173
  }
164
174
  async resolveClassKeyFromId(filePath, id) {
165
175
  const cached = this.#getCachedSnapshot(filePath);
166
- return cached.idToClassKey.get(id);
176
+ return cached.idToClassKey[id];
167
177
  }
168
178
  async #loadSnapshot(absolutePath, uid) {
169
179
  const workerProxy = new DevTools.HeapSnapshotModel.HeapSnapshotProxy.HeapSnapshotWorkerProxy(() => {