Skip to content

Commit 1934369

Browse files
committed
fix: make the browser instance debuggable
1 parent 0a84444 commit 1934369

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@privatewebai/chrome-devtools-mcp",
3-
"version": "0.12.5",
3+
"version": "0.12.6",
44
"description": "MCP server for Chrome DevTools",
55
"type": "module",
66
"bin": "./build/src/index.js",

src/browser.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
185185
args.push('--enable-automation');
186186
args.push('--no-default-browser-check');
187187
args.push('--disable-background-networking');
188+
args.push('--remote-debugging-port=9222');
188189
}
189190

190191
let puppeteerChannel: ChromeReleaseChannel | undefined;
@@ -198,6 +199,9 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
198199
: 'chrome';
199200
}
200201

202+
// Check if a remote debugging port is specified in args
203+
const hasDebugPort = args.some(arg => arg.includes('--remote-debugging-port'));
204+
201205
try {
202206
const browser = await puppeteer.launch({
203207
ignoreDefaultArgs: true,
@@ -206,7 +210,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
206210
executablePath,
207211
defaultViewport: null,
208212
userDataDir,
209-
pipe: true,
213+
pipe: !hasDebugPort, // Use port-based debugging if --remote-debugging-port is specified
210214
headless,
211215
args,
212216
acceptInsecureCerts: options.acceptInsecureCerts,

0 commit comments

Comments
 (0)