brave-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 (53) 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/brave-devtools-cli-options.js +25 -1
  11. package/build/src/bin/brave-devtools-mcp-cli-options.js +15 -6
  12. package/build/src/bin/brave-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/devtools-formatter-worker.js +0 -1
  31. package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -1
  32. package/build/src/third_party/index.js +1527 -1515
  33. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3082 -6343
  34. package/build/src/tools/emulation.js +2 -2
  35. package/build/src/tools/extensions.js +1 -1
  36. package/build/src/tools/input.js +17 -8
  37. package/build/src/tools/lighthouse.js +1 -1
  38. package/build/src/tools/memory.js +16 -2
  39. package/build/src/tools/network.js +4 -4
  40. package/build/src/tools/pages.js +21 -89
  41. package/build/src/tools/performance.js +2 -2
  42. package/build/src/tools/script.js +3 -0
  43. package/build/src/tools/snapshot.js +2 -2
  44. package/build/src/tools/thirdPartyDeveloper.js +1 -1
  45. package/build/src/tools/webmcp.js +1 -1
  46. package/build/src/trace-processing/parse.js +1 -1
  47. package/build/src/{logger.js → utils/logger.js} +1 -1
  48. package/build/src/{polyfill.js → utils/polyfill.js} +1 -1
  49. package/build/src/version.js +1 -1
  50. package/package.json +9 -5
  51. package/skills/memory-leak-debugging/SKILL.md +22 -14
  52. package/build/src/utils/types.js +0 -7
  53. /package/build/src/{Mutex.js → utils/Mutex.js} +0 -0
package/README.md CHANGED
@@ -451,6 +451,16 @@ Alternatively, follow the <a href="https://github.com/google-gemini/gemini-cli/b
451
451
  using the standard config from above.
452
452
  </details>
453
453
 
454
+ <details>
455
+ <summary>Grok Build CLI</summary>
456
+
457
+ ```bash
458
+ grok mcp add chrome-devtools npx chrome-devtools-mcp@latest
459
+ ```
460
+
461
+ See the <a href="https://docs.x.ai/build/features/skills-plugins-marketplaces">docs</a> for more options
462
+ </details>
463
+
454
464
  <details>
455
465
  <summary>JetBrains AI Assistant & Junie</summary>
456
466
 
@@ -862,6 +872,11 @@ The Brave DevTools MCP server supports the following configuration options:
862
872
  - **Type:** boolean
863
873
  - **Default:** `false`
864
874
 
875
+ - **`--allowUnrestrictedPaths`/ `--allow-unrestricted-paths`**
876
+ 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.
877
+ - **Type:** boolean
878
+ - **Default:** `false`
879
+
865
880
  <!-- END AUTO GENERATED OPTIONS -->
866
881
 
867
882
  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(() => {