feat: add runtime proxy configuration support to browser_configure

Enables on-the-fly proxy switching without restarting MCP server, allowing
users to dynamically set or clear proxy settings during browser sessions.

Changes:
- Add proxyServer and proxyBypass parameters to updateBrowserConfig method
- Implement proxy set/clear logic with proper validation for empty strings
- Expose proxy configuration through browser_configure tool interface
- Update auto-generated documentation with proxy parameter descriptions

Tested with SOCKS5 proxy, verified IP changes when proxy is enabled/disabled.
This commit is contained in:
Ryan Malloy 2025-11-14 21:34:40 -07:00
parent 1c55b771a8
commit 3e92fc031f
3 changed files with 72 additions and 0 deletions

View file

@ -501,6 +501,10 @@ export class Context {
permissions?: string[];
offline?: boolean;
// Proxy Configuration
proxyServer?: string;
proxyBypass?: string;
// Browser UI Customization
chromiumSandbox?: boolean;
slowMo?: number;
@ -564,6 +568,21 @@ export class Context {
if (changes.offline !== undefined)
(currentConfig.browser as any).offline = changes.offline;
// Apply proxy configuration
if (changes.proxyServer !== undefined) {
if (changes.proxyServer === '' || changes.proxyServer === null) {
// Clear proxy when empty string or null
delete currentConfig.browser.launchOptions.proxy;
} else {
// Set proxy server
currentConfig.browser.launchOptions.proxy = {
server: changes.proxyServer
};
if (changes.proxyBypass)
currentConfig.browser.launchOptions.proxy.bypass = changes.proxyBypass;
}
}
// Apply browser launch options for UI customization
if (changes.chromiumSandbox !== undefined)
currentConfig.browser.launchOptions.chromiumSandbox = changes.chromiumSandbox;