Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions packages/playwright/src/mcp/browser/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export class Context {
private _tabs: Tab[] = [];
private _currentTab: Tab | undefined;
private _clientInfo: ClientInfo;
private _extraHTTPHeaders: Record<string, string> | undefined;

private static _allContexts: Set<Context> = new Set();
private _closeBrowserContextPromise: Promise<void> | undefined;
Expand Down Expand Up @@ -221,20 +220,6 @@ export class Context {
return browserContext;
}

async setExtraHTTPHeaders(headers: Record<string, string>) {
if (!Object.keys(headers).length)
throw new Error('Please provide at least one header to set.');

for (const name of Object.keys(headers)) {
if (!name.trim())
throw new Error('Header names must be non-empty strings.');
}

this._extraHTTPHeaders = { ...headers };
const { browserContext } = await this._ensureBrowserContext();
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
}

private _ensureBrowserContext() {
if (!this._browserContextPromise) {
this._browserContextPromise = this._setupBrowserContext();
Expand All @@ -255,8 +240,6 @@ export class Context {
const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, this._runningToolName);
const { browserContext } = result;
await this._setupRequestInterception(browserContext);
if (this._extraHTTPHeaders)
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
if (this.sessionLog)
await InputRecorder.create(this, browserContext);
for (const page of browserContext.pages())
Expand Down
2 changes: 0 additions & 2 deletions packages/playwright/src/mcp/browser/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import mouse from './tools/mouse';
import navigate from './tools/navigate';
import network from './tools/network';
import pdf from './tools/pdf';
import headers from './tools/headers';
import snapshot from './tools/snapshot';
import screenshot from './tools/screenshot';
import tabs from './tools/tabs';
Expand All @@ -48,7 +47,6 @@ export const browserTools: Tool<any>[] = [
...keyboard,
...navigate,
...network,
...headers,
...mouse,
...pdf,
...screenshot,
Expand Down
49 changes: 0 additions & 49 deletions packages/playwright/src/mcp/browser/tools/headers.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/playwright/src/mcp/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import type * as playwright from 'playwright-core';

export type ToolCapability = 'core' | 'core-tabs' | 'core-install' | 'vision' | 'pdf' | 'testing' | 'tracing' | 'headers';
export type ToolCapability = 'core' | 'core-tabs' | 'core-install' | 'vision' | 'pdf' | 'testing' | 'tracing';

export type Config = {
/**
Expand Down Expand Up @@ -99,7 +99,6 @@ export type Config = {
* - 'core': Core browser automation features.
* - 'pdf': PDF generation and manipulation.
* - 'vision': Coordinate-based interactions.
* - 'headers': Manage persistent custom HTTP headers.
*/
capabilities?: ToolCapability[];

Expand Down Expand Up @@ -172,3 +171,4 @@ export type Config = {
*/
imageResponses?: 'allow' | 'omit';
};

2 changes: 1 addition & 1 deletion packages/playwright/src/mcp/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function decorateCommand(command: Command, version: string) {
.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)
.option('--block-service-workers', 'block service workers')
.option('--browser <browser>', 'browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.')
.option('--caps <caps>', 'comma-separated list of additional capabilities to enable, possible values: vision, pdf, headers.', commaSeparatedList)
.option('--caps <caps>', 'comma-separated list of additional capabilities to enable, possible values: vision, pdf.', commaSeparatedList)
.option('--cdp-endpoint <endpoint>', 'CDP endpoint to connect to.')
.option('--cdp-header <headers...>', 'CDP headers to send with the connect request, multiple can be specified.', headerParser)
.option('--config <path>', 'path to the configuration file.')
Expand Down
110 changes: 0 additions & 110 deletions tests/mcp/headers.spec.ts

This file was deleted.

Loading