From 38d531725f99e76b397dfe5bfd4f90004bbee047 Mon Sep 17 00:00:00 2001 From: medcelerate <32549017+medcelerate@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:15:42 -0400 Subject: [PATCH] Adds argument to write to proper directory --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index c8ece68..1dc0467 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ const execAsync = promisify(exec); const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js'); const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js'); const { z } = require('zod'); +const path = require('node:path'); // Redirect console.log to stderr const originalConsoleLog = console.log; @@ -51,12 +52,13 @@ server.tool( { interface: z.string().optional().default('en0').describe('Network interface to capture from (e.g., eth0, en0)'), duration: z.number().optional().default(5).describe('Capture duration in seconds'), + directory: z.string().optional().default('/tmp').describe('Directory to store temp pcap files.'), }, async (args) => { try { const tsharkPath = await findTshark(); - const { interface, duration } = args; - const tempPcap = 'temp_capture.pcap'; + const { interface, duration, directory } = args; + const tempPcap = path.join(directory, 'temp_capture.pcap'); console.error(`Capturing packets on ${interface} for ${duration}s`); await execAsync( @@ -660,4 +662,4 @@ server.connect(new StdioServerTransport()) .catch(err => { console.error('Failed to start WireMCP:', err); process.exit(1); - }); \ No newline at end of file + });