chore: allow configuring raw Playwright options (#287)

Fixes: https://github.com/microsoft/playwright-mcp/issues/272
This commit is contained in:
Pavel Feldman
2025-04-28 20:17:16 -07:00
committed by GitHub
parent 12e72a96c4
commit 80c9b93b72
5 changed files with 125 additions and 108 deletions

View File

@@ -19,7 +19,6 @@ import path from 'path';
import { z } from 'zod';
import { defineTool } from './tool';
import { toBrowserOptions } from '../config';
const install = defineTool({
capability: 'install',
@@ -30,8 +29,7 @@ const install = defineTool({
},
handle: async context => {
const browserOptions = await toBrowserOptions(context.config);
const channel = browserOptions.launchOptions?.channel ?? browserOptions.browserName ?? 'chrome';
const channel = context.config.browser?.launchOptions?.channel ?? context.config.browser?.launchOptions.channel ?? context.config.browser?.launchOptions.browserName ?? 'chrome';
const cli = path.join(require.resolve('playwright/package.json'), '..', 'cli.js');
const child = fork(cli, ['install', channel], {
stdio: 'pipe',