diff --git a/README.md b/README.md index cec038815..ce5f29a00 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/package.json b/package.json index 90c7d3a62..5288c32cd 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/scripts/test.mjs b/scripts/test.mjs index 5605156f4..80ccd7dbc 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -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 => { diff --git a/src/cli.ts b/src/cli.ts index aa9fbe097..c06b9063d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -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', diff --git a/src/main.ts b/src/main.ts index 6ba8ddf41..75833411c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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({ diff --git a/tests/e2e/telemetry.test.ts b/tests/e2e/telemetry.test.ts index b5768a6b2..10051a676 100644 --- a/tests/e2e/telemetry.test.ts +++ b/tests/e2e/telemetry.test.ts @@ -182,6 +182,8 @@ describe('Telemetry E2E', () => { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, + CI: undefined, + CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: undefined, }, ...spawnOptions, },