File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,14 @@ export const cliOptions = {
178178 default : true ,
179179 describe : 'Set to false to exclude tools related to network.' ,
180180 } ,
181+ usageStatistics : {
182+ type : 'boolean' ,
183+ // Marked as `false` until the feature is ready to be enabled by default.
184+ default : false ,
185+ hidden : true ,
186+ describe :
187+ 'Set to false to opt-out of usage statistics collection.' ,
188+ } ,
181189} satisfies Record < string , YargsOptions > ;
182190
183191export function parseArguments ( version : string , argv = process . argv ) {
Original file line number Diff line number Diff line change @@ -98,6 +98,14 @@ const logDisclaimers = () => {
9898debug, and modify any data in the browser or DevTools.
9999Avoid sharing sensitive or personal information that you do not want to share with MCP clients.` ,
100100 ) ;
101+
102+ if ( args . usageStatistics ) {
103+ console . error (
104+ `
105+ Google collects usage statistics to improve Chrome DevTools MCP. To opt-out, run with --no-usage-statistics.
106+ For more details, visit: https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics` ,
107+ ) ;
108+ }
101109} ;
102110
103111const toolMutex = new Mutex ( ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ describe('cli args parsing', () => {
1919 categoryNetwork : true ,
2020 'auto-connect' : undefined ,
2121 autoConnect : undefined ,
22+ 'usage-statistics' : false ,
23+ usageStatistics : false ,
2224 } ;
2325
2426 it ( 'parses with default args' , async ( ) => {
@@ -222,4 +224,26 @@ describe('cli args parsing', () => {
222224 autoConnect : true ,
223225 } ) ;
224226 } ) ;
227+
228+ it ( 'parses usage statistics flag' , async ( ) => {
229+ // Test default (should be false)
230+ const defaultArgs = parseArguments ( '1.0.0' , [ 'node' , 'main.js' ] ) ;
231+ assert . strictEqual ( defaultArgs . usageStatistics , false ) ;
232+
233+ // Test enabling it
234+ const enabledArgs = parseArguments ( '1.0.0' , [
235+ 'node' ,
236+ 'main.js' ,
237+ '--usage-statistics' ,
238+ ] ) ;
239+ assert . strictEqual ( enabledArgs . usageStatistics , true ) ;
240+
241+ // Test disabling it
242+ const disabledArgs = parseArguments ( '1.0.0' , [
243+ 'node' ,
244+ 'main.js' ,
245+ '--no-usage-statistics' ,
246+ ] ) ;
247+ assert . strictEqual ( disabledArgs . usageStatistics , false ) ;
248+ } ) ;
225249} ) ;
You can’t perform that action at this time.
0 commit comments