@ai-ecoverse/mcpcat 0.30.0 → 0.30.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/host/mcpcat.mjs +29 -6
- package/dist/kernel/mcpcat.mjs +29 -6
- package/package.json +1 -1
package/dist/host/mcpcat.mjs
CHANGED
|
@@ -15307,6 +15307,7 @@ function concat(chunks) {
|
|
|
15307
15307
|
}
|
|
15308
15308
|
var KILL_GRACE_MS = 2e3;
|
|
15309
15309
|
var CALL_KILL_GRACE_MS = 5e3;
|
|
15310
|
+
var STREAM_GRACE_MS = 1e3;
|
|
15310
15311
|
async function terminate(proc, graceMs) {
|
|
15311
15312
|
try {
|
|
15312
15313
|
await proc.kill("SIGTERM");
|
|
@@ -15345,6 +15346,16 @@ async function killInflight() {
|
|
|
15345
15346
|
await Promise.all(procs.map((proc) => terminate(proc, KILL_GRACE_MS)));
|
|
15346
15347
|
inflightProcs.clear();
|
|
15347
15348
|
}
|
|
15349
|
+
async function endStreams(streams) {
|
|
15350
|
+
if (streams.size === 0) return;
|
|
15351
|
+
await within(Promise.all(streams.keys()), STREAM_GRACE_MS);
|
|
15352
|
+
for (const conn of streams.values()) {
|
|
15353
|
+
try {
|
|
15354
|
+
conn.close();
|
|
15355
|
+
} catch {
|
|
15356
|
+
}
|
|
15357
|
+
}
|
|
15358
|
+
}
|
|
15348
15359
|
async function runHelpForCli(platform2, filePath, childEnv, cwd, signal) {
|
|
15349
15360
|
const dashed = await runCommand(
|
|
15350
15361
|
platform2,
|
|
@@ -16618,15 +16629,18 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16618
16629
|
const listenUrl = address.url;
|
|
16619
16630
|
let tokenFilePath;
|
|
16620
16631
|
let shutdownRequested = false;
|
|
16632
|
+
let exitCode = 0;
|
|
16621
16633
|
let inflightDone;
|
|
16622
16634
|
const stopCalls = new AbortController();
|
|
16623
16635
|
const activeCalls = /* @__PURE__ */ new Set();
|
|
16624
|
-
const
|
|
16636
|
+
const streams = /* @__PURE__ */ new Map();
|
|
16637
|
+
const shutdown = (sig) => {
|
|
16625
16638
|
if (shutdownRequested) return;
|
|
16626
16639
|
shutdownRequested = true;
|
|
16640
|
+
exitCode = SIGNAL_EXIT[sig];
|
|
16627
16641
|
listener.close();
|
|
16628
16642
|
stopCalls.abort();
|
|
16629
|
-
inflightDone = Promise.all([killInflight(), hub?.close()]).then(() => {
|
|
16643
|
+
inflightDone = Promise.all([killInflight(), hub?.close(), endStreams(streams)]).then(() => {
|
|
16630
16644
|
});
|
|
16631
16645
|
if (tokenFilePath) {
|
|
16632
16646
|
platform2.fs.unlink?.(tokenFilePath).catch(() => {
|
|
@@ -16685,8 +16699,17 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16685
16699
|
for await (const connection of listener) {
|
|
16686
16700
|
if (shutdownRequested) break;
|
|
16687
16701
|
const conn = connection;
|
|
16688
|
-
|
|
16702
|
+
const served = handleConnection(
|
|
16703
|
+
conn.readable,
|
|
16704
|
+
conn.writable,
|
|
16705
|
+
async (request, signal) => {
|
|
16706
|
+
const response = await handler(request, signal);
|
|
16707
|
+
if (response.stream) streams.set(served, conn);
|
|
16708
|
+
return response;
|
|
16709
|
+
}
|
|
16710
|
+
).catch(() => {
|
|
16689
16711
|
}).finally(() => {
|
|
16712
|
+
streams.delete(served);
|
|
16690
16713
|
try {
|
|
16691
16714
|
conn.close();
|
|
16692
16715
|
} catch {
|
|
@@ -16703,7 +16726,7 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16703
16726
|
}
|
|
16704
16727
|
}
|
|
16705
16728
|
await Promise.allSettled([...activeCalls]);
|
|
16706
|
-
return
|
|
16729
|
+
return exitCode;
|
|
16707
16730
|
}
|
|
16708
16731
|
async function handleMcpRequest(request, tools, call, serverName, version, serverOrigins, allowedOrigins, allowedHosts, resolvedBearer, hub) {
|
|
16709
16732
|
if (request.target !== "/mcp") {
|
|
@@ -19583,7 +19606,7 @@ function formatToolSchema(tool) {
|
|
|
19583
19606
|
}
|
|
19584
19607
|
return lines.join("\n");
|
|
19585
19608
|
}
|
|
19586
|
-
var NETWORK_HINT = "connection failed (
|
|
19609
|
+
var NETWORK_HINT = "connection failed (for servers without CORS, link the slicc CLI with npx sliccy@next, or use the browser extension)";
|
|
19587
19610
|
function transportHint(err) {
|
|
19588
19611
|
if (err instanceof TypeError) {
|
|
19589
19612
|
const cause = err.cause;
|
|
@@ -21594,5 +21617,5 @@ try {
|
|
|
21594
21617
|
});
|
|
21595
21618
|
} catch {
|
|
21596
21619
|
}
|
|
21597
|
-
var code = await run(platform, "0.30.
|
|
21620
|
+
var code = await run(platform, "0.30.2", args);
|
|
21598
21621
|
process.exit(code);
|
package/dist/kernel/mcpcat.mjs
CHANGED
|
@@ -14928,6 +14928,7 @@ function concat(chunks) {
|
|
|
14928
14928
|
}
|
|
14929
14929
|
var KILL_GRACE_MS = 2e3;
|
|
14930
14930
|
var CALL_KILL_GRACE_MS = 5e3;
|
|
14931
|
+
var STREAM_GRACE_MS = 1e3;
|
|
14931
14932
|
async function terminate(proc, graceMs) {
|
|
14932
14933
|
try {
|
|
14933
14934
|
await proc.kill("SIGTERM");
|
|
@@ -14966,6 +14967,16 @@ async function killInflight() {
|
|
|
14966
14967
|
await Promise.all(procs.map((proc) => terminate(proc, KILL_GRACE_MS)));
|
|
14967
14968
|
inflightProcs.clear();
|
|
14968
14969
|
}
|
|
14970
|
+
async function endStreams(streams) {
|
|
14971
|
+
if (streams.size === 0) return;
|
|
14972
|
+
await within(Promise.all(streams.keys()), STREAM_GRACE_MS);
|
|
14973
|
+
for (const conn of streams.values()) {
|
|
14974
|
+
try {
|
|
14975
|
+
conn.close();
|
|
14976
|
+
} catch {
|
|
14977
|
+
}
|
|
14978
|
+
}
|
|
14979
|
+
}
|
|
14969
14980
|
async function runHelpForCli(platform2, filePath, childEnv, cwd, signal) {
|
|
14970
14981
|
const dashed = await runCommand(
|
|
14971
14982
|
platform2,
|
|
@@ -16239,15 +16250,18 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16239
16250
|
const listenUrl = address.url;
|
|
16240
16251
|
let tokenFilePath;
|
|
16241
16252
|
let shutdownRequested = false;
|
|
16253
|
+
let exitCode = 0;
|
|
16242
16254
|
let inflightDone;
|
|
16243
16255
|
const stopCalls = new AbortController();
|
|
16244
16256
|
const activeCalls = /* @__PURE__ */ new Set();
|
|
16245
|
-
const
|
|
16257
|
+
const streams = /* @__PURE__ */ new Map();
|
|
16258
|
+
const shutdown = (sig) => {
|
|
16246
16259
|
if (shutdownRequested) return;
|
|
16247
16260
|
shutdownRequested = true;
|
|
16261
|
+
exitCode = SIGNAL_EXIT[sig];
|
|
16248
16262
|
listener.close();
|
|
16249
16263
|
stopCalls.abort();
|
|
16250
|
-
inflightDone = Promise.all([killInflight(), hub?.close()]).then(() => {
|
|
16264
|
+
inflightDone = Promise.all([killInflight(), hub?.close(), endStreams(streams)]).then(() => {
|
|
16251
16265
|
});
|
|
16252
16266
|
if (tokenFilePath) {
|
|
16253
16267
|
platform2.fs.unlink?.(tokenFilePath).catch(() => {
|
|
@@ -16306,8 +16320,17 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16306
16320
|
for await (const connection of listener) {
|
|
16307
16321
|
if (shutdownRequested) break;
|
|
16308
16322
|
const conn = connection;
|
|
16309
|
-
|
|
16323
|
+
const served = handleConnection(
|
|
16324
|
+
conn.readable,
|
|
16325
|
+
conn.writable,
|
|
16326
|
+
async (request, signal) => {
|
|
16327
|
+
const response = await handler(request, signal);
|
|
16328
|
+
if (response.stream) streams.set(served, conn);
|
|
16329
|
+
return response;
|
|
16330
|
+
}
|
|
16331
|
+
).catch(() => {
|
|
16310
16332
|
}).finally(() => {
|
|
16333
|
+
streams.delete(served);
|
|
16311
16334
|
try {
|
|
16312
16335
|
conn.close();
|
|
16313
16336
|
} catch {
|
|
@@ -16324,7 +16347,7 @@ async function runHttpServer(platform2, options, tools, call, serverName, versio
|
|
|
16324
16347
|
}
|
|
16325
16348
|
}
|
|
16326
16349
|
await Promise.allSettled([...activeCalls]);
|
|
16327
|
-
return
|
|
16350
|
+
return exitCode;
|
|
16328
16351
|
}
|
|
16329
16352
|
async function handleMcpRequest(request, tools, call, serverName, version, serverOrigins, allowedOrigins, allowedHosts, resolvedBearer, hub) {
|
|
16330
16353
|
if (request.target !== "/mcp") {
|
|
@@ -19100,7 +19123,7 @@ function formatToolSchema(tool) {
|
|
|
19100
19123
|
}
|
|
19101
19124
|
return lines.join("\n");
|
|
19102
19125
|
}
|
|
19103
|
-
var NETWORK_HINT = "connection failed (
|
|
19126
|
+
var NETWORK_HINT = "connection failed (for servers without CORS, link the slicc CLI with npx sliccy@next, or use the browser extension)";
|
|
19104
19127
|
function transportHint(err) {
|
|
19105
19128
|
if (err instanceof TypeError) {
|
|
19106
19129
|
const cause = err.cause;
|
|
@@ -20941,7 +20964,7 @@ async function main(ctx) {
|
|
|
20941
20964
|
packageDir: "/node_modules/@ai-ecoverse/mcpcat"
|
|
20942
20965
|
});
|
|
20943
20966
|
const args = ctx.argv.slice(1);
|
|
20944
|
-
return run(platform2, "0.30.
|
|
20967
|
+
return run(platform2, "0.30.2", args);
|
|
20945
20968
|
}
|
|
20946
20969
|
export {
|
|
20947
20970
|
main as default
|