Skip to content

Commit 21bb265

Browse files
authored
Revert "feat(mcp): add headers capability (#37583)" (#37970)
1 parent 02708fa commit 21bb265

File tree

7 files changed

+3
-182
lines changed

7 files changed

+3
-182
lines changed

packages/playwright/src/mcp/browser/context.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export class Context {
5252
private _tabs: Tab[] = [];
5353
private _currentTab: Tab | undefined;
5454
private _clientInfo: ClientInfo;
55-
private _extraHTTPHeaders: Record<string, string> | undefined;
5655

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

224-
async setExtraHTTPHeaders(headers: Record<string, string>) {
225-
if (!Object.keys(headers).length)
226-
throw new Error('Please provide at least one header to set.');
227-
228-
for (const name of Object.keys(headers)) {
229-
if (!name.trim())
230-
throw new Error('Header names must be non-empty strings.');
231-
}
232-
233-
this._extraHTTPHeaders = { ...headers };
234-
const { browserContext } = await this._ensureBrowserContext();
235-
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
236-
}
237-
238223
private _ensureBrowserContext() {
239224
if (!this._browserContextPromise) {
240225
this._browserContextPromise = this._setupBrowserContext();
@@ -255,8 +240,6 @@ export class Context {
255240
const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, this._runningToolName);
256241
const { browserContext } = result;
257242
await this._setupRequestInterception(browserContext);
258-
if (this._extraHTTPHeaders)
259-
await browserContext.setExtraHTTPHeaders(this._extraHTTPHeaders);
260243
if (this.sessionLog)
261244
await InputRecorder.create(this, browserContext);
262245
for (const page of browserContext.pages())

packages/playwright/src/mcp/browser/tools.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import mouse from './tools/mouse';
2626
import navigate from './tools/navigate';
2727
import network from './tools/network';
2828
import pdf from './tools/pdf';
29-
import headers from './tools/headers';
3029
import snapshot from './tools/snapshot';
3130
import screenshot from './tools/screenshot';
3231
import tabs from './tools/tabs';
@@ -48,7 +47,6 @@ export const browserTools: Tool<any>[] = [
4847
...keyboard,
4948
...navigate,
5049
...network,
51-
...headers,
5250
...mouse,
5351
...pdf,
5452
...screenshot,

packages/playwright/src/mcp/browser/tools/headers.ts

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

packages/playwright/src/mcp/config.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

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

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

2121
export type Config = {
2222
/**
@@ -99,7 +99,6 @@ export type Config = {
9999
* - 'core': Core browser automation features.
100100
* - 'pdf': PDF generation and manipulation.
101101
* - 'vision': Coordinate-based interactions.
102-
* - 'headers': Manage persistent custom HTTP headers.
103102
*/
104103
capabilities?: ToolCapability[];
105104

@@ -172,3 +171,4 @@ export type Config = {
172171
*/
173172
imageResponses?: 'allow' | 'omit';
174173
};
174+

packages/playwright/src/mcp/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function decorateCommand(command: Command, version: string) {
3333
.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)
3434
.option('--block-service-workers', 'block service workers')
3535
.option('--browser <browser>', 'browser or chrome channel to use, possible values: chrome, firefox, webkit, msedge.')
36-
.option('--caps <caps>', 'comma-separated list of additional capabilities to enable, possible values: vision, pdf, headers.', commaSeparatedList)
36+
.option('--caps <caps>', 'comma-separated list of additional capabilities to enable, possible values: vision, pdf.', commaSeparatedList)
3737
.option('--cdp-endpoint <endpoint>', 'CDP endpoint to connect to.')
3838
.option('--cdp-header <headers...>', 'CDP headers to send with the connect request, multiple can be specified.', headerParser)
3939
.option('--config <path>', 'path to the configuration file.')

tests/mcp/generator.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ test('generator tools intent', async ({ startClient }) => {
4141
'browser_type',
4242
'browser_navigate',
4343
'browser_navigate_back',
44-
'browser_set_headers',
4544
'browser_mouse_move_xy',
4645
'browser_mouse_click_xy',
4746
'browser_mouse_drag_xy',

tests/mcp/headers.spec.ts

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

0 commit comments

Comments
 (0)