@mcpspend/proxy
Advanced tools
+9
-7
| "use strict"; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.runProxy = runProxy; | ||
| const node_child_process_1 = require("node:child_process"); | ||
| const cross_spawn_1 = __importDefault(require("cross-spawn")); | ||
| const node_crypto_1 = require("node:crypto"); | ||
@@ -46,10 +49,8 @@ const ingest_js_1 = require("./ingest.js"); | ||
| } | ||
| // On Windows, Node's spawn() can't find `.cmd`/`.bat` shims (npx, etc.) | ||
| // without going through cmd.exe. Use shell: true to let the OS resolve the | ||
| // command — same path most Node-based CLIs take. | ||
| const isWindows = process.platform === 'win32'; | ||
| const child = (0, node_child_process_1.spawn)(command, args, { | ||
| // cross-spawn handles Windows .cmd/.bat resolution and argument quoting | ||
| // properly, avoiding both spawn ENOENT (no shell) and backslash mangling | ||
| // (shell: true). See https://github.com/moxystudio/node-cross-spawn. | ||
| const child = (0, cross_spawn_1.default)(command, args, { | ||
| stdio: ['pipe', 'pipe', 'inherit'], | ||
| env: process.env, | ||
| shell: isWindows, | ||
| }); | ||
@@ -127,2 +128,3 @@ const pending = new Map(); | ||
| } | ||
| // stdio: ['pipe', 'pipe', 'inherit'] guarantees stdin/stdout exist | ||
| pipeWithInspect(process.stdin, child.stdin, handleClientMessage); | ||
@@ -129,0 +131,0 @@ pipeWithInspect(child.stdout, process.stdout, handleServerMessage); |
+5
-1
| { | ||
| "name": "@mcpspend/proxy", | ||
| "version": "0.1.4", | ||
| "version": "0.1.5", | ||
| "description": "Transparent proxy CLI for MCP servers — tracks tool calls, latency, and cost via MCPSpend.", | ||
@@ -32,2 +32,5 @@ "license": "MIT", | ||
| }, | ||
| "dependencies": { | ||
| "cross-spawn": "^7.0.6" | ||
| }, | ||
| "scripts": { | ||
@@ -40,2 +43,3 @@ "build": "tsc", | ||
| "devDependencies": { | ||
| "@types/cross-spawn": "^6.0.6", | ||
| "@types/node": "^22.10.10", | ||
@@ -42,0 +46,0 @@ "tsx": "^4.19.2", |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
20619
1.16%455
0.44%1
-50%1
Infinity%4
33.33%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added