proxy_generate_setup
Generate browser and system proxy setup scripts for HTTP/HTTPS proxy connections. Automates configuration for Chrome, Firefox, cURL, and system-wide settings, including PAC files, using specified host and port.
Instructions
Generate browser and system proxy setup scripts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| browsers | No | Browser types to generate setup for | |
| proxyHost | No | Proxy server host | localhost |
| proxyPort | No | Proxy server port |
Implementation Reference
- src/tools/tool-handlers.js:289-305 (handler)Tool handler logic for 'proxy_generate_setup': calls browserSetup.generateAllSetups() and generateQuickSetup(), then formats the response with generated files list.case 'proxy_generate_setup': const setup = await this.browserSetup.generateAllSetups( args.proxyHost, args.proxyPort ); const quickGuide = this.browserSetup.generateQuickSetup( args.proxyHost, args.proxyPort ); return { content: [{ type: "text", text: `✅ Browser setup scripts generated!\n\n${quickGuide}\n\nGenerated files:\n${Object.entries(setup.files).map(([type, file]) => `• ${file.filename} - ${file.description}`).join('\n')}` }] };
- Input schema and metadata definition for the proxy_generate_setup tool.proxy_generate_setup: { name: "proxy_generate_setup", description: "Generate browser and system proxy setup scripts", inputSchema: { type: "object", properties: { proxyHost: { type: "string", description: "Proxy server host", default: "localhost" }, proxyPort: { type: "number", description: "Proxy server port", default: 8080 }, browsers: { type: "array", items: { type: "string", enum: ["chrome", "firefox", "curl", "system", "pac"] }, description: "Browser types to generate setup for", default: ["chrome", "firefox", "pac"] } } } },
- src/setup/browser-setup.js:21-57 (helper)Core implementation: BrowserSetup.generateAllSetups() generates and saves setup scripts for various browsers/systems.async generateAllSetups(proxyHost = 'localhost', proxyPort = 8080) { const scripts = { pac: await this.generatePacFile(proxyHost, proxyPort), chrome: this.generateChromeSetup(proxyHost, proxyPort), firefox: this.generateFirefoxSetup(proxyHost, proxyPort), curl: this.generateCurlSetup(proxyHost, proxyPort), system: this.generateSystemProxySetup(proxyHost, proxyPort) }; // Create setup directory try { await fs.mkdir(this.setupDir, { recursive: true }); } catch (error) { // Directory might already exist } // Write all scripts to files const files = {}; for (const [type, content] of Object.entries(scripts)) { const filename = `${type}-proxy-setup.${this._getFileExtension(type)}`; const filepath = path.join(this.setupDir, filename); await fs.writeFile(filepath, content.content); files[type] = { filename, filepath, description: content.description }; } return { proxyHost, proxyPort, targetCount: this.targetManager.getStats().enabled, files, generatedAt: new Date().toISOString() }; }
- src/setup/browser-setup.js:355-398 (helper)BrowserSetup.generateQuickSetup() generates the quick setup guide text displayed in the tool response.generateQuickSetup(proxyHost, proxyPort) { const stats = this.targetManager.getStats(); const targets = this.targetManager.listTargets() .filter(t => t.status === 'active') .map(t => t.domain) .slice(0, 5); return `🔧 Web Proxy MCP - Quick Setup Guide ========================================== 📊 Configuration: • Proxy Server: ${proxyHost}:${proxyPort} • Monitored Domains: ${stats.enabled} • PAC URL: http://${proxyHost}:${proxyPort}/proxy.pac 🎯 Target Domains: ${targets.map(domain => `• ${domain}`).join('\n')} 🚀 Quick Start Options: 1️⃣ Chrome (Recommended): chmod +x ./setup-scripts/chrome-proxy-setup.sh ./setup-scripts/chrome-proxy-setup.sh 2️⃣ Firefox: chmod +x ./setup-scripts/firefox-proxy-setup.sh ./setup-scripts/firefox-proxy-setup.sh 3️⃣ System-wide (Linux): chmod +x ./setup-scripts/system-proxy-setup.sh ./setup-scripts/system-proxy-setup.sh gnome 4️⃣ Testing with cURL: chmod +x ./setup-scripts/curl-proxy-setup.sh ./setup-scripts/curl-proxy-setup.sh 📝 Manual Setup: • PAC File: Use http://${proxyHost}:${proxyPort}/proxy.pac in browser proxy settings • Manual Proxy: ${proxyHost}:${proxyPort} for HTTP/HTTPS ⚠️ Note: Only traffic to monitored domains will be proxied. All other traffic goes direct to maintain normal browsing. `; }