proxy_export_config
Export the current proxy configuration, including optional traffic logs, to a specified file for backup or analysis. Simplifies managing proxy settings within the Web Proxy MCP Server environment.
Instructions
Export current proxy configuration to file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | No | Output file path | |
| includeTrafficLog | No | Include traffic log in export |
Implementation Reference
- src/tools/tool-handlers.js:411-424 (handler)Tool handler case for 'proxy_export_config' that invokes targetManager.exportToFile with optional traffic log and formats the response.case 'proxy_export_config': const exported = await this.targetManager.exportToFile( args.filepath, args.includeTrafficLog && this.trafficAnalyzer ? { trafficLog: this.trafficAnalyzer.getAllEntries() } : undefined ); return { content: [{ type: "text", text: `📤 Configuration exported to ${exported.filepath}\nTargets: ${exported.targetCount}\nFile size: ${exported.fileSize} bytes` }] };
- Input schema definition for the proxy_export_config tool, specifying parameters filepath and includeTrafficLog.proxy_export_config: { name: "proxy_export_config", description: "Export current proxy configuration to file", inputSchema: { type: "object", properties: { filepath: { type: "string", description: "Output file path" }, includeTrafficLog: { type: "boolean", description: "Include traffic log in export", default: false } } } },
- src/proxy/target-manager.js:330-357 (helper)Core implementation of configuration export in TargetManager class, writes JSON config including targets and optional additional data to the specified filepath.async exportToFile(filepath, additionalData = {}) { try { const fs = await import('fs/promises'); const path = await import('path'); // Ensure directory exists const dir = path.dirname(filepath); await fs.mkdir(dir, { recursive: true }); const exportData = { version: '1.0', exportedAt: new Date().toISOString(), targets: Object.fromEntries(this.targets), ...additionalData }; const content = JSON.stringify(exportData, null, 2); await fs.writeFile(filepath, content); return { filepath, targetCount: this.targets.size, fileSize: content.length }; } catch (error) { throw new Error(`Failed to export to file: ${error.message}`); } }