@ai-ecoverse/mcpcat 0.30.2 → 0.30.3
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/host/mcpcat.mjs +17 -5
- package/dist/kernel/mcpcat.mjs +17 -5
- package/package.json +1 -1
package/dist/host/mcpcat.mjs
CHANGED
|
@@ -19607,9 +19607,20 @@ function formatToolSchema(tool) {
|
|
|
19607
19607
|
return lines.join("\n");
|
|
19608
19608
|
}
|
|
19609
19609
|
var NETWORK_HINT = "connection failed (for servers without CORS, link the slicc CLI with npx sliccy@next, or use the browser extension)";
|
|
19610
|
-
|
|
19610
|
+
var LOOPBACK_V4 = /^127\.\d+\.\d+\.\d+$/;
|
|
19611
|
+
function remoteHttps(url) {
|
|
19612
|
+
if (!url) return false;
|
|
19613
|
+
const { protocol, hostname } = new URL(url);
|
|
19614
|
+
const host = hostname.toLowerCase().replace(/\.$/, "");
|
|
19615
|
+
if (protocol !== "https:") return false;
|
|
19616
|
+
return !(host === "localhost" || host.endsWith(".localhost") || host === "host.slicc.internal" || host === "[::1]" || LOOPBACK_V4.test(host));
|
|
19617
|
+
}
|
|
19618
|
+
function transportHint(err, kernelUrl) {
|
|
19611
19619
|
if (err instanceof TypeError) {
|
|
19612
19620
|
const cause = err.cause;
|
|
19621
|
+
if (cause?.code === "ECONNREFUSED" && remoteHttps(kernelUrl)) {
|
|
19622
|
+
return `${NETWORK_HINT}: ${err.message}`;
|
|
19623
|
+
}
|
|
19613
19624
|
if (cause?.code === "ECONNREFUSED" || cause?.code === "ENETUNREACH") {
|
|
19614
19625
|
return `connection failed: ${err.message}`;
|
|
19615
19626
|
}
|
|
@@ -20682,7 +20693,7 @@ async function resolveAuthProvider(platform2, hasAuthHeader, url, target, config
|
|
|
20682
20693
|
}
|
|
20683
20694
|
return { provider, credentialSecrets };
|
|
20684
20695
|
}
|
|
20685
|
-
function classifyConnectionError(err, target, interrupted) {
|
|
20696
|
+
function classifyConnectionError(err, target, interrupted, platformKind, url) {
|
|
20686
20697
|
if (err instanceof TransportRefusalError) {
|
|
20687
20698
|
const hint = "in seven, reach the host via http://host.slicc.internal:<port>; in tests, enable the transport's hostLoopback";
|
|
20688
20699
|
return {
|
|
@@ -20700,7 +20711,8 @@ function classifyConnectionError(err, target, interrupted) {
|
|
|
20700
20711
|
if (interrupted) {
|
|
20701
20712
|
return { code: EXIT_INTERRUPTED, kind: "interrupted", msg: "interrupted" };
|
|
20702
20713
|
}
|
|
20703
|
-
const
|
|
20714
|
+
const kernelUrl = platformKind === "kernel" ? url : void 0;
|
|
20715
|
+
const msg = transportHint(err, kernelUrl) ?? `connection failed: ${err.message}`;
|
|
20704
20716
|
return { code: EXIT_CONNECTION, kind: "connection", msg };
|
|
20705
20717
|
}
|
|
20706
20718
|
function buildRoots(rootArgs, isStdio, cwd) {
|
|
@@ -20887,7 +20899,7 @@ async function runClientVerb(platform2, version, parsed) {
|
|
|
20887
20899
|
);
|
|
20888
20900
|
return EXIT_CONNECTION;
|
|
20889
20901
|
}
|
|
20890
|
-
const e = classifyConnectionError(err, target, interrupted);
|
|
20902
|
+
const e = classifyConnectionError(err, target, interrupted, platform2.kind, resolved.url);
|
|
20891
20903
|
if (e.code === EXIT_INTERRUPTED) {
|
|
20892
20904
|
await platform2.write(2, "mcpcat: interrupted\n");
|
|
20893
20905
|
return termExitCode;
|
|
@@ -21617,5 +21629,5 @@ try {
|
|
|
21617
21629
|
});
|
|
21618
21630
|
} catch {
|
|
21619
21631
|
}
|
|
21620
|
-
var code = await run(platform, "0.30.
|
|
21632
|
+
var code = await run(platform, "0.30.3", args);
|
|
21621
21633
|
process.exit(code);
|
package/dist/kernel/mcpcat.mjs
CHANGED
|
@@ -19124,9 +19124,20 @@ function formatToolSchema(tool) {
|
|
|
19124
19124
|
return lines.join("\n");
|
|
19125
19125
|
}
|
|
19126
19126
|
var NETWORK_HINT = "connection failed (for servers without CORS, link the slicc CLI with npx sliccy@next, or use the browser extension)";
|
|
19127
|
-
|
|
19127
|
+
var LOOPBACK_V4 = /^127\.\d+\.\d+\.\d+$/;
|
|
19128
|
+
function remoteHttps(url) {
|
|
19129
|
+
if (!url) return false;
|
|
19130
|
+
const { protocol, hostname } = new URL(url);
|
|
19131
|
+
const host = hostname.toLowerCase().replace(/\.$/, "");
|
|
19132
|
+
if (protocol !== "https:") return false;
|
|
19133
|
+
return !(host === "localhost" || host.endsWith(".localhost") || host === "host.slicc.internal" || host === "[::1]" || LOOPBACK_V4.test(host));
|
|
19134
|
+
}
|
|
19135
|
+
function transportHint(err, kernelUrl) {
|
|
19128
19136
|
if (err instanceof TypeError) {
|
|
19129
19137
|
const cause = err.cause;
|
|
19138
|
+
if (cause?.code === "ECONNREFUSED" && remoteHttps(kernelUrl)) {
|
|
19139
|
+
return `${NETWORK_HINT}: ${err.message}`;
|
|
19140
|
+
}
|
|
19130
19141
|
if (cause?.code === "ECONNREFUSED" || cause?.code === "ENETUNREACH") {
|
|
19131
19142
|
return `connection failed: ${err.message}`;
|
|
19132
19143
|
}
|
|
@@ -20199,7 +20210,7 @@ async function resolveAuthProvider(platform2, hasAuthHeader, url, target, config
|
|
|
20199
20210
|
}
|
|
20200
20211
|
return { provider, credentialSecrets };
|
|
20201
20212
|
}
|
|
20202
|
-
function classifyConnectionError(err, target, interrupted) {
|
|
20213
|
+
function classifyConnectionError(err, target, interrupted, platformKind, url) {
|
|
20203
20214
|
if (err instanceof TransportRefusalError) {
|
|
20204
20215
|
const hint = "in seven, reach the host via http://host.slicc.internal:<port>; in tests, enable the transport's hostLoopback";
|
|
20205
20216
|
return {
|
|
@@ -20217,7 +20228,8 @@ function classifyConnectionError(err, target, interrupted) {
|
|
|
20217
20228
|
if (interrupted) {
|
|
20218
20229
|
return { code: EXIT_INTERRUPTED, kind: "interrupted", msg: "interrupted" };
|
|
20219
20230
|
}
|
|
20220
|
-
const
|
|
20231
|
+
const kernelUrl = platformKind === "kernel" ? url : void 0;
|
|
20232
|
+
const msg = transportHint(err, kernelUrl) ?? `connection failed: ${err.message}`;
|
|
20221
20233
|
return { code: EXIT_CONNECTION, kind: "connection", msg };
|
|
20222
20234
|
}
|
|
20223
20235
|
function buildRoots(rootArgs, isStdio, cwd) {
|
|
@@ -20404,7 +20416,7 @@ async function runClientVerb(platform2, version, parsed) {
|
|
|
20404
20416
|
);
|
|
20405
20417
|
return EXIT_CONNECTION;
|
|
20406
20418
|
}
|
|
20407
|
-
const e = classifyConnectionError(err, target, interrupted);
|
|
20419
|
+
const e = classifyConnectionError(err, target, interrupted, platform2.kind, resolved.url);
|
|
20408
20420
|
if (e.code === EXIT_INTERRUPTED) {
|
|
20409
20421
|
await platform2.write(2, "mcpcat: interrupted\n");
|
|
20410
20422
|
return termExitCode;
|
|
@@ -20964,7 +20976,7 @@ async function main(ctx) {
|
|
|
20964
20976
|
packageDir: "/node_modules/@ai-ecoverse/mcpcat"
|
|
20965
20977
|
});
|
|
20966
20978
|
const args = ctx.argv.slice(1);
|
|
20967
|
-
return run(platform2, "0.30.
|
|
20979
|
+
return run(platform2, "0.30.3", args);
|
|
20968
20980
|
}
|
|
20969
20981
|
export {
|
|
20970
20982
|
main as default
|