@mcpspend/proxy 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/proxy.js +9 -2
- package/package.json +5 -1
package/dist/proxy.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.runProxy = runProxy;
|
|
4
|
-
const
|
|
7
|
+
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
|
5
8
|
const node_crypto_1 = require("node:crypto");
|
|
6
9
|
const ingest_js_1 = require("./ingest.js");
|
|
7
10
|
// Token estimation: ~4 chars per token for English/JSON content.
|
|
@@ -43,7 +46,10 @@ async function runProxy(opts) {
|
|
|
43
46
|
if (!config.apiKey) {
|
|
44
47
|
process.stderr.write('[mcpspend] no API key configured — running in passthrough mode (no tracking)\n');
|
|
45
48
|
}
|
|
46
|
-
|
|
49
|
+
// cross-spawn handles Windows .cmd/.bat resolution and argument quoting
|
|
50
|
+
// properly, avoiding both spawn ENOENT (no shell) and backslash mangling
|
|
51
|
+
// (shell: true). See https://github.com/moxystudio/node-cross-spawn.
|
|
52
|
+
const child = (0, cross_spawn_1.default)(command, args, {
|
|
47
53
|
stdio: ['pipe', 'pipe', 'inherit'],
|
|
48
54
|
env: process.env,
|
|
49
55
|
});
|
|
@@ -118,6 +124,7 @@ async function runProxy(opts) {
|
|
|
118
124
|
onLine(buf);
|
|
119
125
|
});
|
|
120
126
|
}
|
|
127
|
+
// stdio: ['pipe', 'pipe', 'inherit'] guarantees stdin/stdout exist
|
|
121
128
|
pipeWithInspect(process.stdin, child.stdin, handleClientMessage);
|
|
122
129
|
pipeWithInspect(child.stdout, process.stdout, handleServerMessage);
|
|
123
130
|
return new Promise((resolve) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpspend/proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Transparent proxy CLI for MCP servers — tracks tool calls, latency, and cost via MCPSpend.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://mcpspend.com",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=18"
|
|
31
31
|
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"cross-spawn": "^7.0.6"
|
|
34
|
+
},
|
|
32
35
|
"scripts": {
|
|
33
36
|
"build": "tsc",
|
|
34
37
|
"dev": "tsx src/cli.ts",
|
|
@@ -36,6 +39,7 @@
|
|
|
36
39
|
"prepublishOnly": "npm run build"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
42
|
+
"@types/cross-spawn": "^6.0.6",
|
|
39
43
|
"@types/node": "^22.10.10",
|
|
40
44
|
"tsx": "^4.19.2",
|
|
41
45
|
"typescript": "^5.7.3"
|