Skip to content

Commit 2b95464

Browse files
authored
chore: remove server experiment (microsoft#681)
1 parent b5daee5 commit 2b95464

File tree

7 files changed

+0
-319
lines changed

7 files changed

+0
-319
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ Playwright MCP server supports following arguments. They can be provided in the
192192
--block-service-workers block service workers
193193
--browser <browser> browser or chrome channel to use, possible
194194
values: chrome, firefox, webkit, msedge.
195-
--browser-agent <endpoint> Use browser agent (experimental).
196195
--caps <caps> comma-separated list of additional capabilities
197196
to enable, possible values: vision, pdf.
198197
--cdp-endpoint <endpoint> CDP endpoint to connect to.

config.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ export type Config = {
2323
* The browser to use.
2424
*/
2525
browser?: {
26-
/**
27-
* Use browser agent (experimental).
28-
*/
29-
browserAgent?: string;
30-
3126
/**
3227
* The type of browser to use.
3328
*/

src/browserContextFactory.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ import os from 'node:os';
2121

2222
import debug from 'debug';
2323
import * as playwright from 'playwright';
24-
import { userDataDir } from './fileUtils.js';
2524

2625
import type { FullConfig } from './config.js';
27-
import type { BrowserInfo, LaunchBrowserRequest } from './browserServer.js';
2826

2927
const testDebug = debug('pw:mcp:test');
3028

@@ -35,8 +33,6 @@ export function contextFactory(browserConfig: FullConfig['browser']): BrowserCon
3533
return new CdpContextFactory(browserConfig);
3634
if (browserConfig.isolated)
3735
return new IsolatedContextFactory(browserConfig);
38-
if (browserConfig.browserAgent)
39-
return new BrowserServerContextFactory(browserConfig);
4036
return new PersistentContextFactory(browserConfig);
4137
}
4238

@@ -217,38 +213,6 @@ class PersistentContextFactory implements BrowserContextFactory {
217213
}
218214
}
219215

220-
export class BrowserServerContextFactory extends BaseContextFactory {
221-
constructor(browserConfig: FullConfig['browser']) {
222-
super('persistent', browserConfig);
223-
}
224-
225-
protected override async _doObtainBrowser(): Promise<playwright.Browser> {
226-
const response = await fetch(new URL(`/json/launch`, this.browserConfig.browserAgent), {
227-
method: 'POST',
228-
body: JSON.stringify({
229-
browserType: this.browserConfig.browserName,
230-
userDataDir: this.browserConfig.userDataDir ?? await this._createUserDataDir(),
231-
launchOptions: this.browserConfig.launchOptions,
232-
contextOptions: this.browserConfig.contextOptions,
233-
} as LaunchBrowserRequest),
234-
});
235-
const info = await response.json() as BrowserInfo;
236-
if (info.error)
237-
throw new Error(info.error);
238-
return await playwright.chromium.connectOverCDP(`http://localhost:${info.cdpPort}/`);
239-
}
240-
241-
protected override async _doCreateContext(browser: playwright.Browser): Promise<playwright.BrowserContext> {
242-
return this.browserConfig.isolated ? await browser.newContext() : browser.contexts()[0];
243-
}
244-
245-
private async _createUserDataDir() {
246-
const dir = await userDataDir(this.browserConfig);
247-
await fs.promises.mkdir(dir, { recursive: true });
248-
return dir;
249-
}
250-
}
251-
252216
async function injectCdpPort(browserConfig: FullConfig['browser']) {
253217
if (browserConfig.browserName === 'chromium')
254218
(browserConfig.launchOptions as any).cdpPort = await findFreePort();

src/browserServer.ts

Lines changed: 0 additions & 197 deletions
This file was deleted.

src/config.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export type CLIOptions = {
2828
blockedOrigins?: string[];
2929
blockServiceWorkers?: boolean;
3030
browser?: string;
31-
browserAgent?: string;
3231
caps?: string;
3332
cdpEndpoint?: string;
3433
config?: string;
@@ -171,7 +170,6 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
171170

172171
const result: Config = {
173172
browser: {
174-
browserAgent: cliOptions.browserAgent ?? process.env.PW_BROWSER_AGENT,
175173
browserName,
176174
isolated: cliOptions.isolated,
177175
userDataDir: cliOptions.userDataDir,

src/program.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ program
3030
.option('--blocked-origins <origins>', 'semicolon-separated list of origins to block the browser from requesting. Blocklist is evaluated before allowlist. If used without the allowlist, requests not matching the blocklist are still allowed.', semicolonSeparatedList)
3131
.option('--block-service-workers', 'block service workers')
3232
.option('--browser <browser>', 'browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.')
33-
.option('--browser-agent <endpoint>', 'Use browser agent (experimental).')
3433
.option('--caps <caps>', 'comma-separated list of additional capabilities to enable, possible values: vision, pdf.')
3534
.option('--cdp-endpoint <endpoint>', 'CDP endpoint to connect to.')
3635
.option('--config <path>', 'path to the configuration file.')

tests/browser-server.spec.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)