fix: disable usage statistics when CI or CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS env is set (#862)

When CI or CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS env variables are
set, we override the set cli args and disable the usage statistics.
This commit is contained in:
Alex Rudenko authored and GitHub committed 2026-01-30 07:58:45 +00:00
1 parent 3e816aed12
commit c0435a2d53
6 files changed
+21 -3

No files matched your search

+3 -1
View File
@@ -41,6 +41,8 @@ Google handles this data in accordance with the [Google Privacy Policy](https://
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.
Collection is disabled if CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS or CI env variables are set.
## Requirements
- [Node.js](https://nodejs.org/) v20.19 or a newer [latest maintenance LTS](https://github.com/nodejs/Release#release-schedule) version.
@@ -465,7 +467,7 @@ The Chrome DevTools MCP server supports the following configuration option:
- **Default:** `true`
- **`--usageStatistics`/ `--usage-statistics`**
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.
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.
- **Type:** boolean
- **Default:** `true`
+1 -1
View File
@@ -22,7 +22,7 @@
"test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
"prepare": "node --experimental-strip-types scripts/prepare.ts",
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts",
"eval": "npm run build && node --experimental-strip-types scripts/eval_gemini.ts",
"eval": "npm run build && CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=true node --experimental-strip-types scripts/eval_gemini.ts",
"count-tokens": "node --experimental-strip-types scripts/count_tokens.ts"
},
"files": [
+4
View File
@@ -65,6 +65,10 @@ async function runTests(attempt) {
return new Promise(resolve => {
const child = spawn('node', nodeArgs, {
stdio: 'inherit',
env: {
...process.env,
CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: true,
},
});
child.on('close', code => {
+1 -1
View File
@@ -208,7 +208,7 @@ export const cliOptions = {
type: 'boolean',
default: true,
describe:
'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.',
'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.',
},
clearcutEndpoint: {
type: 'string',
+10
View File
@@ -37,6 +37,16 @@ const VERSION = '0.15.0';
export const args = parseArguments(VERSION);
const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
if (
process.env['CI'] ||
process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']
) {
console.error(
"turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.",
);
args.usageStatistics = false;
}
let clearcutLogger: ClearcutLogger | undefined;
if (args.usageStatistics) {
clearcutLogger = new ClearcutLogger({
+2
View File
@@ -182,6 +182,8 @@ describe('Telemetry E2E', () => {
stdio: ['pipe', 'pipe', 'pipe'],
env: {
...process.env,
CI: undefined,
CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: undefined,
},
...spawnOptions,
},