@mcpspend/proxy 0.1.4 → 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 -7
- 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,14 +46,12 @@ 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
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
const
|
|
50
|
-
const child = (0, node_child_process_1.spawn)(command, args, {
|
|
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, {
|
|
51
53
|
stdio: ['pipe', 'pipe', 'inherit'],
|
|
52
54
|
env: process.env,
|
|
53
|
-
shell: isWindows,
|
|
54
55
|
});
|
|
55
56
|
const pending = new Map();
|
|
56
57
|
function handleClientMessage(line) {
|
|
@@ -123,6 +124,7 @@ async function runProxy(opts) {
|
|
|
123
124
|
onLine(buf);
|
|
124
125
|
});
|
|
125
126
|
}
|
|
127
|
+
// stdio: ['pipe', 'pipe', 'inherit'] guarantees stdin/stdout exist
|
|
126
128
|
pipeWithInspect(process.stdin, child.stdin, handleClientMessage);
|
|
127
129
|
pipeWithInspect(child.stdout, process.stdout, handleServerMessage);
|
|
128
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"
|