Skip to content

Commit f60c8a4

Browse files
committed
feat: port chrome-devtools-mcp to Brave Browser
1 parent 0331f6a commit f60c8a4

42 files changed

Lines changed: 853 additions & 290 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude-plugin/plugin.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "chrome-devtools-mcp",
3-
"version": "0.21.0",
4-
"description": "Reliable automation, in-depth debugging, and performance analysis in Chrome using Chrome DevTools and Puppeteer",
2+
"name": "brave-mcp",
3+
"version": "0.1.0",
4+
"description": "Reliable automation, in-depth debugging, and performance analysis in Brave using DevTools and Puppeteer",
55
"mcpServers": {
6-
"chrome-devtools": {
6+
"brave-devtools": {
77
"command": "npx",
8-
"args": ["chrome-devtools-mcp@latest"]
8+
"args": ["brave-mcp@latest"]
99
}
1010
}
1111
}

.mcp.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"mcpServers": {
3-
"chrome-devtools": {
3+
"brave-devtools": {
44
"command": "npx",
5-
"args": ["chrome-devtools-mcp@latest"]
5+
"args": ["brave-mcp@latest"]
66
}
77
}
88
}

package-lock.json

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

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2-
"name": "chrome-devtools-mcp",
3-
"version": "0.21.0",
4-
"description": "MCP server for Chrome DevTools",
2+
"name": "brave-mcp",
3+
"version": "0.1.1",
4+
"description": "MCP server for Brave DevTools",
55
"type": "module",
66
"bin": {
7-
"chrome-devtools-mcp": "./build/src/bin/chrome-devtools-mcp.js",
8-
"chrome-devtools": "./build/src/bin/chrome-devtools.js"
7+
"brave-mcp": "./build/src/bin/brave-devtools-mcp.js",
8+
"brave-devtools-mcp": "./build/src/bin/brave-devtools-mcp.js",
9+
"brave-devtools": "./build/src/bin/brave-devtools.js"
910
},
1011
"main": "./build/src/index.js",
1112
"scripts": {
@@ -24,6 +25,7 @@
2425
"test:no-build": "node scripts/test.mjs",
2526
"test:only": "npm run build && node scripts/test.mjs --test-only",
2627
"test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
28+
"test:brave": "npm run build && node tests/e2e/brave-integration.test.mjs",
2729
"prepare": "node --experimental-strip-types scripts/prepare.ts",
2830
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts",
2931
"update-lighthouse": "node --experimental-strip-types scripts/update-lighthouse.ts",
@@ -37,14 +39,14 @@
3739
"LICENSE",
3840
"!*.tsbuildinfo"
3941
],
40-
"repository": "ChromeDevTools/chrome-devtools-mcp",
41-
"author": "Google LLC",
42+
"repository": "triuzzi/brave-devtools-mcp",
43+
"author": "Emanuele Triuzzi",
4244
"license": "Apache-2.0",
4345
"bugs": {
44-
"url": "https://github.com/ChromeDevTools/chrome-devtools-mcp/issues"
46+
"url": "https://github.com/triuzzi/brave-devtools-mcp/issues"
4547
},
46-
"homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
47-
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
48+
"homepage": "https://github.com/triuzzi/brave-devtools-mcp#readme",
49+
"mcpName": "io.github.triuzzi/brave-devtools-mcp",
4850
"devDependencies": {
4951
"@eslint/js": "^9.35.0",
5052
"@google/genai": "^1.37.0",

server.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
22
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3-
"name": "io.github.ChromeDevTools/chrome-devtools-mcp",
4-
"title": "Chrome DevTools MCP",
5-
"description": "MCP server for Chrome DevTools",
3+
"name": "io.github.triuzzi/brave-mcp",
4+
"title": "Brave MCP",
5+
"description": "MCP server for Brave Browser DevTools",
66
"repository": {
7-
"url": "https://github.com/ChromeDevTools/chrome-devtools-mcp",
7+
"url": "https://github.com/triuzzi/brave-devtools-mcp",
88
"source": "github"
99
},
10-
"version": "0.21.0",
10+
"version": "0.1.0",
1111
"packages": [
1212
{
1313
"registryType": "npm",
1414
"registryBaseUrl": "https://registry.npmjs.org",
15-
"identifier": "chrome-devtools-mcp",
16-
"version": "0.21.0",
15+
"identifier": "brave-mcp",
16+
"version": "0.1.0",
1717
"transport": {
1818
"type": "stdio"
1919
},

src/McpResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type {WebMCPTool} from 'puppeteer-core';
88

9-
import type {ParsedArguments} from './bin/chrome-devtools-mcp-cli-options.js';
9+
import type {ParsedArguments} from './bin/brave-devtools-mcp-cli-options.js';
1010
import {ConsoleFormatter} from './formatters/ConsoleFormatter.js';
1111
import {HeapSnapshotFormatter} from './formatters/HeapSnapshotFormatter.js';
1212
import {IssueFormatter} from './formatters/IssueFormatter.js';

src/bin/chrome-devtools-mcp-cli-options.ts renamed to src/bin/brave-devtools-mcp-cli-options.ts

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const cliOptions = {
1111
autoConnect: {
1212
type: 'boolean',
1313
description:
14-
'If specified, automatically connects to a browser (Chrome 144+) running locally from the user data directory identified by the channel param (default channel is stable). Requires the remote debugging server to be started in the Chrome instance via chrome://inspect/#remote-debugging.',
14+
'If specified, automatically connects to a Brave instance running locally from the user data directory identified by the channel param (default channel is release). Requires the remote debugging server to be started in the Brave instance via brave://inspect/#remote-debugging.',
1515
conflicts: ['isolated', 'executablePath', 'categoryExtensions'],
1616
default: false,
1717
coerce: (value: boolean | undefined) => {
@@ -24,7 +24,7 @@ export const cliOptions = {
2424
browserUrl: {
2525
type: 'string',
2626
description:
27-
'Connect to a running, debuggable Chrome instance (e.g. `http://127.0.0.1:9222`). For more details see: https://github.com/ChromeDevTools/chrome-devtools-mcp#connecting-to-a-running-chrome-instance.',
27+
'Connect to a running, debuggable Brave instance (e.g. `http://127.0.0.1:9222`).',
2828
alias: 'u',
2929
conflicts: ['wsEndpoint', 'categoryExtensions'],
3030
coerce: (url: string | undefined) => {
@@ -42,7 +42,7 @@ export const cliOptions = {
4242
wsEndpoint: {
4343
type: 'string',
4444
description:
45-
'WebSocket endpoint to connect to a running Chrome instance (e.g., ws://127.0.0.1:9222/devtools/browser/<id>). Alternative to --browserUrl.',
45+
'WebSocket endpoint to connect to a running Brave instance (e.g., ws://127.0.0.1:9222/devtools/browser/<id>). Alternative to --browserUrl.',
4646
alias: 'w',
4747
conflicts: ['browserUrl', 'categoryExtensions'],
4848
coerce: (url: string | undefined) => {
@@ -94,7 +94,7 @@ export const cliOptions = {
9494
},
9595
executablePath: {
9696
type: 'string',
97-
description: 'Path to custom Chrome executable.',
97+
description: 'Path to custom Brave executable. Can also be set via BRAVE_PATH environment variable.',
9898
conflicts: ['browserUrl', 'wsEndpoint'],
9999
alias: 'e',
100100
},
@@ -106,14 +106,14 @@ export const cliOptions = {
106106
userDataDir: {
107107
type: 'string',
108108
description:
109-
'Path to the user data directory for Chrome. Default is $HOME/.cache/chrome-devtools-mcp/chrome-profile$CHANNEL_SUFFIX_IF_NON_STABLE',
109+
'Path to the user data directory for Brave. Default is $HOME/.cache/brave-devtools-mcp/brave-profile$CHANNEL_SUFFIX_IF_NON_RELEASE',
110110
conflicts: ['browserUrl', 'wsEndpoint', 'isolated'],
111111
},
112112
channel: {
113113
type: 'string',
114114
description:
115-
'Specify a different Chrome channel that should be used. The default is the stable channel version.',
116-
choices: ['stable', 'canary', 'beta', 'dev'] as const,
115+
'Specify a different Brave channel that should be used. The default is the release channel.',
116+
choices: ['release', 'beta', 'nightly', 'dev'] as const,
117117
conflicts: ['browserUrl', 'wsEndpoint', 'executablePath'],
118118
},
119119
logFile: {
@@ -124,7 +124,7 @@ export const cliOptions = {
124124
viewport: {
125125
type: 'string',
126126
describe:
127-
'Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',
127+
'Initial viewport size for the Brave instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.',
128128
coerce: (arg: string | undefined) => {
129129
if (arg === undefined) {
130130
return;
@@ -141,7 +141,7 @@ export const cliOptions = {
141141
},
142142
proxyServer: {
143143
type: 'string',
144-
description: `Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.`,
144+
description: `Proxy server configuration for Brave passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.`,
145145
},
146146
acceptInsecureCerts: {
147147
type: 'boolean',
@@ -193,17 +193,17 @@ export const cliOptions = {
193193
experimentalWebmcp: {
194194
type: 'boolean',
195195
describe:
196-
'Set to true to enable debugging WebMCP tools. Requires Chrome 149+ with the following flags: `--enable-features=WebMCPTesting,DevToolsWebMCPSupport`',
196+
'Set to true to enable debugging WebMCP tools. Requires Brave with the following flags: `--enable-features=WebMCPTesting,DevToolsWebMCPSupport`',
197197
},
198-
chromeArg: {
198+
braveArg: {
199199
type: 'array',
200200
describe:
201-
'Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
201+
'Additional arguments for Brave. Only applies when Brave is launched by brave-devtools-mcp.',
202202
},
203-
ignoreDefaultChromeArg: {
203+
ignoreDefaultBraveArg: {
204204
type: 'array',
205205
describe:
206-
'Explicitly disable default arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.',
206+
'Explicitly disable default arguments for Brave. Only applies when Brave is launched by brave-devtools-mcp.',
207207
},
208208
categoryEmulation: {
209209
type: 'boolean',
@@ -241,9 +241,9 @@ export const cliOptions = {
241241
},
242242
usageStatistics: {
243243
type: 'boolean',
244-
default: true,
244+
default: false,
245245
describe:
246-
'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.',
246+
'Usage statistics collection (disabled by default in this fork).',
247247
},
248248
clearcutEndpoint: {
249249
type: 'string',
@@ -268,7 +268,7 @@ export const cliOptions = {
268268
viaCli: {
269269
type: 'boolean',
270270
describe:
271-
'Set by Chrome DevTools CLI if the MCP server is started via the CLI client (this arg exists for usage stats)',
271+
'Set by Brave DevTools CLI if the MCP server is started via the CLI client (this arg exists for usage stats)',
272272
hidden: true,
273273
},
274274
redactNetworkHeaders: {
@@ -283,50 +283,48 @@ export type ParsedArguments = ReturnType<typeof parseArguments>;
283283

284284
export function parseArguments(version: string, argv = process.argv) {
285285
const yargsInstance = yargs(hideBin(argv))
286-
.scriptName('npx chrome-devtools-mcp@latest')
286+
.scriptName('npx brave-devtools-mcp@latest')
287287
.options(cliOptions)
288288
.check(args => {
289-
// We can't set default in the options else
290-
// Yargs will complain
291289
if (
292290
!args.channel &&
293291
!args.browserUrl &&
294292
!args.wsEndpoint &&
295293
!args.executablePath
296294
) {
297-
args.channel = 'stable';
295+
args.channel = 'release';
298296
}
299297
return true;
300298
})
301299
.example([
302300
[
303301
'$0 --browserUrl http://127.0.0.1:9222',
304-
'Connect to an existing browser instance via HTTP',
302+
'Connect to an existing Brave instance via HTTP',
305303
],
306304
[
307305
'$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123',
308-
'Connect to an existing browser instance via WebSocket',
306+
'Connect to an existing Brave instance via WebSocket',
309307
],
310308
[
311309
`$0 --wsEndpoint ws://127.0.0.1:9222/devtools/browser/abc123 --wsHeaders '{"Authorization":"Bearer token"}'`,
312310
'Connect via WebSocket with custom headers',
313311
],
314-
['$0 --channel beta', 'Use Chrome Beta installed on this system'],
315-
['$0 --channel canary', 'Use Chrome Canary installed on this system'],
316-
['$0 --channel dev', 'Use Chrome Dev installed on this system'],
317-
['$0 --channel stable', 'Use stable Chrome installed on this system'],
312+
['$0 --channel beta', 'Use Brave Beta installed on this system'],
313+
['$0 --channel nightly', 'Use Brave Nightly installed on this system'],
314+
['$0 --channel dev', 'Use Brave Dev installed on this system'],
315+
['$0 --channel release', 'Use release Brave installed on this system'],
318316
['$0 --logFile /tmp/log.txt', 'Save logs to a file'],
319317
['$0 --help', 'Print CLI options'],
320318
[
321319
'$0 --viewport 1280x720',
322-
'Launch Chrome with the initial viewport size of 1280x720px',
320+
'Launch Brave with the initial viewport size of 1280x720px',
323321
],
324322
[
325-
`$0 --chrome-arg='--no-sandbox' --chrome-arg='--disable-setuid-sandbox'`,
326-
'Launch Chrome without sandboxes. Use with caution.',
323+
`$0 --brave-arg='--no-sandbox' --brave-arg='--disable-setuid-sandbox'`,
324+
'Launch Brave without sandboxes. Use with caution.',
327325
],
328326
[
329-
`$0 --ignore-default-chrome-arg='--disable-extensions'`,
327+
`$0 --ignore-default-brave-arg='--disable-extensions'`,
330328
'Disable the default arguments provided by Puppeteer. Use with caution.',
331329
],
332330
['$0 --no-category-emulation', 'Disable tools in the emulation category'],
@@ -341,19 +339,11 @@ export function parseArguments(version: string, argv = process.argv) {
341339
],
342340
[
343341
'$0 --auto-connect',
344-
'Connect to a stable Chrome instance (Chrome 144+) running instead of launching a new instance',
345-
],
346-
[
347-
'$0 --auto-connect --channel=canary',
348-
'Connect to a canary Chrome instance (Chrome 144+) running instead of launching a new instance',
349-
],
350-
[
351-
'$0 --no-usage-statistics',
352-
'Do not send usage statistics https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics.',
342+
'Connect to a release Brave instance running instead of launching a new instance',
353343
],
354344
[
355-
'$0 --no-performance-crux',
356-
'Disable CrUX (field data) integration in performance tools.',
345+
'$0 --auto-connect --channel=nightly',
346+
'Connect to a nightly Brave instance running instead of launching a new instance',
357347
],
358348
[
359349
'$0 --slim',
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,36 @@ import {createMcpServer, logDisclaimers} from '../index.js';
1212
import {logger, saveLogsToFile} from '../logger.js';
1313
import {computeFlagUsage} from '../telemetry/flagUtils.js';
1414
import {StdioServerTransport} from '../third_party/index.js';
15-
import {checkForUpdates} from '../utils/check-for-updates.js';
1615
import {VERSION} from '../version.js';
1716

18-
import {cliOptions, parseArguments} from './chrome-devtools-mcp-cli-options.js';
19-
20-
await checkForUpdates(
21-
'Run `npm install chrome-devtools-mcp@latest` to update.',
22-
);
17+
import {cliOptions, parseArguments} from './brave-devtools-mcp-cli-options.js';
2318

2419
export const args = parseArguments(VERSION);
2520

2621
const logFile = args.logFile ? saveLogsToFile(args.logFile) : undefined;
2722
if (
2823
process.env['CI'] ||
29-
process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS']
24+
process.env['BRAVE_DEVTOOLS_MCP_NO_USAGE_STATISTICS']
3025
) {
3126
console.error(
32-
"turning off usage statistics. process.env['CI'] || process.env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.",
27+
"turning off usage statistics. process.env['CI'] || process.env['BRAVE_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] is set.",
3328
);
3429
args.usageStatistics = false;
3530
}
3631

37-
if (process.env['CHROME_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT'] !== 'true') {
32+
if (process.env['BRAVE_DEVTOOLS_MCP_CRASH_ON_UNCAUGHT'] !== 'true') {
3833
process.on('unhandledRejection', (reason, promise) => {
3934
logger('Unhandled promise rejection', promise, reason);
4035
});
4136
}
4237

43-
logger(`Starting Chrome DevTools MCP Server v${VERSION}`);
38+
logger(`Starting Brave DevTools MCP Server v${VERSION}`);
4439
const {server, clearcutLogger} = await createMcpServer(args, {
4540
logFile,
4641
});
4742
const transport = new StdioServerTransport();
4843
await server.connect(transport);
49-
logger('Chrome DevTools MCP Server connected');
44+
logger('Brave DevTools MCP Server connected');
5045
logDisclaimers(args);
5146
void clearcutLogger?.logDailyActiveIfNeeded();
5247
void clearcutLogger?.logServerStart(computeFlagUsage(args, cliOptions));

0 commit comments

Comments
 (0)