@mcpspend/proxy 0.2.1 → 0.2.2
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/cli.js +1 -1
- package/dist/clients.d.ts +1 -0
- package/dist/clients.js +12 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/init.js +2 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const config_js_1 = require("./config.js");
|
|
5
5
|
const proxy_js_1 = require("./proxy.js");
|
|
6
6
|
const init_js_1 = require("./init.js");
|
|
7
|
-
const VERSION = '0.2.
|
|
7
|
+
const VERSION = '0.2.2';
|
|
8
8
|
const HELP = `mcpspend — observability proxy for MCP servers (v${VERSION})
|
|
9
9
|
|
|
10
10
|
USAGE
|
package/dist/clients.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface WrapResult {
|
|
|
27
27
|
status: 'wrapped' | 'already-wrapped' | 'skipped';
|
|
28
28
|
reason?: string;
|
|
29
29
|
}
|
|
30
|
+
export declare function isAlreadyWrapped(entry: McpServerEntry): boolean;
|
|
30
31
|
export interface WrapOptions {
|
|
31
32
|
apiKey?: string;
|
|
32
33
|
projectId?: string;
|
package/dist/clients.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.CLIENTS = void 0;
|
|
|
4
4
|
exports.discoverClients = discoverClients;
|
|
5
5
|
exports.readClientConfig = readClientConfig;
|
|
6
6
|
exports.writeClientConfig = writeClientConfig;
|
|
7
|
+
exports.isAlreadyWrapped = isAlreadyWrapped;
|
|
7
8
|
exports.wrapEntry = wrapEntry;
|
|
8
9
|
exports.unwrapEntry = unwrapEntry;
|
|
9
10
|
exports.wrapAllServers = wrapAllServers;
|
|
@@ -111,6 +112,15 @@ function writeClientConfig(path, config, backupSuffix = '.mcpspend.bak') {
|
|
|
111
112
|
const MCPSPEND_BIN_NAMES = new Set(['mcpspend', 'mcpspend.cmd', 'mcpspend.exe']);
|
|
112
113
|
const NPX_BIN_NAMES = new Set(['npx', 'npx.cmd', 'npx.exe']);
|
|
113
114
|
const PROXY_PKG = '@mcpspend/proxy';
|
|
115
|
+
// True if `pkgArg` is some form of @mcpspend/proxy: bare, @version, or @tag.
|
|
116
|
+
// '@mcpspend/proxy', '@mcpspend/proxy@0.2.1', '@mcpspend/proxy@latest' → true
|
|
117
|
+
function isProxyPackageArg(pkgArg) {
|
|
118
|
+
if (!pkgArg)
|
|
119
|
+
return false;
|
|
120
|
+
if (pkgArg === PROXY_PKG)
|
|
121
|
+
return true;
|
|
122
|
+
return pkgArg.startsWith(PROXY_PKG + '@');
|
|
123
|
+
}
|
|
114
124
|
function isAlreadyWrapped(entry) {
|
|
115
125
|
const cmd = (entry.command || '').toLowerCase();
|
|
116
126
|
const base = cmd.split(/[\\/]/).pop() || cmd;
|
|
@@ -118,10 +128,10 @@ function isAlreadyWrapped(entry) {
|
|
|
118
128
|
// Shape A: `mcpspend wrap ...`
|
|
119
129
|
if (MCPSPEND_BIN_NAMES.has(base) && args[0] === 'wrap')
|
|
120
130
|
return true;
|
|
121
|
-
// Shape B: `npx [-y] @mcpspend/proxy wrap ...`
|
|
131
|
+
// Shape B: `npx [-y] @mcpspend/proxy[@version] wrap ...`
|
|
122
132
|
if (NPX_BIN_NAMES.has(base)) {
|
|
123
133
|
const skipFlag = args[0] === '-y' || args[0] === '--yes' ? 1 : 0;
|
|
124
|
-
if (args[skipFlag]
|
|
134
|
+
if (isProxyPackageArg(args[skipFlag]) && args[skipFlag + 1] === 'wrap')
|
|
125
135
|
return true;
|
|
126
136
|
}
|
|
127
137
|
return false;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { loadConfig, saveConfig } from './config.js';
|
|
|
2
2
|
export { runProxy } from './proxy.js';
|
|
3
3
|
export type { Config } from './config.js';
|
|
4
4
|
export type { ToolCallEvent } from './ingest.js';
|
|
5
|
-
export { CLIENTS, discoverClients, readClientConfig, writeClientConfig, wrapAllServers, unwrapAllServers, wrapEntry, unwrapEntry, } from './clients.js';
|
|
5
|
+
export { CLIENTS, discoverClients, readClientConfig, writeClientConfig, wrapAllServers, unwrapAllServers, wrapEntry, unwrapEntry, isAlreadyWrapped, } from './clients.js';
|
|
6
6
|
export type { ClientDefinition, ClientConfig, DiscoveredClient, McpServerEntry, WrapResult, WrapOptions, } from './clients.js';
|
|
7
7
|
export { runInit, runDoctor, formatReport, formatDoctor } from './init.js';
|
|
8
8
|
export type { InitOptions, InitReport, ClientReport, DoctorReport } from './init.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatDoctor = exports.formatReport = exports.runDoctor = exports.runInit = exports.unwrapEntry = exports.wrapEntry = exports.unwrapAllServers = exports.wrapAllServers = exports.writeClientConfig = exports.readClientConfig = exports.discoverClients = exports.CLIENTS = exports.runProxy = exports.saveConfig = exports.loadConfig = void 0;
|
|
3
|
+
exports.formatDoctor = exports.formatReport = exports.runDoctor = exports.runInit = exports.isAlreadyWrapped = exports.unwrapEntry = exports.wrapEntry = exports.unwrapAllServers = exports.wrapAllServers = exports.writeClientConfig = exports.readClientConfig = exports.discoverClients = exports.CLIENTS = exports.runProxy = exports.saveConfig = exports.loadConfig = void 0;
|
|
4
4
|
var config_js_1 = require("./config.js");
|
|
5
5
|
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_js_1.loadConfig; } });
|
|
6
6
|
Object.defineProperty(exports, "saveConfig", { enumerable: true, get: function () { return config_js_1.saveConfig; } });
|
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "wrapAllServers", { enumerable: true, get: functi
|
|
|
16
16
|
Object.defineProperty(exports, "unwrapAllServers", { enumerable: true, get: function () { return clients_js_1.unwrapAllServers; } });
|
|
17
17
|
Object.defineProperty(exports, "wrapEntry", { enumerable: true, get: function () { return clients_js_1.wrapEntry; } });
|
|
18
18
|
Object.defineProperty(exports, "unwrapEntry", { enumerable: true, get: function () { return clients_js_1.unwrapEntry; } });
|
|
19
|
+
Object.defineProperty(exports, "isAlreadyWrapped", { enumerable: true, get: function () { return clients_js_1.isAlreadyWrapped; } });
|
|
19
20
|
var init_js_1 = require("./init.js");
|
|
20
21
|
Object.defineProperty(exports, "runInit", { enumerable: true, get: function () { return init_js_1.runInit; } });
|
|
21
22
|
Object.defineProperty(exports, "runDoctor", { enumerable: true, get: function () { return init_js_1.runDoctor; } });
|
package/dist/init.js
CHANGED
|
@@ -156,11 +156,8 @@ async function runDoctor(cliVersion) {
|
|
|
156
156
|
const servers = cfg[serversKey] || {};
|
|
157
157
|
serversCount = Object.keys(servers).length;
|
|
158
158
|
for (const s of Object.values(servers)) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if ((s.args || [])[0] === 'wrap')
|
|
162
|
-
wrappedCount++;
|
|
163
|
-
}
|
|
159
|
+
if (s && typeof s.command === 'string' && (0, clients_js_1.isAlreadyWrapped)(s))
|
|
160
|
+
wrappedCount++;
|
|
164
161
|
}
|
|
165
162
|
}
|
|
166
163
|
catch { }
|
package/package.json
CHANGED