proxy_export_har
Export HTTP traffic logs in HAR format from the Web Proxy MCP Server for analysis, filtering by domain or time period.
Instructions
Export traffic log as HAR (HTTP Archive) format
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | No | Filter by specific domain | |
| since | No | ISO timestamp to export entries since | |
| filename | No | Output filename (without .har extension) |
Implementation Reference
- src/tools/tool-handlers.js:357-370 (handler)Tool handler case that invokes trafficAnalyzer.exportHAR with provided arguments and returns formatted success message with export details.case 'proxy_export_har': const harFile = await this.trafficAnalyzer.exportHAR({ domain: args.domain, since: args.since ? new Date(args.since) : undefined, filename: args.filename }); return { content: [{ type: "text", text: `📁 HAR file exported: ${harFile.filename}\nEntries: ${harFile.entryCount}\nSize: ${harFile.fileSize} bytes` }] };
- Tool definition including name, description, and input schema for validation.proxy_export_har: { name: "proxy_export_har", description: "Export traffic log as HAR (HTTP Archive) format", inputSchema: { type: "object", properties: { domain: { type: "string", description: "Filter by specific domain" }, since: { type: "string", description: "ISO timestamp to export entries since" }, filename: { type: "string", description: "Output filename (without .har extension)" } } } },
- Implements HAR export: filters traffic entries, converts to HAR 1.2 format using _convertToHAREntry helper, writes JSON file, returns metadata.async exportHAR(options = {}) { const entries = this.getEntries({ domain: options.domain, since: options.since }); const har = { log: { version: "1.2", creator: { name: "Web Proxy MCP Server", version: "1.0" }, pages: [], entries: entries.map(entry => this._convertToHAREntry(entry)) } }; const filename = options.filename ? `${options.filename}.har` : `traffic-${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.har`; const filepath = path.resolve(filename); const content = JSON.stringify(har, null, 2); await fs.writeFile(filepath, content); return { filename, filepath, entryCount: entries.length, fileSize: content.length }; }