chrome-devtools-mcp 1.11.0 → 1.12.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 +72 -20
- package/build/src/BrowserManager.js +27 -18
- package/build/src/McpContext.js +435 -87
- package/build/src/McpPage.js +189 -59
- package/build/src/McpResponse.js +61 -44
- package/build/src/TextSnapshot.js +37 -18
- package/build/src/ToolHandler.js +256 -135
- package/build/src/bin/chrome-devtools-mcp-main.js +6 -4
- package/build/src/bin/chrome-devtools.js +4 -4
- package/build/src/collectors/PageCollector.js +13 -9
- package/build/src/collectors/ServiceWorkerCollector.js +2 -2
- package/build/src/collectors/constants.js +7 -0
- package/build/src/config/ConfigParser.js +44 -149
- package/build/src/config/ConfigWatcher.js +3 -2
- package/build/src/config/ServerConfig.js +251 -0
- package/build/src/config/browser-options.js +13 -4
- package/build/src/config/cli-options.js +35 -19
- package/build/src/config/mcp-options.js +61 -35
- package/build/src/config/puppeteer-options.js +4 -2
- package/build/src/daemon/client.js +3 -3
- package/build/src/daemon/daemon.js +7 -3
- package/build/src/daemon/utils.js +2 -1
- package/build/src/devtools/DevToolsCommentBridge.js +28 -5
- package/build/src/devtools/DevtoolsUtils.js +49 -12
- package/build/src/formatters/ConsoleFormatter.js +28 -1
- package/build/src/formatters/HeapSnapshotFormatter.js +14 -18
- package/build/src/formatters/NetworkFormatter.js +54 -15
- package/build/src/formatters/RemoteObjectFormatter.js +231 -0
- package/build/src/formatters/SnapshotFormatter.js +13 -3
- package/build/src/index.js +256 -104
- package/build/src/processors/HeapSnapshotManager.js +390 -128
- package/build/src/third_party/THIRD_PARTY_NOTICES +542 -445
- package/build/src/third_party/bundled-packages.json +2 -2
- package/build/src/third_party/cli.js +9239 -0
- package/build/src/third_party/devtools-formatter-worker.js +3089 -2438
- package/build/src/third_party/devtools-heap-snapshot-worker.js +172 -1
- package/build/src/third_party/index.js +52247 -55764
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +54576 -52174
- package/build/src/tools/ToolDefinition.js +90 -12
- package/build/src/tools/comments.js +42 -3
- package/build/src/tools/console.js +6 -4
- package/build/src/tools/css.js +1 -0
- package/build/src/tools/emulation.js +5 -4
- package/build/src/tools/extensions.js +5 -0
- package/build/src/tools/input.js +21 -6
- package/build/src/tools/lighthouse.js +24 -8
- package/build/src/tools/memory.js +59 -53
- package/build/src/tools/network.js +5 -4
- package/build/src/tools/pages.js +48 -6
- package/build/src/tools/performance.js +7 -4
- package/build/src/tools/pwa.js +7 -0
- package/build/src/tools/screencast.js +3 -1
- package/build/src/tools/screenshot.js +23 -7
- package/build/src/tools/script.js +38 -6
- package/build/src/tools/slim/tools.js +21 -5
- package/build/src/tools/snapshot.js +13 -3
- package/build/src/tools/thirdPartyDeveloper.js +3 -1
- package/build/src/tools/webmcp.js +2 -0
- package/build/src/utils/TaskRunner.js +136 -0
- package/build/src/utils/WaitForHelper.js +1 -1
- package/build/src/utils/bytes.js +2 -12
- package/build/src/utils/check-for-updates.js +1 -1
- package/build/src/utils/disclaimers.js +27 -0
- package/build/src/utils/keyboard.js +14 -2
- package/build/src/utils/logger.js +69 -0
- package/build/src/utils/resourceType.js +27 -0
- package/build/src/utils/text.js +29 -0
- package/build/src/utils/timeout.js +14 -0
- package/build/src/utils/url.js +41 -0
- package/build/src/version.js +1 -1
- package/package.json +5 -4
- package/skills/a11y-debugging/SKILL.md +3 -8
package/build/src/utils/url.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
// Node 22 has no global URLPattern. The CLI bundle exports Puppeteer's
|
|
7
|
+
// polyfill, so this module does not need the full third-party bundle.
|
|
8
|
+
import { URLPattern } from '../third_party/cli.js';
|
|
6
9
|
const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'ws:', 'wss:']);
|
|
7
10
|
const IPV4_LOOPBACK_REGEX = /^127(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$/;
|
|
11
|
+
const IPV4_MAPPED_LOOPBACK_REGEX = /^\[::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}\]$/;
|
|
8
12
|
/**
|
|
9
13
|
* Determines whether a given URL string points to a localhost / loopback address.
|
|
10
14
|
*
|
|
@@ -38,8 +42,42 @@ export function isLocalhost(url) {
|
|
|
38
42
|
if (IPV4_LOOPBACK_REGEX.test(hostname)) {
|
|
39
43
|
return true;
|
|
40
44
|
}
|
|
45
|
+
// 4. Check IPv4-mapped IPv6 loopback. URL serializes [::ffff:127.0.0.1]
|
|
46
|
+
// as [::ffff:7f00:1].
|
|
47
|
+
if (IPV4_MAPPED_LOOPBACK_REGEX.test(hostname)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
41
50
|
return false;
|
|
42
51
|
}
|
|
52
|
+
// URL serializes `0`, `0x0` and `0.0` as 0.0.0.0, `[::0]` as [::], and
|
|
53
|
+
// [::ffff:0.0.0.0] as [::ffff:0:0].
|
|
54
|
+
const UNSPECIFIED_HOSTNAMES = new Set(['0.0.0.0', '[::]', '[::ffff:0:0]']);
|
|
55
|
+
/**
|
|
56
|
+
* Determines whether a browser endpoint URL points to the local machine.
|
|
57
|
+
*
|
|
58
|
+
* In addition to {@link isLocalhost}, this accepts the unspecified addresses
|
|
59
|
+
* 0.0.0.0 and [::]. A connection to an unspecified address reaches the local
|
|
60
|
+
* machine.
|
|
61
|
+
*
|
|
62
|
+
* @param url The browser endpoint URL (for example, a WebSocket endpoint).
|
|
63
|
+
* @returns true if the endpoint is on the local machine.
|
|
64
|
+
*/
|
|
65
|
+
export function isLocalBrowserEndpoint(url) {
|
|
66
|
+
if (isLocalhost(url)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
let parsed;
|
|
70
|
+
try {
|
|
71
|
+
parsed = new URL(url);
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return UNSPECIFIED_HOSTNAMES.has(parsed.hostname);
|
|
80
|
+
}
|
|
43
81
|
/**
|
|
44
82
|
* Determines whether a URL is allowed for navigation and page tracking.
|
|
45
83
|
*
|
|
@@ -201,6 +239,9 @@ export function validateUrl(url, options) {
|
|
|
201
239
|
if (fileNavigations === false && targetsFileScheme(parsed)) {
|
|
202
240
|
throw new Error(`Navigating to file: URLs is not allowed when --file-navigations is disabled.`);
|
|
203
241
|
}
|
|
242
|
+
if (parsed.protocol === 'devtools:') {
|
|
243
|
+
throw new Error(`Navigating to devtools: URLs is not allowed.`);
|
|
244
|
+
}
|
|
204
245
|
if (!isAllowedUrl(url, { categoryExtensions })) {
|
|
205
246
|
if (parsed.protocol === 'chrome-extension:') {
|
|
206
247
|
throw new Error(`Navigating to chrome-extension: URLs is not allowed without --categoryExtensions.`);
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "MCP server for Chrome DevTools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"LICENSE",
|
|
44
44
|
"skills",
|
|
45
45
|
"!*.tsbuildinfo",
|
|
46
|
-
"
|
|
46
|
+
"!**/*.js.map",
|
|
47
|
+
"!**/*.d.ts"
|
|
47
48
|
],
|
|
48
49
|
"repository": "ChromeDevTools/chrome-devtools-mcp",
|
|
49
50
|
"author": "Google LLC",
|
|
@@ -82,8 +83,8 @@
|
|
|
82
83
|
"globals": "^17.0.0",
|
|
83
84
|
"lighthouse": "13.5.0",
|
|
84
85
|
"prettier": "^3.6.2",
|
|
85
|
-
"puppeteer": "25.
|
|
86
|
-
"rollup": "4.64.
|
|
86
|
+
"puppeteer": "25.16.0",
|
|
87
|
+
"rollup": "4.64.7",
|
|
87
88
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
88
89
|
"rollup-plugin-license": "^3.6.0",
|
|
89
90
|
"semver": "^7.7.4",
|
|
@@ -21,8 +21,8 @@ Start by running a Lighthouse accessibility audit to get a comprehensive baselin
|
|
|
21
21
|
- Set `mode` to `"navigation"` to refresh the page and capture load issues.
|
|
22
22
|
- Omit `outputDirPath` to save reports to the default temporary directory (the exact path to `report.json` is returned under `Reports`), or set `outputDirPath` to a directory within the workspace.
|
|
23
23
|
2. **Analyze the Summary**:
|
|
24
|
-
-
|
|
25
|
-
-
|
|
24
|
+
- In the default text output, category scores use a 0-100 scale (100 is a perfect score), followed by `Passed: N` and `Failed: N` audit counts.
|
|
25
|
+
- If the server was started with `--experimentalStructuredContent`, inspect `summary.scores[].score` (0-1 scale) and `summary.audits.failed` in the structured content instead.
|
|
26
26
|
3. **Review the Report (CRITICAL)**:
|
|
27
27
|
- **Parsing**: Do not read the entire file line-by-line. Use a CLI tool like `jq` or a Node.js one-liner to filter for failures from the report path returned by `lighthouse_audit`:
|
|
28
28
|
```bash
|
|
@@ -73,12 +73,7 @@ _Pass the element's `uid` from the snapshot as an argument to `evaluate_script`.
|
|
|
73
73
|
|
|
74
74
|
### 7. Color Contrast
|
|
75
75
|
|
|
76
|
-
To verify color contrast ratios,
|
|
77
|
-
|
|
78
|
-
1. Call `list_console_messages` with `types: ["issue"]`.
|
|
79
|
-
2. Look for "Low Contrast" issues in the output.
|
|
80
|
-
|
|
81
|
-
If native audits do not report issues (which may happen in some headless environments) or if you need to check a specific element manually, use `evaluate_script` with the **"Check Color Contrast" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md).
|
|
76
|
+
To verify color contrast ratios, use the **"Check Color Contrast" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md) with `evaluate_script`.
|
|
82
77
|
|
|
83
78
|
### 8. Global Page Checks
|
|
84
79
|
|