@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/server.mjs
CHANGED
|
@@ -509,7 +509,7 @@ var require_cross_spawn = __commonJS({
|
|
|
509
509
|
var cp = __require("child_process");
|
|
510
510
|
var parse2 = require_parse();
|
|
511
511
|
var enoent = require_enoent();
|
|
512
|
-
function
|
|
512
|
+
function spawn3(command, args, options) {
|
|
513
513
|
const parsed = parse2(command, args, options);
|
|
514
514
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
515
515
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -521,8 +521,8 @@ var require_cross_spawn = __commonJS({
|
|
|
521
521
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
522
522
|
return result;
|
|
523
523
|
}
|
|
524
|
-
module.exports =
|
|
525
|
-
module.exports.spawn =
|
|
524
|
+
module.exports = spawn3;
|
|
525
|
+
module.exports.spawn = spawn3;
|
|
526
526
|
module.exports.sync = spawnSync;
|
|
527
527
|
module.exports._parse = parse2;
|
|
528
528
|
module.exports._enoent = enoent;
|
|
@@ -2583,15 +2583,17 @@ var Response2 = class _Response {
|
|
|
2583
2583
|
this.#init = init;
|
|
2584
2584
|
}
|
|
2585
2585
|
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
|
2586
|
-
|
|
2587
|
-
this[cacheKey] = [init?.status || 200, body, headers];
|
|
2586
|
+
;
|
|
2587
|
+
this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
|
|
2588
2588
|
}
|
|
2589
2589
|
}
|
|
2590
2590
|
get headers() {
|
|
2591
2591
|
const cache = this[cacheKey];
|
|
2592
2592
|
if (cache) {
|
|
2593
2593
|
if (!(cache[2] instanceof Headers)) {
|
|
2594
|
-
cache[2] = new Headers(
|
|
2594
|
+
cache[2] = new Headers(
|
|
2595
|
+
cache[2] || { "content-type": "text/plain; charset=UTF-8" }
|
|
2596
|
+
);
|
|
2595
2597
|
}
|
|
2596
2598
|
return cache[2];
|
|
2597
2599
|
}
|
|
@@ -2716,15 +2718,32 @@ var flushHeaders = (outgoing) => {
|
|
|
2716
2718
|
};
|
|
2717
2719
|
var responseViaCache = async (res, outgoing) => {
|
|
2718
2720
|
let [status, body, header] = res[cacheKey];
|
|
2719
|
-
|
|
2721
|
+
let hasContentLength = false;
|
|
2722
|
+
if (!header) {
|
|
2723
|
+
header = { "content-type": "text/plain; charset=UTF-8" };
|
|
2724
|
+
} else if (header instanceof Headers) {
|
|
2725
|
+
hasContentLength = header.has("content-length");
|
|
2720
2726
|
header = buildOutgoingHttpHeaders(header);
|
|
2727
|
+
} else if (Array.isArray(header)) {
|
|
2728
|
+
const headerObj = new Headers(header);
|
|
2729
|
+
hasContentLength = headerObj.has("content-length");
|
|
2730
|
+
header = buildOutgoingHttpHeaders(headerObj);
|
|
2731
|
+
} else {
|
|
2732
|
+
for (const key in header) {
|
|
2733
|
+
if (key.length === 14 && key.toLowerCase() === "content-length") {
|
|
2734
|
+
hasContentLength = true;
|
|
2735
|
+
break;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2721
2738
|
}
|
|
2722
|
-
if (
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2739
|
+
if (!hasContentLength) {
|
|
2740
|
+
if (typeof body === "string") {
|
|
2741
|
+
header["Content-Length"] = Buffer.byteLength(body);
|
|
2742
|
+
} else if (body instanceof Uint8Array) {
|
|
2743
|
+
header["Content-Length"] = body.byteLength;
|
|
2744
|
+
} else if (body instanceof Blob) {
|
|
2745
|
+
header["Content-Length"] = body.size;
|
|
2746
|
+
}
|
|
2728
2747
|
}
|
|
2729
2748
|
outgoing.writeHead(status, header);
|
|
2730
2749
|
if (typeof body === "string" || body instanceof Uint8Array) {
|
|
@@ -3877,7 +3896,7 @@ function parseArgs(args, options) {
|
|
|
3877
3896
|
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
3878
3897
|
import { homedir } from "node:os";
|
|
3879
3898
|
import { dirname, join as join3, resolve as resolve4 } from "node:path";
|
|
3880
|
-
import
|
|
3899
|
+
import process5 from "node:process";
|
|
3881
3900
|
|
|
3882
3901
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
3883
3902
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
@@ -4438,6 +4457,152 @@ Skill path: ${meta.basePath}
|
|
|
4438
4457
|
};
|
|
4439
4458
|
}
|
|
4440
4459
|
|
|
4460
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
4461
|
+
import { spawn } from "node:child_process";
|
|
4462
|
+
import process2 from "node:process";
|
|
4463
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
4464
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
4465
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
4466
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
4467
|
+
const fullOutput = (stderr ? `STDERR:
|
|
4468
|
+
${stderr}
|
|
4469
|
+
|
|
4470
|
+
STDOUT:
|
|
4471
|
+
` : "") + stdout;
|
|
4472
|
+
const lines = fullOutput.split("\n");
|
|
4473
|
+
if (lines.length > maxLines) {
|
|
4474
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
4475
|
+
return {
|
|
4476
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
4477
|
+
|
|
4478
|
+
` + truncatedLines.join("\n"),
|
|
4479
|
+
truncated: true
|
|
4480
|
+
};
|
|
4481
|
+
}
|
|
4482
|
+
if (fullOutput.length > maxBytes) {
|
|
4483
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
4484
|
+
return {
|
|
4485
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
4486
|
+
|
|
4487
|
+
` + truncatedBytes,
|
|
4488
|
+
truncated: true
|
|
4489
|
+
};
|
|
4490
|
+
}
|
|
4491
|
+
return {
|
|
4492
|
+
output: fullOutput,
|
|
4493
|
+
truncated: false
|
|
4494
|
+
};
|
|
4495
|
+
}
|
|
4496
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
4497
|
+
return new Promise((resolve5) => {
|
|
4498
|
+
const stdout = [];
|
|
4499
|
+
const stderr = [];
|
|
4500
|
+
const proc = spawn("bash", [
|
|
4501
|
+
"-c",
|
|
4502
|
+
command
|
|
4503
|
+
], {
|
|
4504
|
+
cwd: cwd2,
|
|
4505
|
+
stdio: [
|
|
4506
|
+
"ignore",
|
|
4507
|
+
"pipe",
|
|
4508
|
+
"pipe"
|
|
4509
|
+
]
|
|
4510
|
+
});
|
|
4511
|
+
proc.stdout?.on("data", (data) => {
|
|
4512
|
+
stdout.push(data.toString());
|
|
4513
|
+
});
|
|
4514
|
+
proc.stderr?.on("data", (data) => {
|
|
4515
|
+
stderr.push(data.toString());
|
|
4516
|
+
});
|
|
4517
|
+
proc.on("close", (code) => {
|
|
4518
|
+
resolve5({
|
|
4519
|
+
stdout: stdout.join(""),
|
|
4520
|
+
stderr: stderr.join(""),
|
|
4521
|
+
exitCode: code
|
|
4522
|
+
});
|
|
4523
|
+
});
|
|
4524
|
+
proc.on("error", (err) => {
|
|
4525
|
+
resolve5({
|
|
4526
|
+
stdout: "",
|
|
4527
|
+
stderr: err.message,
|
|
4528
|
+
exitCode: null
|
|
4529
|
+
});
|
|
4530
|
+
});
|
|
4531
|
+
setTimeout(() => {
|
|
4532
|
+
proc.kill("SIGTERM");
|
|
4533
|
+
resolve5({
|
|
4534
|
+
stdout: stdout.join(""),
|
|
4535
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
4536
|
+
exitCode: null
|
|
4537
|
+
});
|
|
4538
|
+
}, timeoutMs);
|
|
4539
|
+
});
|
|
4540
|
+
}
|
|
4541
|
+
function createBashPlugin(options = {}) {
|
|
4542
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
4543
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
4544
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
4545
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
4546
|
+
...options
|
|
4547
|
+
};
|
|
4548
|
+
let serverRef = null;
|
|
4549
|
+
return {
|
|
4550
|
+
name: "plugin-bash",
|
|
4551
|
+
version: "1.0.0",
|
|
4552
|
+
// Store server reference for tool registration
|
|
4553
|
+
configureServer: (server) => {
|
|
4554
|
+
serverRef = server;
|
|
4555
|
+
},
|
|
4556
|
+
// Register bash tool with agent name prefix
|
|
4557
|
+
composeStart: (context2) => {
|
|
4558
|
+
if (!serverRef) return;
|
|
4559
|
+
const agentName = context2.serverName;
|
|
4560
|
+
const toolName = `${agentName}__bash`;
|
|
4561
|
+
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.", {
|
|
4562
|
+
type: "object",
|
|
4563
|
+
properties: {
|
|
4564
|
+
command: {
|
|
4565
|
+
type: "string",
|
|
4566
|
+
description: "The bash command to execute"
|
|
4567
|
+
},
|
|
4568
|
+
cwd: {
|
|
4569
|
+
type: "string",
|
|
4570
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
4571
|
+
}
|
|
4572
|
+
},
|
|
4573
|
+
required: [
|
|
4574
|
+
"command"
|
|
4575
|
+
]
|
|
4576
|
+
}, async (args) => {
|
|
4577
|
+
const cwd2 = args.cwd || process2.cwd();
|
|
4578
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
4579
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
4580
|
+
let finalOutput = output;
|
|
4581
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
4582
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
4583
|
+
` + finalOutput;
|
|
4584
|
+
}
|
|
4585
|
+
if (truncated) {
|
|
4586
|
+
finalOutput += `
|
|
4587
|
+
|
|
4588
|
+
[Note: Output was truncated]`;
|
|
4589
|
+
}
|
|
4590
|
+
return {
|
|
4591
|
+
content: [
|
|
4592
|
+
{
|
|
4593
|
+
type: "text",
|
|
4594
|
+
text: finalOutput
|
|
4595
|
+
}
|
|
4596
|
+
],
|
|
4597
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
4598
|
+
};
|
|
4599
|
+
}, {
|
|
4600
|
+
internal: true
|
|
4601
|
+
});
|
|
4602
|
+
}
|
|
4603
|
+
};
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4441
4606
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
4442
4607
|
import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
|
|
4443
4608
|
|
|
@@ -6417,10 +6582,10 @@ function parse(content, options = {}) {
|
|
|
6417
6582
|
}
|
|
6418
6583
|
|
|
6419
6584
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
6420
|
-
import
|
|
6585
|
+
import process3 from "node:process";
|
|
6421
6586
|
function replaceEnvVars(str2) {
|
|
6422
6587
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
6423
|
-
const value =
|
|
6588
|
+
const value = process3.env[varName];
|
|
6424
6589
|
if (value !== void 0) {
|
|
6425
6590
|
return value;
|
|
6426
6591
|
}
|
|
@@ -6519,18 +6684,19 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
6519
6684
|
|
|
6520
6685
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
6521
6686
|
import { resolve as resolve3 } from "node:path";
|
|
6522
|
-
import
|
|
6687
|
+
import process4 from "node:process";
|
|
6523
6688
|
var DEFAULT_SKILLS_PATHS = [
|
|
6524
6689
|
".agent/skills"
|
|
6525
6690
|
];
|
|
6526
6691
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
6527
6692
|
function getGlobalPlugins(skillsPaths) {
|
|
6528
|
-
const resolvedPaths = skillsPaths.map((p2) => resolve3(
|
|
6693
|
+
const resolvedPaths = skillsPaths.map((p2) => resolve3(process4.cwd(), p2));
|
|
6529
6694
|
return [
|
|
6530
6695
|
markdownLoaderPlugin(),
|
|
6531
6696
|
createSkillsPlugin({
|
|
6532
6697
|
paths: resolvedPaths
|
|
6533
|
-
})
|
|
6698
|
+
}),
|
|
6699
|
+
createBashPlugin()
|
|
6534
6700
|
];
|
|
6535
6701
|
}
|
|
6536
6702
|
function getAgentPlugins() {
|
|
@@ -6559,7 +6725,7 @@ function getDefaultAgents() {
|
|
|
6559
6725
|
}
|
|
6560
6726
|
|
|
6561
6727
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
6562
|
-
var CLI_VERSION = "0.1.
|
|
6728
|
+
var CLI_VERSION = "0.1.53";
|
|
6563
6729
|
function extractServerName(command, commandArgs) {
|
|
6564
6730
|
for (const arg of commandArgs) {
|
|
6565
6731
|
if (!arg.startsWith("-")) {
|
|
@@ -6619,7 +6785,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
6619
6785
|
async function createWrapConfig(args) {
|
|
6620
6786
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
6621
6787
|
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'");
|
|
6622
|
-
|
|
6788
|
+
process5.exit(1);
|
|
6623
6789
|
}
|
|
6624
6790
|
const mcpServers = {};
|
|
6625
6791
|
const serverNames = [];
|
|
@@ -6742,7 +6908,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
6742
6908
|
};
|
|
6743
6909
|
}
|
|
6744
6910
|
function parseCLIArgs() {
|
|
6745
|
-
const args = parseArgs(
|
|
6911
|
+
const args = parseArgs(process5.argv.slice(2), {
|
|
6746
6912
|
boolean: [
|
|
6747
6913
|
"help",
|
|
6748
6914
|
"version",
|
|
@@ -6831,15 +6997,15 @@ async function loadConfig() {
|
|
|
6831
6997
|
const args = parseCLIArgs();
|
|
6832
6998
|
if (args.version) {
|
|
6833
6999
|
printVersion();
|
|
6834
|
-
|
|
7000
|
+
process5.exit(0);
|
|
6835
7001
|
}
|
|
6836
7002
|
if (args.help) {
|
|
6837
7003
|
printHelp();
|
|
6838
|
-
|
|
7004
|
+
process5.exit(0);
|
|
6839
7005
|
}
|
|
6840
7006
|
if (args.cwd) {
|
|
6841
|
-
const targetCwd = resolve4(
|
|
6842
|
-
|
|
7007
|
+
const targetCwd = resolve4(process5.cwd(), args.cwd);
|
|
7008
|
+
process5.chdir(targetCwd);
|
|
6843
7009
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
6844
7010
|
}
|
|
6845
7011
|
const mergeSkills = (config) => {
|
|
@@ -6851,7 +7017,7 @@ async function loadConfig() {
|
|
|
6851
7017
|
...args,
|
|
6852
7018
|
saveConfig: true
|
|
6853
7019
|
});
|
|
6854
|
-
|
|
7020
|
+
process5.exit(0);
|
|
6855
7021
|
}
|
|
6856
7022
|
if (args.wrap) {
|
|
6857
7023
|
return mergeSkills(await createWrapConfig({
|
|
@@ -6868,16 +7034,16 @@ async function loadConfig() {
|
|
|
6868
7034
|
throw error;
|
|
6869
7035
|
}
|
|
6870
7036
|
}
|
|
6871
|
-
if (
|
|
7037
|
+
if (process5.env.MCPC_CONFIG) {
|
|
6872
7038
|
try {
|
|
6873
|
-
const parsed = JSON.parse(
|
|
7039
|
+
const parsed = JSON.parse(process5.env.MCPC_CONFIG);
|
|
6874
7040
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
6875
7041
|
} catch (error) {
|
|
6876
7042
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
6877
7043
|
throw error;
|
|
6878
7044
|
}
|
|
6879
7045
|
}
|
|
6880
|
-
const configUrl = args.configUrl ||
|
|
7046
|
+
const configUrl = args.configUrl || process5.env.MCPC_CONFIG_URL;
|
|
6881
7047
|
if (configUrl) {
|
|
6882
7048
|
try {
|
|
6883
7049
|
const headers = {
|
|
@@ -6898,7 +7064,7 @@ async function loadConfig() {
|
|
|
6898
7064
|
throw error;
|
|
6899
7065
|
}
|
|
6900
7066
|
}
|
|
6901
|
-
const configFile = args.configFile ||
|
|
7067
|
+
const configFile = args.configFile || process5.env.MCPC_CONFIG_FILE;
|
|
6902
7068
|
if (configFile) {
|
|
6903
7069
|
try {
|
|
6904
7070
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -6923,7 +7089,7 @@ async function loadConfig() {
|
|
|
6923
7089
|
throw error;
|
|
6924
7090
|
}
|
|
6925
7091
|
}
|
|
6926
|
-
const defaultJsonConfigPath = resolve4(
|
|
7092
|
+
const defaultJsonConfigPath = resolve4(process5.cwd(), "mcpc.config.json");
|
|
6927
7093
|
try {
|
|
6928
7094
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
6929
7095
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -6938,7 +7104,7 @@ async function loadConfig() {
|
|
|
6938
7104
|
}
|
|
6939
7105
|
function replaceEnvVars2(str2) {
|
|
6940
7106
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
6941
|
-
return
|
|
7107
|
+
return process5.env[varName] || "";
|
|
6942
7108
|
});
|
|
6943
7109
|
}
|
|
6944
7110
|
function isMarkdownFile2(path) {
|
|
@@ -6982,7 +7148,7 @@ function applyModeOverride(config, mode) {
|
|
|
6982
7148
|
agent.options.mode = mode;
|
|
6983
7149
|
if (mode === "ai_acp" && !agent.options.acpSettings) {
|
|
6984
7150
|
agent.options.acpSettings = {
|
|
6985
|
-
command: "claude-
|
|
7151
|
+
command: "claude-agent-acp",
|
|
6986
7152
|
args: [],
|
|
6987
7153
|
session: {}
|
|
6988
7154
|
};
|
|
@@ -9569,7 +9735,7 @@ var Client = class extends Protocol {
|
|
|
9569
9735
|
|
|
9570
9736
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
9571
9737
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
9572
|
-
import
|
|
9738
|
+
import process6 from "node:process";
|
|
9573
9739
|
import { PassThrough } from "node:stream";
|
|
9574
9740
|
|
|
9575
9741
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
@@ -9601,7 +9767,7 @@ function serializeMessage(message) {
|
|
|
9601
9767
|
}
|
|
9602
9768
|
|
|
9603
9769
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
9604
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
9770
|
+
var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
|
|
9605
9771
|
"APPDATA",
|
|
9606
9772
|
"HOMEDRIVE",
|
|
9607
9773
|
"HOMEPATH",
|
|
@@ -9621,7 +9787,7 @@ var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
|
|
|
9621
9787
|
function getDefaultEnvironment() {
|
|
9622
9788
|
const env = {};
|
|
9623
9789
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
9624
|
-
const value =
|
|
9790
|
+
const value = process6.env[key];
|
|
9625
9791
|
if (value === void 0) {
|
|
9626
9792
|
continue;
|
|
9627
9793
|
}
|
|
@@ -9657,7 +9823,7 @@ var StdioClientTransport = class {
|
|
|
9657
9823
|
},
|
|
9658
9824
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
9659
9825
|
shell: false,
|
|
9660
|
-
windowsHide:
|
|
9826
|
+
windowsHide: process6.platform === "win32" && isElectron(),
|
|
9661
9827
|
cwd: this._serverParams.cwd
|
|
9662
9828
|
});
|
|
9663
9829
|
this._process.on("error", (error) => {
|
|
@@ -9765,7 +9931,7 @@ var StdioClientTransport = class {
|
|
|
9765
9931
|
}
|
|
9766
9932
|
};
|
|
9767
9933
|
function isElectron() {
|
|
9768
|
-
return "type" in
|
|
9934
|
+
return "type" in process6;
|
|
9769
9935
|
}
|
|
9770
9936
|
|
|
9771
9937
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -11689,8 +11855,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
11689
11855
|
};
|
|
11690
11856
|
|
|
11691
11857
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
11692
|
-
import
|
|
11693
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
11858
|
+
import process7 from "node:process";
|
|
11859
|
+
var GEMINI_PREFERRED_FORMAT = process7.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
11694
11860
|
|
|
11695
11861
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
11696
11862
|
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
@@ -11763,7 +11929,7 @@ var cleanToolSchema = (schema) => {
|
|
|
11763
11929
|
|
|
11764
11930
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
11765
11931
|
import { cwd } from "node:process";
|
|
11766
|
-
import
|
|
11932
|
+
import process8 from "node:process";
|
|
11767
11933
|
import { createHash } from "node:crypto";
|
|
11768
11934
|
function createTransport(def) {
|
|
11769
11935
|
const defAny = def;
|
|
@@ -11804,7 +11970,7 @@ function createTransport(def) {
|
|
|
11804
11970
|
command: defAny.command,
|
|
11805
11971
|
args: defAny.args,
|
|
11806
11972
|
env: {
|
|
11807
|
-
...
|
|
11973
|
+
...process8.env,
|
|
11808
11974
|
...defAny.env ?? {}
|
|
11809
11975
|
},
|
|
11810
11976
|
cwd: cwd()
|
|
@@ -12454,7 +12620,7 @@ function endSpan(span, error) {
|
|
|
12454
12620
|
}
|
|
12455
12621
|
|
|
12456
12622
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
12457
|
-
import
|
|
12623
|
+
import process9 from "node:process";
|
|
12458
12624
|
var AgenticExecutor = class {
|
|
12459
12625
|
name;
|
|
12460
12626
|
allToolNames;
|
|
@@ -12474,13 +12640,13 @@ var AgenticExecutor = class {
|
|
|
12474
12640
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
12475
12641
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
12476
12642
|
try {
|
|
12477
|
-
this.tracingEnabled =
|
|
12643
|
+
this.tracingEnabled = process9.env.MCPC_TRACING_ENABLED === "true";
|
|
12478
12644
|
if (this.tracingEnabled) {
|
|
12479
12645
|
initializeTracing({
|
|
12480
12646
|
enabled: true,
|
|
12481
12647
|
serviceName: `mcpc-agentic-${name}`,
|
|
12482
|
-
exportTo:
|
|
12483
|
-
otlpEndpoint:
|
|
12648
|
+
exportTo: process9.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
12649
|
+
otlpEndpoint: process9.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
12484
12650
|
});
|
|
12485
12651
|
}
|
|
12486
12652
|
} catch {
|
|
@@ -14536,6 +14702,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
14536
14702
|
toolManager;
|
|
14537
14703
|
logger = createLogger("mcpc.compose");
|
|
14538
14704
|
fileLoaders = /* @__PURE__ */ new Map();
|
|
14705
|
+
pluginsDisposed = false;
|
|
14539
14706
|
// Legacy property for backward compatibility
|
|
14540
14707
|
get toolNameMapping() {
|
|
14541
14708
|
return this.toolManager.getToolNameMapping();
|
|
@@ -15011,11 +15178,21 @@ var ComposableMCPServer = class extends Server {
|
|
|
15011
15178
|
async disposePlugins() {
|
|
15012
15179
|
await this.pluginManager.dispose();
|
|
15013
15180
|
}
|
|
15181
|
+
/**
|
|
15182
|
+
* Dispose plugins only once to avoid duplicated cleanup in chained handlers.
|
|
15183
|
+
*/
|
|
15184
|
+
async disposePluginsOnce() {
|
|
15185
|
+
if (this.pluginsDisposed) {
|
|
15186
|
+
return;
|
|
15187
|
+
}
|
|
15188
|
+
this.pluginsDisposed = true;
|
|
15189
|
+
await this.disposePlugins();
|
|
15190
|
+
}
|
|
15014
15191
|
/**
|
|
15015
15192
|
* Close the server and ensure all plugins are disposed
|
|
15016
15193
|
*/
|
|
15017
15194
|
async close() {
|
|
15018
|
-
await this.
|
|
15195
|
+
await this.disposePluginsOnce();
|
|
15019
15196
|
await super.close();
|
|
15020
15197
|
}
|
|
15021
15198
|
async compose(name, description, depsConfig = {
|
|
@@ -15120,16 +15297,20 @@ var ComposableMCPServer = class extends Server {
|
|
|
15120
15297
|
server: this,
|
|
15121
15298
|
toolNames: Object.keys(allTools)
|
|
15122
15299
|
});
|
|
15300
|
+
const previousOnClose = this.onclose;
|
|
15123
15301
|
this.onclose = async () => {
|
|
15124
15302
|
await cleanupClients();
|
|
15125
|
-
await this.
|
|
15303
|
+
await this.disposePluginsOnce();
|
|
15126
15304
|
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
15305
|
+
previousOnClose?.();
|
|
15127
15306
|
};
|
|
15307
|
+
const previousOnError = this.onerror;
|
|
15128
15308
|
this.onerror = async (error) => {
|
|
15129
15309
|
await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
|
|
15130
15310
|
await cleanupClients();
|
|
15131
|
-
await this.
|
|
15311
|
+
await this.disposePluginsOnce();
|
|
15132
15312
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
15313
|
+
previousOnError?.(error);
|
|
15133
15314
|
};
|
|
15134
15315
|
const toolNameToDetailList = Object.entries(allTools);
|
|
15135
15316
|
const publicToolNames = this.getPublicToolNames();
|
|
@@ -15194,12 +15375,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
15194
15375
|
};
|
|
15195
15376
|
|
|
15196
15377
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
15197
|
-
import
|
|
15198
|
-
var isSCF = () => Boolean(
|
|
15378
|
+
import process10 from "node:process";
|
|
15379
|
+
var isSCF = () => Boolean(process10.env.SCF_RUNTIME || process10.env.PROD_SCF);
|
|
15199
15380
|
if (isSCF()) {
|
|
15200
15381
|
console.log({
|
|
15201
15382
|
isSCF: isSCF(),
|
|
15202
|
-
SCF_RUNTIME:
|
|
15383
|
+
SCF_RUNTIME: process10.env.SCF_RUNTIME
|
|
15203
15384
|
});
|
|
15204
15385
|
}
|
|
15205
15386
|
|
|
@@ -15281,8 +15462,8 @@ var createApp = (config) => {
|
|
|
15281
15462
|
};
|
|
15282
15463
|
|
|
15283
15464
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.ts
|
|
15284
|
-
import
|
|
15285
|
-
var port = Number(
|
|
15465
|
+
import process11 from "node:process";
|
|
15466
|
+
var port = Number(process11.env.PORT || "3002");
|
|
15286
15467
|
var hostname = "0.0.0.0";
|
|
15287
15468
|
async function main() {
|
|
15288
15469
|
const config = await loadConfig();
|