chrome-devtools-mcp 1.4.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.
- package/README.md +20 -3
- package/build/src/HeapSnapshotManager.js +83 -16
- package/build/src/McpContext.js +218 -367
- package/build/src/McpPage.js +242 -31
- package/build/src/McpResponse.js +165 -60
- package/build/src/PageCollector.js +48 -122
- package/build/src/TextSnapshot.js +20 -2
- package/build/src/ToolHandler.js +13 -3
- package/build/src/WaitForHelper.js +18 -8
- package/build/src/bin/chrome-devtools-cli-options.js +76 -4
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +15 -6
- package/build/src/bin/chrome-devtools-mcp-main.js +2 -2
- package/build/src/bin/chrome-devtools.js +25 -1
- package/build/src/browser.js +1 -1
- package/build/src/daemon/client.js +33 -3
- package/build/src/daemon/daemon.js +3 -2
- package/build/src/daemon/utils.js +1 -1
- package/build/src/devtools/DevtoolsUtils.js +2 -63
- package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +8 -6
- package/build/src/formatters/HeapSnapshotFormatter.js +43 -0
- package/build/src/formatters/IssueFormatter.js +2 -2
- package/build/src/index.js +14 -5
- package/build/src/telemetry/ClearcutLogger.js +1 -1
- package/build/src/telemetry/WatchdogClient.js +1 -1
- package/build/src/telemetry/metricsRegistry.js +2 -9
- package/build/src/telemetry/persistence.js +1 -1
- package/build/src/telemetry/transformation.js +20 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
- package/build/src/telemetry/watchdog/main.js +1 -1
- package/build/src/third_party/THIRD_PARTY_NOTICES +13 -279
- package/build/src/third_party/bundled-packages.json +3 -5
- package/build/src/third_party/devtools-heap-snapshot-worker.js +81 -0
- package/build/src/third_party/index.js +2418 -2197
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3082 -6343
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +1 -1
- package/build/src/tools/input.js +17 -8
- package/build/src/tools/lighthouse.js +1 -1
- package/build/src/tools/memory.js +76 -6
- package/build/src/tools/network.js +4 -4
- package/build/src/tools/pages.js +21 -89
- package/build/src/tools/performance.js +2 -2
- package/build/src/tools/screencast.js +1 -2
- package/build/src/tools/script.js +6 -10
- package/build/src/tools/snapshot.js +2 -2
- package/build/src/tools/thirdPartyDeveloper.js +7 -7
- package/build/src/tools/webmcp.js +1 -1
- package/build/src/trace-processing/parse.js +1 -1
- package/build/src/utils/files.js +0 -4
- package/build/src/{logger.js → utils/logger.js} +1 -1
- package/build/src/{polyfill.js → utils/polyfill.js} +1 -1
- package/build/src/version.js +1 -1
- package/package.json +17 -5
- package/skills/memory-leak-debugging/SKILL.md +22 -14
- package/build/src/utils/types.js +0 -7
- /package/build/src/{Mutex.js → utils/Mutex.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "MCP server for Chrome DevTools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,16 +55,17 @@
|
|
|
55
55
|
"@rollup/plugin-json": "^6.1.0",
|
|
56
56
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
57
57
|
"@stylistic/eslint-plugin": "^5.4.0",
|
|
58
|
+
"@blackwell-systems/gcf": "^2.2.2",
|
|
58
59
|
"@toon-format/toon": "^2.2.0",
|
|
59
60
|
"@types/debug": "^4.1.12",
|
|
60
61
|
"@types/filesystem": "^0.0.36",
|
|
61
62
|
"@types/node": "^26.0.0",
|
|
62
63
|
"@types/semver": "^7.7.1",
|
|
63
|
-
"@types/sinon": "^
|
|
64
|
+
"@types/sinon": "^22.0.0",
|
|
64
65
|
"@types/yargs": "^17.0.33",
|
|
65
66
|
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
66
67
|
"@typescript-eslint/parser": "^8.43.0",
|
|
67
|
-
"chrome-devtools-frontend": "1.0.
|
|
68
|
+
"chrome-devtools-frontend": "1.0.1652307",
|
|
68
69
|
"core-js": "3.49.0",
|
|
69
70
|
"debug": "4.4.3",
|
|
70
71
|
"eslint": "^9.35.0",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"globals": "^17.0.0",
|
|
74
75
|
"lighthouse": "13.4.0",
|
|
75
76
|
"prettier": "^3.6.2",
|
|
76
|
-
"puppeteer": "25.
|
|
77
|
+
"puppeteer": "25.3.0",
|
|
77
78
|
"rollup": "4.62.2",
|
|
78
79
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
79
80
|
"rollup-plugin-license": "^3.6.0",
|
|
@@ -81,9 +82,20 @@
|
|
|
81
82
|
"sinon": "^22.0.0",
|
|
82
83
|
"typescript": "^6.0.2",
|
|
83
84
|
"typescript-eslint": "^8.43.0",
|
|
84
|
-
"urlpattern-polyfill": "^10.1.0",
|
|
85
85
|
"yargs": "18.0.0"
|
|
86
86
|
},
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"@toon-format/toon": "^2.2.0",
|
|
89
|
+
"@blackwell-systems/gcf": "^2.2.2"
|
|
90
|
+
},
|
|
91
|
+
"peerDependenciesMeta": {
|
|
92
|
+
"@toon-format/toon": {
|
|
93
|
+
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@blackwell-systems/gcf": {
|
|
96
|
+
"optional": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
87
99
|
"engines": {
|
|
88
100
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
89
101
|
},
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory-leak-debugging
|
|
3
|
-
description: Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to
|
|
3
|
+
description: Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to capture, compare, or inspect heap snapshots with Chrome DevTools MCP memory tools.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Memory Leak Debugging
|
|
7
7
|
|
|
8
|
-
This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications.
|
|
8
|
+
This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP.
|
|
9
9
|
|
|
10
10
|
## Core Principles
|
|
11
11
|
|
|
12
|
-
- **Prefer
|
|
12
|
+
- **Prefer MCP memory tools:** Do NOT attempt to read raw `.heapsnapshot` files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
|
|
13
13
|
- **Isolate the Leak:** Determine if the leak is in the browser (client-side) or Node.js (server-side).
|
|
14
14
|
- **Common Culprits:** Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. _Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them._
|
|
15
|
+
- **Close Loaded Snapshots:** Heap snapshots can be large. After completing an investigation, use `close_heapsnapshot` for each loaded snapshot to release memory held by the MCP server.
|
|
15
16
|
|
|
16
17
|
## Workflows
|
|
17
18
|
|
|
@@ -24,27 +25,34 @@ When investigating a frontend web application memory leak, utilize the `chrome-d
|
|
|
24
25
|
- Repeat the same user interactions 10 times to amplify the leak.
|
|
25
26
|
- Use `take_heapsnapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
|
|
26
27
|
|
|
27
|
-
### 2.
|
|
28
|
+
### 2. Comparing Snapshots
|
|
28
29
|
|
|
29
|
-
Once you have generated `.heapsnapshot` files using `take_heapsnapshot`,
|
|
30
|
+
Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, compare them with Chrome DevTools MCP memory tools.
|
|
30
31
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
32
|
+
- Start with `get_heapsnapshot_summary` for each snapshot to confirm that the files load and to compare high-level totals.
|
|
33
|
+
- Use `compare_heapsnapshots` to compare baseline and target snapshots. Start without `classIndex` for the summary diff, then request detailed class diffs only for suspicious growth.
|
|
34
|
+
- Use the summary output from `compare_heapsnapshots` before drilling into specific node IDs.
|
|
33
35
|
|
|
34
|
-
### 3.
|
|
36
|
+
### 3. Inspecting Retainers
|
|
35
37
|
|
|
36
|
-
When
|
|
38
|
+
When a class or object type grows unexpectedly, inspect the retaining chain with the MCP tools before changing code.
|
|
37
39
|
|
|
38
|
-
-
|
|
40
|
+
- Use `get_heapsnapshot_class_nodes` to list instances of the suspicious class.
|
|
41
|
+
- Use `get_heapsnapshot_retainers`, `get_heapsnapshot_retaining_paths`, `get_heapsnapshot_dominators`, and `get_heapsnapshot_edges` to understand why representative nodes are still reachable.
|
|
42
|
+
- Use `get_heapsnapshot_duplicate_strings` when string growth dominates the diff.
|
|
43
|
+
- Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them after the retaining path points at application code.
|
|
39
44
|
|
|
40
|
-
### 4.
|
|
45
|
+
### 4. External Tool Fallback
|
|
41
46
|
|
|
42
|
-
If
|
|
47
|
+
If the built-in MCP memory tools are not enough, use external tools as a fallback rather than reading raw snapshots directly.
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
- Read [references/memlab.md](references/memlab.md) for how to use `memlab` to analyze generated heap snapshots.
|
|
50
|
+
- If `memlab` is not available, use the fallback script in the references directory to compare two `.heapsnapshot` files and identify the top growing objects and common leak types.
|
|
51
|
+
|
|
52
|
+
Run the fallback script using Node.js:
|
|
45
53
|
|
|
46
54
|
```bash
|
|
47
55
|
node skills/memory-leak-debugging/references/compare_snapshots.js <baseline.heapsnapshot> <target.heapsnapshot>
|
|
48
56
|
```
|
|
49
57
|
|
|
50
|
-
The script will analyze and output the top growing objects by size and highlight the 3 most common types of memory leaks (
|
|
58
|
+
The script will analyze and output the top growing objects by size and highlight the 3 most common types of memory leaks (for example, detached DOM nodes, closures, and contexts) if they are present.
|
package/build/src/utils/types.js
DELETED
|
File without changes
|