From 4e0faa86ac62c760b96489cb521f4ab9367dea17 Mon Sep 17 00:00:00 2001 From: Ergun Erdogmus Date: Mon, 12 Jan 2026 13:40:01 +0100 Subject: [PATCH 1/2] chore: add usage statistics CLI flag --- src/cli.ts | 8 ++++++++ src/main.ts | 8 ++++++++ tests/cli.test.ts | 24 ++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/src/cli.ts b/src/cli.ts index db2680587..8d71f8d9e 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -178,6 +178,14 @@ export const cliOptions = { default: true, describe: 'Set to false to exclude tools related to network.', }, + usageStatistics: { + type: 'boolean', + // Marked as `false` until the feature is ready to be enabled by default. + default: false, + hidden: true, + describe: + 'Set to false to opt-out of usage statistics collection.', + }, } satisfies Record; export function parseArguments(version: string, argv = process.argv) { diff --git a/src/main.ts b/src/main.ts index 84bb6d9b5..0d3bf7e7a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -98,6 +98,14 @@ const logDisclaimers = () => { debug, and modify any data in the browser or DevTools. Avoid sharing sensitive or personal information that you do not want to share with MCP clients.`, ); + + if (args.usageStatistics) { + console.error( + ` +Google collects usage statistics to improve Chrome DevTools MCP. To opt-out, run with --no-usage-statistics. +For more details, visit: https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics`, + ); + } }; const toolMutex = new Mutex(); diff --git a/tests/cli.test.ts b/tests/cli.test.ts index 1312e630b..e46dee64d 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -19,6 +19,8 @@ describe('cli args parsing', () => { categoryNetwork: true, 'auto-connect': undefined, autoConnect: undefined, + 'usage-statistics': false, + usageStatistics: false, }; it('parses with default args', async () => { @@ -222,4 +224,26 @@ describe('cli args parsing', () => { autoConnect: true, }); }); + + it('parses usage statistics flag', async () => { + // Test default (should be false) + const defaultArgs = parseArguments('1.0.0', ['node', 'main.js']); + assert.strictEqual(defaultArgs.usageStatistics, false); + + // Test enabling it + const enabledArgs = parseArguments('1.0.0', [ + 'node', + 'main.js', + '--usage-statistics', + ]); + assert.strictEqual(enabledArgs.usageStatistics, true); + + // Test disabling it + const disabledArgs = parseArguments('1.0.0', [ + 'node', + 'main.js', + '--no-usage-statistics', + ]); + assert.strictEqual(disabledArgs.usageStatistics, false); + }); }); From d56451b7dafc9ac0f9b3bed8a0b3a0d611f6492f Mon Sep 17 00:00:00 2001 From: Ergun Erdogmus Date: Mon, 12 Jan 2026 14:47:37 +0100 Subject: [PATCH 2/2] chore: fix formatting --- src/cli.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 8d71f8d9e..be691dfb0 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -183,8 +183,7 @@ export const cliOptions = { // Marked as `false` until the feature is ready to be enabled by default. default: false, hidden: true, - describe: - 'Set to false to opt-out of usage statistics collection.', + describe: 'Set to false to opt-out of usage statistics collection.', }, } satisfies Record;