Skip to content

Commit fd741a6

Browse files
committed
chore: experimental devtools
1 parent f3e1755 commit fd741a6

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/browser.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ export async function ensureBrowserConnected(options: {
5252
targetFilter: makeTargetFilter(options.devtools),
5353
browserURL: options.browserURL,
5454
defaultViewport: null,
55-
// @ts-expect-error no types.
56-
_isPageTarget(target) {
57-
return (
58-
target.type() === 'other' && target.url().startsWith('devtools://')
59-
);
60-
},
55+
handleDevToolsAsPage: options.devtools,
6156
});
6257
return browser;
6358
}
@@ -77,7 +72,7 @@ interface McpLaunchOptions {
7772
};
7873
args?: string[];
7974
devtools: boolean;
80-
};
75+
}
8176

8277
export async function launch(options: McpLaunchOptions): Promise<Browser> {
8378
const {channel, executablePath, customDevTools, headless, isolated} = options;
@@ -131,12 +126,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
131126
headless,
132127
args,
133128
acceptInsecureCerts: options.acceptInsecureCerts,
134-
// @ts-expect-error no types.
135-
_isPageTarget(target) {
136-
return (
137-
target.type() === 'other' && target.url().startsWith('devtools://')
138-
);
139-
},
129+
handleDevToolsAsPage: options.devtools,
140130
});
141131
if (options.logFile) {
142132
// FIXME: we are probably subscribing too late to catch startup logs. We

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ async function getContext(): Promise<McpContext> {
7676
const devtools = args.experimentalDevtools ?? false;
7777
const browser = args.browserUrl
7878
? await ensureBrowserConnected({
79-
browserURL: args.browserUrl,
80-
devtools,
81-
})
79+
browserURL: args.browserUrl,
80+
devtools,
81+
})
8282
: await ensureBrowserLaunched({
8383
headless: args.headless,
8484
executablePath: args.executablePath,

0 commit comments

Comments
 (0)