Skip to content

Commit 2730b64

Browse files
committed
Merge branch 'main' into crux-for-trace
2 parents 99059ab + 7c25c3a commit 2730b64

16 files changed

Lines changed: 239 additions & 86 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.14.0"
2+
".": "0.15.1"
33
}

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## [0.15.1](https://github.com/ChromeDevTools/chrome-devtools-mcp/compare/chrome-devtools-mcp-v0.15.0...chrome-devtools-mcp-v0.15.1) (2026-01-30)
4+
5+
6+
### 🛠️ Fixes
7+
8+
* disable usage statistics when CI or CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS env is set ([#862](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/862)) ([c0435a2](https://github.com/ChromeDevTools/chrome-devtools-mcp/commit/c0435a2d53eb51b7500fc5cce50344520ea164e7))
9+
* respect custom timeouts in navigate tools ([#865](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/865)) ([a0aeb97](https://github.com/ChromeDevTools/chrome-devtools-mcp/commit/a0aeb97693fd5ca641f45ebcd4ce3b4b08ce21b8))
10+
11+
## [0.15.0](https://github.com/ChromeDevTools/chrome-devtools-mcp/compare/chrome-devtools-mcp-v0.14.0...chrome-devtools-mcp-v0.15.0) (2026-01-28)
12+
13+
14+
### 🎉 Features
15+
16+
* Add ability to inject script to run on page load ([#568](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/568)) ([d845ad4](https://github.com/ChromeDevTools/chrome-devtools-mcp/commit/d845ad48584a49aa57b11de308beeb17ed0b2e10))
17+
* enable usage statistics by default with opt-out ([#855](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/855)) ([7e279f1](https://github.com/ChromeDevTools/chrome-devtools-mcp/commit/7e279f1b67c5cfd4ad033a4147c51fe20a7833f7))
18+
* support testing light and dark mode ([#858](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/858)) ([5a23a8c](https://github.com/ChromeDevTools/chrome-devtools-mcp/commit/5a23a8c201d30d40395e283f4434d933826333fa))
19+
320
## [0.14.0](https://github.com/ChromeDevTools/chrome-devtools-mcp/compare/chrome-devtools-mcp-v0.13.0...chrome-devtools-mcp-v0.14.0) (2026-01-27)
421

522

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Google handles this data in accordance with the [Google Privacy Policy](https://
4747

4848
Google's collection of usage statistics for Chrome DevTools MCP is independent from the Chrome browser's usage statistics. Opting out of Chrome metrics does not automatically opt you out of this tool, and vice-versa.
4949

50+
Collection is disabled if CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS or CI env variables are set.
51+
5052
## Requirements
5153

5254
- [Node.js](https://nodejs.org/) v20.19 or a newer [latest maintenance LTS](https://github.com/nodejs/Release#release-schedule) version.
@@ -476,7 +478,7 @@ The Chrome DevTools MCP server supports the following configuration option:
476478
- **Default:** `true`
477479

478480
- **`--usageStatistics`/ `--usage-statistics`**
479-
Set to false to opt-out of usage statistics collection. Google collects usage data to improve the tool, handled under the Google Privacy Policy (https://policies.google.com/privacy). This is independent from Chrome browser metrics.
481+
Set to false to opt-out of usage statistics collection. Google collects usage data to improve the tool, handled under the Google Privacy Policy (https://policies.google.com/privacy). This is independent from Chrome browser metrics. Disabled if CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS or CI env variables are set.
480482
- **Type:** boolean
481483
- **Default:** `true`
482484

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chrome-devtools-mcp",
3-
"version": "0.14.0",
3+
"version": "0.15.1",
44
"description": "MCP server for Chrome DevTools",
55
"type": "module",
66
"bin": "./build/src/index.js",
@@ -22,7 +22,7 @@
2222
"test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
2323
"prepare": "node --experimental-strip-types scripts/prepare.ts",
2424
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts",
25-
"eval": "npm run build && node --experimental-strip-types scripts/eval_gemini.ts",
25+
"eval": "npm run build && CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=true node --experimental-strip-types scripts/eval_gemini.ts",
2626
"count-tokens": "node --experimental-strip-types scripts/count_tokens.ts"
2727
},
2828
"files": [

rollup.config.mjs

Lines changed: 85 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
/**
19-
* @fileoverview take from {@link https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/rollup.config.mjs | chromium-bidi}
19+
* @fileoverview taken from {@link https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/rollup.config.mjs | chromium-bidi}
2020
* and modified to specific requirement.
2121
*/
2222

@@ -41,23 +41,99 @@ const allowedLicenses = [
4141
'0BSD',
4242
];
4343

44+
const thirdPartyDir = './build/src/third_party';
45+
46+
const {devDependencies = {}} = JSON.parse(
47+
fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'),
48+
);
49+
50+
// special case for puppeteer, from which we only bundle puppeteer-core
51+
devDependencies['puppeteer-core'] = devDependencies['puppeteer'];
52+
53+
const aggregatedStats = {
54+
bundlesProcessed: 0,
55+
totalBundles: 0,
56+
bundledPackages: new Set(),
57+
};
58+
59+
const projectNodeModulesPath =
60+
path.join(process.cwd(), 'node_modules') + path.sep;
61+
62+
function getPackageName(modulePath) {
63+
// Handle rollup's virtual module paths (paths starting with 0x00)
64+
const absolutePathStart = modulePath.indexOf(projectNodeModulesPath);
65+
if (absolutePathStart < 0) {
66+
return null;
67+
}
68+
69+
const relativePath = modulePath.slice(
70+
projectNodeModulesPath.length + absolutePathStart,
71+
);
72+
const segments = relativePath.split(path.sep);
73+
74+
// handle scoped packages
75+
if (segments[0].startsWith('@') && segments[1]) {
76+
return `${segments[0]}/${segments[1]}`;
77+
}
78+
return segments[0];
79+
}
80+
81+
/**
82+
* @returns {import('rollup').Plugin}
83+
*/
84+
function listBundledDeps() {
85+
aggregatedStats.totalBundles++;
86+
return {
87+
name: 'gather-bundled-dependencies',
88+
generateBundle(options, bundle) {
89+
for (const chunk of Object.values(bundle)) {
90+
if (chunk.type === 'chunk' && chunk.modules) {
91+
// chunk.modules is an object where keys are the absolute file paths
92+
Object.keys(chunk.modules).forEach(modulePath => {
93+
const packageName = getPackageName(modulePath);
94+
if (packageName) {
95+
aggregatedStats.bundledPackages.add(packageName);
96+
}
97+
});
98+
}
99+
}
100+
aggregatedStats.bundlesProcessed++;
101+
102+
// Only write the file when the last bundle is finished
103+
if (aggregatedStats.bundlesProcessed === aggregatedStats.totalBundles) {
104+
const outputPath = path.join(thirdPartyDir, 'bundled-packages.json');
105+
106+
const bundledDevDeps = Object.fromEntries(
107+
Object.entries(devDependencies).filter(
108+
([name]) =>
109+
aggregatedStats.bundledPackages.has(name) ||
110+
name === 'chrome-devtools-frontend',
111+
),
112+
);
113+
114+
fs.writeFileSync(outputPath, JSON.stringify(bundledDevDeps, null, 2));
115+
}
116+
},
117+
};
118+
}
119+
44120
const seenDependencies = new Map();
45121

46122
/**
47-
* @param {string} wrapperIndexPath
123+
* @param {string} wrapperIndexName
48124
* @param {import('rollup').OutputOptions} [extraOutputOptions={}]
49125
* @param {import('rollup').ExternalOption} [external=[]]
50126
* @returns {import('rollup').RollupOptions}
51127
*/
52128
const bundleDependency = (
53-
wrapperIndexPath,
129+
wrapperIndexName,
54130
extraOutputOptions = {},
55131
external = [],
56132
) => ({
57-
input: wrapperIndexPath,
133+
input: path.join(thirdPartyDir, wrapperIndexName),
58134
output: {
59135
...extraOutputOptions,
60-
file: wrapperIndexPath,
136+
file: path.join(thirdPartyDir, wrapperIndexName),
61137
sourcemap: !isProduction,
62138
format: 'esm',
63139
},
@@ -78,10 +154,7 @@ const bundleDependency = (
78154
failOnViolation: true,
79155
},
80156
output: {
81-
file: path.join(
82-
path.dirname(wrapperIndexPath),
83-
'THIRD_PARTY_NOTICES',
84-
),
157+
file: path.join(thirdPartyDir, 'THIRD_PARTY_NOTICES'),
85158
template(dependencies) {
86159
for (const dependency of dependencies) {
87160
const key = `${dependency.name}:${dependency.version}`;
@@ -164,6 +237,7 @@ const bundleDependency = (
164237
},
165238
},
166239
}),
240+
listBundledDeps(),
167241
commonjs(),
168242
json(),
169243
nodeResolve(),
@@ -173,7 +247,7 @@ const bundleDependency = (
173247

174248
export default [
175249
bundleDependency(
176-
'./build/src/third_party/index.js',
250+
'index.js',
177251
{
178252
inlineDynamicImports: true,
179253
},
@@ -195,7 +269,7 @@ export default [
195269
},
196270
),
197271
bundleDependency(
198-
'./build/src/third_party/devtools-formatter-worker.js',
272+
'devtools-formatter-worker.js',
199273
{
200274
inlineDynamicImports: true,
201275
},

scripts/test.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ async function runTests(attempt) {
6565
return new Promise(resolve => {
6666
const child = spawn('node', nodeArgs, {
6767
stdio: 'inherit',
68+
env: {
69+
...process.env,
70+
CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: true,
71+
},
6872
});
6973

7074
child.on('close', code => {

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
"url": "https://github.com/ChromeDevTools/chrome-devtools-mcp",
88
"source": "github"
99
},
10-
"version": "0.14.0",
10+
"version": "0.15.1",
1111
"packages": [
1212
{
1313
"registryType": "npm",
1414
"registryBaseUrl": "https://registry.npmjs.org",
1515
"identifier": "chrome-devtools-mcp",
16-
"version": "0.14.0",
16+
"version": "0.15.1",
1717
"transport": {
1818
"type": "stdio"
1919
},

src/McpContext.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,10 @@ export class McpContext implements Context {
733733
return new WaitForHelper(page, cpuMultiplier, networkMultiplier);
734734
}
735735

736-
waitForEventsAfterAction(action: () => Promise<unknown>): Promise<void> {
736+
waitForEventsAfterAction(
737+
action: () => Promise<unknown>,
738+
options?: {timeout?: number},
739+
): Promise<void> {
737740
const page = this.getSelectedPage();
738741
const cpuMultiplier = this.getCpuThrottlingRate();
739742
const networkMultiplier = getNetworkMultiplierFromString(
@@ -744,7 +747,7 @@ export class McpContext implements Context {
744747
cpuMultiplier,
745748
networkMultiplier,
746749
);
747-
return waitForHelper.waitForEventsAfterAction(action);
750+
return waitForHelper.waitForEventsAfterAction(action, options);
748751
}
749752

750753
getNetworkRequestStableId(request: HTTPRequest): number {

src/WaitForHelper.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,13 @@ export class WaitForHelper {
125125

126126
async waitForEventsAfterAction(
127127
action: () => Promise<unknown>,
128+
options?: {timeout?: number},
128129
): Promise<void> {
129130
const navigationFinished = this.waitForNavigationStarted()
130131
.then(navigationStated => {
131132
if (navigationStated) {
132133
return this.#page.waitForNavigation({
133-
timeout: this.#navigationTimeout,
134+
timeout: options?.timeout ?? this.#navigationTimeout,
134135
signal: this.#abortController.signal,
135136
});
136137
}

0 commit comments

Comments
 (0)