@mcpc-tech/cli 0.1.51 → 0.1.53
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/app.cjs +218 -37
- package/app.mjs +218 -37
- package/bin/mcpc.cjs +212 -48
- package/bin/mcpc.mjs +210 -46
- package/bin.cjs +212 -48
- package/bin.mjs +210 -46
- package/index.cjs +238 -57
- package/index.mjs +236 -55
- package/package.json +2 -2
- package/server.cjs +238 -57
- package/server.mjs +236 -55
package/index.cjs
CHANGED
|
@@ -506,7 +506,7 @@ var require_cross_spawn = __commonJS({
|
|
|
506
506
|
var cp = require("child_process");
|
|
507
507
|
var parse2 = require_parse();
|
|
508
508
|
var enoent = require_enoent();
|
|
509
|
-
function
|
|
509
|
+
function spawn3(command, args, options) {
|
|
510
510
|
const parsed = parse2(command, args, options);
|
|
511
511
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
512
512
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -518,8 +518,8 @@ var require_cross_spawn = __commonJS({
|
|
|
518
518
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
519
519
|
return result;
|
|
520
520
|
}
|
|
521
|
-
module2.exports =
|
|
522
|
-
module2.exports.spawn =
|
|
521
|
+
module2.exports = spawn3;
|
|
522
|
+
module2.exports.spawn = spawn3;
|
|
523
523
|
module2.exports.sync = spawnSync;
|
|
524
524
|
module2.exports._parse = parse2;
|
|
525
525
|
module2.exports._enoent = enoent;
|
|
@@ -2587,15 +2587,17 @@ var Response2 = class _Response {
|
|
|
2587
2587
|
this.#init = init;
|
|
2588
2588
|
}
|
|
2589
2589
|
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
|
2590
|
-
|
|
2591
|
-
this[cacheKey] = [init?.status || 200, body, headers];
|
|
2590
|
+
;
|
|
2591
|
+
this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
|
|
2592
2592
|
}
|
|
2593
2593
|
}
|
|
2594
2594
|
get headers() {
|
|
2595
2595
|
const cache = this[cacheKey];
|
|
2596
2596
|
if (cache) {
|
|
2597
2597
|
if (!(cache[2] instanceof Headers)) {
|
|
2598
|
-
cache[2] = new Headers(
|
|
2598
|
+
cache[2] = new Headers(
|
|
2599
|
+
cache[2] || { "content-type": "text/plain; charset=UTF-8" }
|
|
2600
|
+
);
|
|
2599
2601
|
}
|
|
2600
2602
|
return cache[2];
|
|
2601
2603
|
}
|
|
@@ -2720,15 +2722,32 @@ var flushHeaders = (outgoing) => {
|
|
|
2720
2722
|
};
|
|
2721
2723
|
var responseViaCache = async (res, outgoing) => {
|
|
2722
2724
|
let [status, body, header] = res[cacheKey];
|
|
2723
|
-
|
|
2725
|
+
let hasContentLength = false;
|
|
2726
|
+
if (!header) {
|
|
2727
|
+
header = { "content-type": "text/plain; charset=UTF-8" };
|
|
2728
|
+
} else if (header instanceof Headers) {
|
|
2729
|
+
hasContentLength = header.has("content-length");
|
|
2724
2730
|
header = buildOutgoingHttpHeaders(header);
|
|
2731
|
+
} else if (Array.isArray(header)) {
|
|
2732
|
+
const headerObj = new Headers(header);
|
|
2733
|
+
hasContentLength = headerObj.has("content-length");
|
|
2734
|
+
header = buildOutgoingHttpHeaders(headerObj);
|
|
2735
|
+
} else {
|
|
2736
|
+
for (const key in header) {
|
|
2737
|
+
if (key.length === 14 && key.toLowerCase() === "content-length") {
|
|
2738
|
+
hasContentLength = true;
|
|
2739
|
+
break;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2725
2742
|
}
|
|
2726
|
-
if (
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2743
|
+
if (!hasContentLength) {
|
|
2744
|
+
if (typeof body === "string") {
|
|
2745
|
+
header["Content-Length"] = Buffer.byteLength(body);
|
|
2746
|
+
} else if (body instanceof Uint8Array) {
|
|
2747
|
+
header["Content-Length"] = body.byteLength;
|
|
2748
|
+
} else if (body instanceof Blob) {
|
|
2749
|
+
header["Content-Length"] = body.size;
|
|
2750
|
+
}
|
|
2732
2751
|
}
|
|
2733
2752
|
outgoing.writeHead(status, header);
|
|
2734
2753
|
if (typeof body === "string" || body instanceof Uint8Array) {
|
|
@@ -3881,7 +3900,7 @@ function parseArgs(args, options) {
|
|
|
3881
3900
|
var import_promises4 = require("node:fs/promises");
|
|
3882
3901
|
var import_node_os3 = require("node:os");
|
|
3883
3902
|
var import_node_path6 = require("node:path");
|
|
3884
|
-
var
|
|
3903
|
+
var import_node_process4 = __toESM(require("node:process"), 1);
|
|
3885
3904
|
|
|
3886
3905
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
3887
3906
|
var import_promises = require("node:fs/promises");
|
|
@@ -4442,6 +4461,152 @@ Skill path: ${meta.basePath}
|
|
|
4442
4461
|
};
|
|
4443
4462
|
}
|
|
4444
4463
|
|
|
4464
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
4465
|
+
var import_node_child_process = require("node:child_process");
|
|
4466
|
+
var import_node_process = __toESM(require("node:process"), 1);
|
|
4467
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
4468
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
4469
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
4470
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
4471
|
+
const fullOutput = (stderr ? `STDERR:
|
|
4472
|
+
${stderr}
|
|
4473
|
+
|
|
4474
|
+
STDOUT:
|
|
4475
|
+
` : "") + stdout;
|
|
4476
|
+
const lines = fullOutput.split("\n");
|
|
4477
|
+
if (lines.length > maxLines) {
|
|
4478
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
4479
|
+
return {
|
|
4480
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
4481
|
+
|
|
4482
|
+
` + truncatedLines.join("\n"),
|
|
4483
|
+
truncated: true
|
|
4484
|
+
};
|
|
4485
|
+
}
|
|
4486
|
+
if (fullOutput.length > maxBytes) {
|
|
4487
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
4488
|
+
return {
|
|
4489
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
4490
|
+
|
|
4491
|
+
` + truncatedBytes,
|
|
4492
|
+
truncated: true
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4495
|
+
return {
|
|
4496
|
+
output: fullOutput,
|
|
4497
|
+
truncated: false
|
|
4498
|
+
};
|
|
4499
|
+
}
|
|
4500
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
4501
|
+
return new Promise((resolve5) => {
|
|
4502
|
+
const stdout = [];
|
|
4503
|
+
const stderr = [];
|
|
4504
|
+
const proc = (0, import_node_child_process.spawn)("bash", [
|
|
4505
|
+
"-c",
|
|
4506
|
+
command
|
|
4507
|
+
], {
|
|
4508
|
+
cwd: cwd2,
|
|
4509
|
+
stdio: [
|
|
4510
|
+
"ignore",
|
|
4511
|
+
"pipe",
|
|
4512
|
+
"pipe"
|
|
4513
|
+
]
|
|
4514
|
+
});
|
|
4515
|
+
proc.stdout?.on("data", (data) => {
|
|
4516
|
+
stdout.push(data.toString());
|
|
4517
|
+
});
|
|
4518
|
+
proc.stderr?.on("data", (data) => {
|
|
4519
|
+
stderr.push(data.toString());
|
|
4520
|
+
});
|
|
4521
|
+
proc.on("close", (code) => {
|
|
4522
|
+
resolve5({
|
|
4523
|
+
stdout: stdout.join(""),
|
|
4524
|
+
stderr: stderr.join(""),
|
|
4525
|
+
exitCode: code
|
|
4526
|
+
});
|
|
4527
|
+
});
|
|
4528
|
+
proc.on("error", (err) => {
|
|
4529
|
+
resolve5({
|
|
4530
|
+
stdout: "",
|
|
4531
|
+
stderr: err.message,
|
|
4532
|
+
exitCode: null
|
|
4533
|
+
});
|
|
4534
|
+
});
|
|
4535
|
+
setTimeout(() => {
|
|
4536
|
+
proc.kill("SIGTERM");
|
|
4537
|
+
resolve5({
|
|
4538
|
+
stdout: stdout.join(""),
|
|
4539
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
4540
|
+
exitCode: null
|
|
4541
|
+
});
|
|
4542
|
+
}, timeoutMs);
|
|
4543
|
+
});
|
|
4544
|
+
}
|
|
4545
|
+
function createBashPlugin(options = {}) {
|
|
4546
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
4547
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
4548
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
4549
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
4550
|
+
...options
|
|
4551
|
+
};
|
|
4552
|
+
let serverRef = null;
|
|
4553
|
+
return {
|
|
4554
|
+
name: "plugin-bash",
|
|
4555
|
+
version: "1.0.0",
|
|
4556
|
+
// Store server reference for tool registration
|
|
4557
|
+
configureServer: (server) => {
|
|
4558
|
+
serverRef = server;
|
|
4559
|
+
},
|
|
4560
|
+
// Register bash tool with agent name prefix
|
|
4561
|
+
composeStart: (context2) => {
|
|
4562
|
+
if (!serverRef) return;
|
|
4563
|
+
const agentName = context2.serverName;
|
|
4564
|
+
const toolName = `${agentName}__bash`;
|
|
4565
|
+
serverRef.tool(toolName, "Execute a bash command and return its output.\n\nUse this for:\n- Running shell commands\n- Executing scripts\n- System operations\n\nNote: Output is truncated if too large.", {
|
|
4566
|
+
type: "object",
|
|
4567
|
+
properties: {
|
|
4568
|
+
command: {
|
|
4569
|
+
type: "string",
|
|
4570
|
+
description: "The bash command to execute"
|
|
4571
|
+
},
|
|
4572
|
+
cwd: {
|
|
4573
|
+
type: "string",
|
|
4574
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
4575
|
+
}
|
|
4576
|
+
},
|
|
4577
|
+
required: [
|
|
4578
|
+
"command"
|
|
4579
|
+
]
|
|
4580
|
+
}, async (args) => {
|
|
4581
|
+
const cwd2 = args.cwd || import_node_process.default.cwd();
|
|
4582
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
4583
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
4584
|
+
let finalOutput = output;
|
|
4585
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
4586
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
4587
|
+
` + finalOutput;
|
|
4588
|
+
}
|
|
4589
|
+
if (truncated) {
|
|
4590
|
+
finalOutput += `
|
|
4591
|
+
|
|
4592
|
+
[Note: Output was truncated]`;
|
|
4593
|
+
}
|
|
4594
|
+
return {
|
|
4595
|
+
content: [
|
|
4596
|
+
{
|
|
4597
|
+
type: "text",
|
|
4598
|
+
text: finalOutput
|
|
4599
|
+
}
|
|
4600
|
+
],
|
|
4601
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
4602
|
+
};
|
|
4603
|
+
}, {
|
|
4604
|
+
internal: true
|
|
4605
|
+
});
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
}
|
|
4609
|
+
|
|
4445
4610
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
4446
4611
|
var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
|
|
4447
4612
|
|
|
@@ -6421,10 +6586,10 @@ function parse(content, options = {}) {
|
|
|
6421
6586
|
}
|
|
6422
6587
|
|
|
6423
6588
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
6424
|
-
var
|
|
6589
|
+
var import_node_process2 = __toESM(require("node:process"), 1);
|
|
6425
6590
|
function replaceEnvVars(str2) {
|
|
6426
6591
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
6427
|
-
const value =
|
|
6592
|
+
const value = import_node_process2.default.env[varName];
|
|
6428
6593
|
if (value !== void 0) {
|
|
6429
6594
|
return value;
|
|
6430
6595
|
}
|
|
@@ -6523,18 +6688,19 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
6523
6688
|
|
|
6524
6689
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
6525
6690
|
var import_node_path5 = require("node:path");
|
|
6526
|
-
var
|
|
6691
|
+
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
6527
6692
|
var DEFAULT_SKILLS_PATHS = [
|
|
6528
6693
|
".agent/skills"
|
|
6529
6694
|
];
|
|
6530
6695
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
6531
6696
|
function getGlobalPlugins(skillsPaths) {
|
|
6532
|
-
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(
|
|
6697
|
+
const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
|
|
6533
6698
|
return [
|
|
6534
6699
|
markdownLoaderPlugin(),
|
|
6535
6700
|
createSkillsPlugin({
|
|
6536
6701
|
paths: resolvedPaths
|
|
6537
|
-
})
|
|
6702
|
+
}),
|
|
6703
|
+
createBashPlugin()
|
|
6538
6704
|
];
|
|
6539
6705
|
}
|
|
6540
6706
|
function getAgentPlugins() {
|
|
@@ -6563,7 +6729,7 @@ function getDefaultAgents() {
|
|
|
6563
6729
|
}
|
|
6564
6730
|
|
|
6565
6731
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
6566
|
-
var CLI_VERSION = "0.1.
|
|
6732
|
+
var CLI_VERSION = "0.1.53";
|
|
6567
6733
|
function extractServerName(command, commandArgs) {
|
|
6568
6734
|
for (const arg of commandArgs) {
|
|
6569
6735
|
if (!arg.startsWith("-")) {
|
|
@@ -6623,7 +6789,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
6623
6789
|
async function createWrapConfig(args) {
|
|
6624
6790
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
6625
6791
|
console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
|
|
6626
|
-
|
|
6792
|
+
import_node_process4.default.exit(1);
|
|
6627
6793
|
}
|
|
6628
6794
|
const mcpServers = {};
|
|
6629
6795
|
const serverNames = [];
|
|
@@ -6746,7 +6912,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
6746
6912
|
};
|
|
6747
6913
|
}
|
|
6748
6914
|
function parseCLIArgs() {
|
|
6749
|
-
const args = parseArgs(
|
|
6915
|
+
const args = parseArgs(import_node_process4.default.argv.slice(2), {
|
|
6750
6916
|
boolean: [
|
|
6751
6917
|
"help",
|
|
6752
6918
|
"version",
|
|
@@ -6835,15 +7001,15 @@ async function loadConfig() {
|
|
|
6835
7001
|
const args = parseCLIArgs();
|
|
6836
7002
|
if (args.version) {
|
|
6837
7003
|
printVersion();
|
|
6838
|
-
|
|
7004
|
+
import_node_process4.default.exit(0);
|
|
6839
7005
|
}
|
|
6840
7006
|
if (args.help) {
|
|
6841
7007
|
printHelp();
|
|
6842
|
-
|
|
7008
|
+
import_node_process4.default.exit(0);
|
|
6843
7009
|
}
|
|
6844
7010
|
if (args.cwd) {
|
|
6845
|
-
const targetCwd = (0, import_node_path6.resolve)(
|
|
6846
|
-
|
|
7011
|
+
const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
|
|
7012
|
+
import_node_process4.default.chdir(targetCwd);
|
|
6847
7013
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
6848
7014
|
}
|
|
6849
7015
|
const mergeSkills = (config) => {
|
|
@@ -6855,7 +7021,7 @@ async function loadConfig() {
|
|
|
6855
7021
|
...args,
|
|
6856
7022
|
saveConfig: true
|
|
6857
7023
|
});
|
|
6858
|
-
|
|
7024
|
+
import_node_process4.default.exit(0);
|
|
6859
7025
|
}
|
|
6860
7026
|
if (args.wrap) {
|
|
6861
7027
|
return mergeSkills(await createWrapConfig({
|
|
@@ -6872,16 +7038,16 @@ async function loadConfig() {
|
|
|
6872
7038
|
throw error;
|
|
6873
7039
|
}
|
|
6874
7040
|
}
|
|
6875
|
-
if (
|
|
7041
|
+
if (import_node_process4.default.env.MCPC_CONFIG) {
|
|
6876
7042
|
try {
|
|
6877
|
-
const parsed = JSON.parse(
|
|
7043
|
+
const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
|
|
6878
7044
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
6879
7045
|
} catch (error) {
|
|
6880
7046
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
6881
7047
|
throw error;
|
|
6882
7048
|
}
|
|
6883
7049
|
}
|
|
6884
|
-
const configUrl = args.configUrl ||
|
|
7050
|
+
const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
|
|
6885
7051
|
if (configUrl) {
|
|
6886
7052
|
try {
|
|
6887
7053
|
const headers = {
|
|
@@ -6902,7 +7068,7 @@ async function loadConfig() {
|
|
|
6902
7068
|
throw error;
|
|
6903
7069
|
}
|
|
6904
7070
|
}
|
|
6905
|
-
const configFile = args.configFile ||
|
|
7071
|
+
const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
|
|
6906
7072
|
if (configFile) {
|
|
6907
7073
|
try {
|
|
6908
7074
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -6927,7 +7093,7 @@ async function loadConfig() {
|
|
|
6927
7093
|
throw error;
|
|
6928
7094
|
}
|
|
6929
7095
|
}
|
|
6930
|
-
const defaultJsonConfigPath = (0, import_node_path6.resolve)(
|
|
7096
|
+
const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
|
|
6931
7097
|
try {
|
|
6932
7098
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
6933
7099
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -6942,7 +7108,7 @@ async function loadConfig() {
|
|
|
6942
7108
|
}
|
|
6943
7109
|
function replaceEnvVars2(str2) {
|
|
6944
7110
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
6945
|
-
return
|
|
7111
|
+
return import_node_process4.default.env[varName] || "";
|
|
6946
7112
|
});
|
|
6947
7113
|
}
|
|
6948
7114
|
function isMarkdownFile2(path) {
|
|
@@ -6986,7 +7152,7 @@ function applyModeOverride(config, mode) {
|
|
|
6986
7152
|
agent.options.mode = mode;
|
|
6987
7153
|
if (mode === "ai_acp" && !agent.options.acpSettings) {
|
|
6988
7154
|
agent.options.acpSettings = {
|
|
6989
|
-
command: "claude-
|
|
7155
|
+
command: "claude-agent-acp",
|
|
6990
7156
|
args: [],
|
|
6991
7157
|
session: {}
|
|
6992
7158
|
};
|
|
@@ -9584,7 +9750,7 @@ var Client = class extends Protocol {
|
|
|
9584
9750
|
|
|
9585
9751
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
9586
9752
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
9587
|
-
var
|
|
9753
|
+
var import_node_process5 = __toESM(require("node:process"), 1);
|
|
9588
9754
|
var import_node_stream = require("node:stream");
|
|
9589
9755
|
|
|
9590
9756
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
@@ -9616,7 +9782,7 @@ function serializeMessage(message) {
|
|
|
9616
9782
|
}
|
|
9617
9783
|
|
|
9618
9784
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
9619
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
9785
|
+
var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
|
|
9620
9786
|
"APPDATA",
|
|
9621
9787
|
"HOMEDRIVE",
|
|
9622
9788
|
"HOMEPATH",
|
|
@@ -9636,7 +9802,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win3
|
|
|
9636
9802
|
function getDefaultEnvironment() {
|
|
9637
9803
|
const env = {};
|
|
9638
9804
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
9639
|
-
const value =
|
|
9805
|
+
const value = import_node_process5.default.env[key];
|
|
9640
9806
|
if (value === void 0) {
|
|
9641
9807
|
continue;
|
|
9642
9808
|
}
|
|
@@ -9672,7 +9838,7 @@ var StdioClientTransport = class {
|
|
|
9672
9838
|
},
|
|
9673
9839
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
9674
9840
|
shell: false,
|
|
9675
|
-
windowsHide:
|
|
9841
|
+
windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
|
|
9676
9842
|
cwd: this._serverParams.cwd
|
|
9677
9843
|
});
|
|
9678
9844
|
this._process.on("error", (error) => {
|
|
@@ -9780,7 +9946,7 @@ var StdioClientTransport = class {
|
|
|
9780
9946
|
}
|
|
9781
9947
|
};
|
|
9782
9948
|
function isElectron() {
|
|
9783
|
-
return "type" in
|
|
9949
|
+
return "type" in import_node_process5.default;
|
|
9784
9950
|
}
|
|
9785
9951
|
|
|
9786
9952
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -11704,8 +11870,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
11704
11870
|
};
|
|
11705
11871
|
|
|
11706
11872
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
11707
|
-
var
|
|
11708
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
11873
|
+
var import_node_process6 = __toESM(require("node:process"), 1);
|
|
11874
|
+
var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
11709
11875
|
|
|
11710
11876
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
11711
11877
|
var import_jsonrepair2 = require("jsonrepair");
|
|
@@ -11777,8 +11943,8 @@ var cleanToolSchema = (schema) => {
|
|
|
11777
11943
|
};
|
|
11778
11944
|
|
|
11779
11945
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
11780
|
-
var
|
|
11781
|
-
var
|
|
11946
|
+
var import_node_process7 = require("node:process");
|
|
11947
|
+
var import_node_process8 = __toESM(require("node:process"), 1);
|
|
11782
11948
|
var import_node_crypto = require("node:crypto");
|
|
11783
11949
|
function createTransport(def) {
|
|
11784
11950
|
const defAny = def;
|
|
@@ -11819,10 +11985,10 @@ function createTransport(def) {
|
|
|
11819
11985
|
command: defAny.command,
|
|
11820
11986
|
args: defAny.args,
|
|
11821
11987
|
env: {
|
|
11822
|
-
...
|
|
11988
|
+
...import_node_process8.default.env,
|
|
11823
11989
|
...defAny.env ?? {}
|
|
11824
11990
|
},
|
|
11825
|
-
cwd: (0,
|
|
11991
|
+
cwd: (0, import_node_process7.cwd)()
|
|
11826
11992
|
});
|
|
11827
11993
|
}
|
|
11828
11994
|
throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
|
|
@@ -12469,7 +12635,7 @@ function endSpan(span, error) {
|
|
|
12469
12635
|
}
|
|
12470
12636
|
|
|
12471
12637
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
12472
|
-
var
|
|
12638
|
+
var import_node_process9 = __toESM(require("node:process"), 1);
|
|
12473
12639
|
var AgenticExecutor = class {
|
|
12474
12640
|
name;
|
|
12475
12641
|
allToolNames;
|
|
@@ -12489,13 +12655,13 @@ var AgenticExecutor = class {
|
|
|
12489
12655
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
12490
12656
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
12491
12657
|
try {
|
|
12492
|
-
this.tracingEnabled =
|
|
12658
|
+
this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
|
|
12493
12659
|
if (this.tracingEnabled) {
|
|
12494
12660
|
initializeTracing({
|
|
12495
12661
|
enabled: true,
|
|
12496
12662
|
serviceName: `mcpc-agentic-${name}`,
|
|
12497
|
-
exportTo:
|
|
12498
|
-
otlpEndpoint:
|
|
12663
|
+
exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
12664
|
+
otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
12499
12665
|
});
|
|
12500
12666
|
}
|
|
12501
12667
|
} catch {
|
|
@@ -14552,6 +14718,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
14552
14718
|
toolManager;
|
|
14553
14719
|
logger = createLogger("mcpc.compose");
|
|
14554
14720
|
fileLoaders = /* @__PURE__ */ new Map();
|
|
14721
|
+
pluginsDisposed = false;
|
|
14555
14722
|
// Legacy property for backward compatibility
|
|
14556
14723
|
get toolNameMapping() {
|
|
14557
14724
|
return this.toolManager.getToolNameMapping();
|
|
@@ -15027,11 +15194,21 @@ var ComposableMCPServer = class extends Server {
|
|
|
15027
15194
|
async disposePlugins() {
|
|
15028
15195
|
await this.pluginManager.dispose();
|
|
15029
15196
|
}
|
|
15197
|
+
/**
|
|
15198
|
+
* Dispose plugins only once to avoid duplicated cleanup in chained handlers.
|
|
15199
|
+
*/
|
|
15200
|
+
async disposePluginsOnce() {
|
|
15201
|
+
if (this.pluginsDisposed) {
|
|
15202
|
+
return;
|
|
15203
|
+
}
|
|
15204
|
+
this.pluginsDisposed = true;
|
|
15205
|
+
await this.disposePlugins();
|
|
15206
|
+
}
|
|
15030
15207
|
/**
|
|
15031
15208
|
* Close the server and ensure all plugins are disposed
|
|
15032
15209
|
*/
|
|
15033
15210
|
async close() {
|
|
15034
|
-
await this.
|
|
15211
|
+
await this.disposePluginsOnce();
|
|
15035
15212
|
await super.close();
|
|
15036
15213
|
}
|
|
15037
15214
|
async compose(name, description, depsConfig = {
|
|
@@ -15136,16 +15313,20 @@ var ComposableMCPServer = class extends Server {
|
|
|
15136
15313
|
server: this,
|
|
15137
15314
|
toolNames: Object.keys(allTools)
|
|
15138
15315
|
});
|
|
15316
|
+
const previousOnClose = this.onclose;
|
|
15139
15317
|
this.onclose = async () => {
|
|
15140
15318
|
await cleanupClients();
|
|
15141
|
-
await this.
|
|
15319
|
+
await this.disposePluginsOnce();
|
|
15142
15320
|
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
15321
|
+
previousOnClose?.();
|
|
15143
15322
|
};
|
|
15323
|
+
const previousOnError = this.onerror;
|
|
15144
15324
|
this.onerror = async (error) => {
|
|
15145
15325
|
await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
|
|
15146
15326
|
await cleanupClients();
|
|
15147
|
-
await this.
|
|
15327
|
+
await this.disposePluginsOnce();
|
|
15148
15328
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
15329
|
+
previousOnError?.(error);
|
|
15149
15330
|
};
|
|
15150
15331
|
const toolNameToDetailList = Object.entries(allTools);
|
|
15151
15332
|
const publicToolNames = this.getPublicToolNames();
|
|
@@ -15210,12 +15391,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
15210
15391
|
};
|
|
15211
15392
|
|
|
15212
15393
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
15213
|
-
var
|
|
15214
|
-
var isSCF = () => Boolean(
|
|
15394
|
+
var import_node_process10 = __toESM(require("node:process"), 1);
|
|
15395
|
+
var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
|
|
15215
15396
|
if (isSCF()) {
|
|
15216
15397
|
console.log({
|
|
15217
15398
|
isSCF: isSCF(),
|
|
15218
|
-
SCF_RUNTIME:
|
|
15399
|
+
SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
|
|
15219
15400
|
});
|
|
15220
15401
|
}
|
|
15221
15402
|
|
|
@@ -15298,8 +15479,8 @@ var createApp = (config) => {
|
|
|
15298
15479
|
|
|
15299
15480
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.js
|
|
15300
15481
|
var import_zod_openapi4 = require("@hono/zod-openapi");
|
|
15301
|
-
var
|
|
15302
|
-
var port = Number(
|
|
15482
|
+
var import_node_process11 = __toESM(require("node:process"), 1);
|
|
15483
|
+
var port = Number(import_node_process11.default.env.PORT || "3002");
|
|
15303
15484
|
var hostname = "0.0.0.0";
|
|
15304
15485
|
async function main() {
|
|
15305
15486
|
const config = await loadConfig();
|