@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/bin/mcpc.mjs
CHANGED
|
@@ -510,7 +510,7 @@ var require_cross_spawn = __commonJS({
|
|
|
510
510
|
var cp = __require("child_process");
|
|
511
511
|
var parse2 = require_parse();
|
|
512
512
|
var enoent = require_enoent();
|
|
513
|
-
function
|
|
513
|
+
function spawn3(command, args, options) {
|
|
514
514
|
const parsed = parse2(command, args, options);
|
|
515
515
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
516
516
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -522,8 +522,8 @@ var require_cross_spawn = __commonJS({
|
|
|
522
522
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
523
523
|
return result;
|
|
524
524
|
}
|
|
525
|
-
module.exports =
|
|
526
|
-
module.exports.spawn =
|
|
525
|
+
module.exports = spawn3;
|
|
526
|
+
module.exports.spawn = spawn3;
|
|
527
527
|
module.exports.sync = spawnSync;
|
|
528
528
|
module.exports._parse = parse2;
|
|
529
529
|
module.exports._enoent = enoent;
|
|
@@ -2342,15 +2342,17 @@ var Response2 = class _Response {
|
|
|
2342
2342
|
this.#init = init;
|
|
2343
2343
|
}
|
|
2344
2344
|
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
|
2345
|
-
|
|
2346
|
-
this[cacheKey] = [init?.status || 200, body, headers];
|
|
2345
|
+
;
|
|
2346
|
+
this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
2349
|
get headers() {
|
|
2350
2350
|
const cache = this[cacheKey];
|
|
2351
2351
|
if (cache) {
|
|
2352
2352
|
if (!(cache[2] instanceof Headers)) {
|
|
2353
|
-
cache[2] = new Headers(
|
|
2353
|
+
cache[2] = new Headers(
|
|
2354
|
+
cache[2] || { "content-type": "text/plain; charset=UTF-8" }
|
|
2355
|
+
);
|
|
2354
2356
|
}
|
|
2355
2357
|
return cache[2];
|
|
2356
2358
|
}
|
|
@@ -2658,7 +2660,7 @@ function parseArgs(args, options) {
|
|
|
2658
2660
|
import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
2659
2661
|
import { homedir } from "node:os";
|
|
2660
2662
|
import { dirname, join as join3, resolve as resolve4 } from "node:path";
|
|
2661
|
-
import
|
|
2663
|
+
import process6 from "node:process";
|
|
2662
2664
|
|
|
2663
2665
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
|
|
2664
2666
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
@@ -3219,6 +3221,152 @@ Skill path: ${meta.basePath}
|
|
|
3219
3221
|
};
|
|
3220
3222
|
}
|
|
3221
3223
|
|
|
3224
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
|
|
3225
|
+
import { spawn } from "node:child_process";
|
|
3226
|
+
import process3 from "node:process";
|
|
3227
|
+
var DEFAULT_MAX_BYTES = 1e5;
|
|
3228
|
+
var DEFAULT_MAX_LINES = 2e3;
|
|
3229
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
3230
|
+
function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
|
|
3231
|
+
const fullOutput = (stderr ? `STDERR:
|
|
3232
|
+
${stderr}
|
|
3233
|
+
|
|
3234
|
+
STDOUT:
|
|
3235
|
+
` : "") + stdout;
|
|
3236
|
+
const lines = fullOutput.split("\n");
|
|
3237
|
+
if (lines.length > maxLines) {
|
|
3238
|
+
const truncatedLines = lines.slice(-maxLines);
|
|
3239
|
+
return {
|
|
3240
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
|
|
3241
|
+
|
|
3242
|
+
` + truncatedLines.join("\n"),
|
|
3243
|
+
truncated: true
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
if (fullOutput.length > maxBytes) {
|
|
3247
|
+
const truncatedBytes = fullOutput.slice(-maxBytes);
|
|
3248
|
+
return {
|
|
3249
|
+
output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
|
|
3250
|
+
|
|
3251
|
+
` + truncatedBytes,
|
|
3252
|
+
truncated: true
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
return {
|
|
3256
|
+
output: fullOutput,
|
|
3257
|
+
truncated: false
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
function executeBash(command, cwd2, timeoutMs) {
|
|
3261
|
+
return new Promise((resolve5) => {
|
|
3262
|
+
const stdout = [];
|
|
3263
|
+
const stderr = [];
|
|
3264
|
+
const proc = spawn("bash", [
|
|
3265
|
+
"-c",
|
|
3266
|
+
command
|
|
3267
|
+
], {
|
|
3268
|
+
cwd: cwd2,
|
|
3269
|
+
stdio: [
|
|
3270
|
+
"ignore",
|
|
3271
|
+
"pipe",
|
|
3272
|
+
"pipe"
|
|
3273
|
+
]
|
|
3274
|
+
});
|
|
3275
|
+
proc.stdout?.on("data", (data) => {
|
|
3276
|
+
stdout.push(data.toString());
|
|
3277
|
+
});
|
|
3278
|
+
proc.stderr?.on("data", (data) => {
|
|
3279
|
+
stderr.push(data.toString());
|
|
3280
|
+
});
|
|
3281
|
+
proc.on("close", (code) => {
|
|
3282
|
+
resolve5({
|
|
3283
|
+
stdout: stdout.join(""),
|
|
3284
|
+
stderr: stderr.join(""),
|
|
3285
|
+
exitCode: code
|
|
3286
|
+
});
|
|
3287
|
+
});
|
|
3288
|
+
proc.on("error", (err) => {
|
|
3289
|
+
resolve5({
|
|
3290
|
+
stdout: "",
|
|
3291
|
+
stderr: err.message,
|
|
3292
|
+
exitCode: null
|
|
3293
|
+
});
|
|
3294
|
+
});
|
|
3295
|
+
setTimeout(() => {
|
|
3296
|
+
proc.kill("SIGTERM");
|
|
3297
|
+
resolve5({
|
|
3298
|
+
stdout: stdout.join(""),
|
|
3299
|
+
stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
|
|
3300
|
+
exitCode: null
|
|
3301
|
+
});
|
|
3302
|
+
}, timeoutMs);
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
function createBashPlugin(options = {}) {
|
|
3306
|
+
const { maxBytes, maxLines, timeoutMs } = {
|
|
3307
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
3308
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
3309
|
+
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
3310
|
+
...options
|
|
3311
|
+
};
|
|
3312
|
+
let serverRef = null;
|
|
3313
|
+
return {
|
|
3314
|
+
name: "plugin-bash",
|
|
3315
|
+
version: "1.0.0",
|
|
3316
|
+
// Store server reference for tool registration
|
|
3317
|
+
configureServer: (server) => {
|
|
3318
|
+
serverRef = server;
|
|
3319
|
+
},
|
|
3320
|
+
// Register bash tool with agent name prefix
|
|
3321
|
+
composeStart: (context2) => {
|
|
3322
|
+
if (!serverRef) return;
|
|
3323
|
+
const agentName = context2.serverName;
|
|
3324
|
+
const toolName = `${agentName}__bash`;
|
|
3325
|
+
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.", {
|
|
3326
|
+
type: "object",
|
|
3327
|
+
properties: {
|
|
3328
|
+
command: {
|
|
3329
|
+
type: "string",
|
|
3330
|
+
description: "The bash command to execute"
|
|
3331
|
+
},
|
|
3332
|
+
cwd: {
|
|
3333
|
+
type: "string",
|
|
3334
|
+
description: "Optional: Working directory for the command (defaults to current directory)"
|
|
3335
|
+
}
|
|
3336
|
+
},
|
|
3337
|
+
required: [
|
|
3338
|
+
"command"
|
|
3339
|
+
]
|
|
3340
|
+
}, async (args) => {
|
|
3341
|
+
const cwd2 = args.cwd || process3.cwd();
|
|
3342
|
+
const result = await executeBash(args.command, cwd2, timeoutMs);
|
|
3343
|
+
const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
|
|
3344
|
+
let finalOutput = output;
|
|
3345
|
+
if (result.exitCode !== null && result.exitCode !== 0) {
|
|
3346
|
+
finalOutput = `[EXIT CODE: ${result.exitCode}]
|
|
3347
|
+
` + finalOutput;
|
|
3348
|
+
}
|
|
3349
|
+
if (truncated) {
|
|
3350
|
+
finalOutput += `
|
|
3351
|
+
|
|
3352
|
+
[Note: Output was truncated]`;
|
|
3353
|
+
}
|
|
3354
|
+
return {
|
|
3355
|
+
content: [
|
|
3356
|
+
{
|
|
3357
|
+
type: "text",
|
|
3358
|
+
text: finalOutput
|
|
3359
|
+
}
|
|
3360
|
+
],
|
|
3361
|
+
isError: result.exitCode !== null && result.exitCode !== 0
|
|
3362
|
+
};
|
|
3363
|
+
}, {
|
|
3364
|
+
internal: true
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
};
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3222
3370
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
3223
3371
|
import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
|
|
3224
3372
|
|
|
@@ -5198,10 +5346,10 @@ function parse(content, options = {}) {
|
|
|
5198
5346
|
}
|
|
5199
5347
|
|
|
5200
5348
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
|
|
5201
|
-
import
|
|
5349
|
+
import process4 from "node:process";
|
|
5202
5350
|
function replaceEnvVars(str2) {
|
|
5203
5351
|
return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
|
|
5204
|
-
const value =
|
|
5352
|
+
const value = process4.env[varName];
|
|
5205
5353
|
if (value !== void 0) {
|
|
5206
5354
|
return value;
|
|
5207
5355
|
}
|
|
@@ -5300,18 +5448,19 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
5300
5448
|
|
|
5301
5449
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
|
|
5302
5450
|
import { resolve as resolve3 } from "node:path";
|
|
5303
|
-
import
|
|
5451
|
+
import process5 from "node:process";
|
|
5304
5452
|
var DEFAULT_SKILLS_PATHS = [
|
|
5305
5453
|
".agent/skills"
|
|
5306
5454
|
];
|
|
5307
5455
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
5308
5456
|
function getGlobalPlugins(skillsPaths) {
|
|
5309
|
-
const resolvedPaths = skillsPaths.map((p2) => resolve3(
|
|
5457
|
+
const resolvedPaths = skillsPaths.map((p2) => resolve3(process5.cwd(), p2));
|
|
5310
5458
|
return [
|
|
5311
5459
|
markdownLoaderPlugin(),
|
|
5312
5460
|
createSkillsPlugin({
|
|
5313
5461
|
paths: resolvedPaths
|
|
5314
|
-
})
|
|
5462
|
+
}),
|
|
5463
|
+
createBashPlugin()
|
|
5315
5464
|
];
|
|
5316
5465
|
}
|
|
5317
5466
|
function getAgentPlugins() {
|
|
@@ -5340,7 +5489,7 @@ function getDefaultAgents() {
|
|
|
5340
5489
|
}
|
|
5341
5490
|
|
|
5342
5491
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
5343
|
-
var CLI_VERSION = "0.1.
|
|
5492
|
+
var CLI_VERSION = "0.1.53";
|
|
5344
5493
|
function extractServerName(command, commandArgs) {
|
|
5345
5494
|
for (const arg of commandArgs) {
|
|
5346
5495
|
if (!arg.startsWith("-")) {
|
|
@@ -5400,7 +5549,7 @@ async function saveUserConfig(config, newAgentName) {
|
|
|
5400
5549
|
async function createWrapConfig(args) {
|
|
5401
5550
|
if (!args.mcpServers || args.mcpServers.length === 0) {
|
|
5402
5551
|
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'");
|
|
5403
|
-
|
|
5552
|
+
process6.exit(1);
|
|
5404
5553
|
}
|
|
5405
5554
|
const mcpServers = {};
|
|
5406
5555
|
const serverNames = [];
|
|
@@ -5523,7 +5672,7 @@ function parseMcpServer(cmdString, transportType) {
|
|
|
5523
5672
|
};
|
|
5524
5673
|
}
|
|
5525
5674
|
function parseCLIArgs() {
|
|
5526
|
-
const args = parseArgs(
|
|
5675
|
+
const args = parseArgs(process6.argv.slice(2), {
|
|
5527
5676
|
boolean: [
|
|
5528
5677
|
"help",
|
|
5529
5678
|
"version",
|
|
@@ -5612,15 +5761,15 @@ async function loadConfig() {
|
|
|
5612
5761
|
const args = parseCLIArgs();
|
|
5613
5762
|
if (args.version) {
|
|
5614
5763
|
printVersion();
|
|
5615
|
-
|
|
5764
|
+
process6.exit(0);
|
|
5616
5765
|
}
|
|
5617
5766
|
if (args.help) {
|
|
5618
5767
|
printHelp();
|
|
5619
|
-
|
|
5768
|
+
process6.exit(0);
|
|
5620
5769
|
}
|
|
5621
5770
|
if (args.cwd) {
|
|
5622
|
-
const targetCwd = resolve4(
|
|
5623
|
-
|
|
5771
|
+
const targetCwd = resolve4(process6.cwd(), args.cwd);
|
|
5772
|
+
process6.chdir(targetCwd);
|
|
5624
5773
|
console.error(`Changed working directory to: ${targetCwd}`);
|
|
5625
5774
|
}
|
|
5626
5775
|
const mergeSkills = (config) => {
|
|
@@ -5632,7 +5781,7 @@ async function loadConfig() {
|
|
|
5632
5781
|
...args,
|
|
5633
5782
|
saveConfig: true
|
|
5634
5783
|
});
|
|
5635
|
-
|
|
5784
|
+
process6.exit(0);
|
|
5636
5785
|
}
|
|
5637
5786
|
if (args.wrap) {
|
|
5638
5787
|
return mergeSkills(await createWrapConfig({
|
|
@@ -5649,16 +5798,16 @@ async function loadConfig() {
|
|
|
5649
5798
|
throw error;
|
|
5650
5799
|
}
|
|
5651
5800
|
}
|
|
5652
|
-
if (
|
|
5801
|
+
if (process6.env.MCPC_CONFIG) {
|
|
5653
5802
|
try {
|
|
5654
|
-
const parsed = JSON.parse(
|
|
5803
|
+
const parsed = JSON.parse(process6.env.MCPC_CONFIG);
|
|
5655
5804
|
return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
|
|
5656
5805
|
} catch (error) {
|
|
5657
5806
|
console.error("Failed to parse MCPC_CONFIG environment variable:", error);
|
|
5658
5807
|
throw error;
|
|
5659
5808
|
}
|
|
5660
5809
|
}
|
|
5661
|
-
const configUrl = args.configUrl ||
|
|
5810
|
+
const configUrl = args.configUrl || process6.env.MCPC_CONFIG_URL;
|
|
5662
5811
|
if (configUrl) {
|
|
5663
5812
|
try {
|
|
5664
5813
|
const headers = {
|
|
@@ -5679,7 +5828,7 @@ async function loadConfig() {
|
|
|
5679
5828
|
throw error;
|
|
5680
5829
|
}
|
|
5681
5830
|
}
|
|
5682
|
-
const configFile = args.configFile ||
|
|
5831
|
+
const configFile = args.configFile || process6.env.MCPC_CONFIG_FILE;
|
|
5683
5832
|
if (configFile) {
|
|
5684
5833
|
try {
|
|
5685
5834
|
const config = await loadConfigFromFile(configFile);
|
|
@@ -5704,7 +5853,7 @@ async function loadConfig() {
|
|
|
5704
5853
|
throw error;
|
|
5705
5854
|
}
|
|
5706
5855
|
}
|
|
5707
|
-
const defaultJsonConfigPath = resolve4(
|
|
5856
|
+
const defaultJsonConfigPath = resolve4(process6.cwd(), "mcpc.config.json");
|
|
5708
5857
|
try {
|
|
5709
5858
|
const config = await loadConfigFromFile(defaultJsonConfigPath);
|
|
5710
5859
|
return mergeSkills(applyModeOverride(config, args.mode));
|
|
@@ -5719,7 +5868,7 @@ async function loadConfig() {
|
|
|
5719
5868
|
}
|
|
5720
5869
|
function replaceEnvVars2(str2) {
|
|
5721
5870
|
return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
|
|
5722
|
-
return
|
|
5871
|
+
return process6.env[varName] || "";
|
|
5723
5872
|
});
|
|
5724
5873
|
}
|
|
5725
5874
|
function isMarkdownFile2(path) {
|
|
@@ -5763,7 +5912,7 @@ function applyModeOverride(config, mode) {
|
|
|
5763
5912
|
agent.options.mode = mode;
|
|
5764
5913
|
if (mode === "ai_acp" && !agent.options.acpSettings) {
|
|
5765
5914
|
agent.options.acpSettings = {
|
|
5766
|
-
command: "claude-
|
|
5915
|
+
command: "claude-agent-acp",
|
|
5767
5916
|
args: [],
|
|
5768
5917
|
session: {}
|
|
5769
5918
|
};
|
|
@@ -8289,9 +8438,9 @@ var Client = class extends Protocol {
|
|
|
8289
8438
|
|
|
8290
8439
|
// __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
8291
8440
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
8292
|
-
import
|
|
8441
|
+
import process7 from "node:process";
|
|
8293
8442
|
import { PassThrough } from "node:stream";
|
|
8294
|
-
var DEFAULT_INHERITED_ENV_VARS =
|
|
8443
|
+
var DEFAULT_INHERITED_ENV_VARS = process7.platform === "win32" ? [
|
|
8295
8444
|
"APPDATA",
|
|
8296
8445
|
"HOMEDRIVE",
|
|
8297
8446
|
"HOMEPATH",
|
|
@@ -8311,7 +8460,7 @@ var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
|
|
|
8311
8460
|
function getDefaultEnvironment() {
|
|
8312
8461
|
const env = {};
|
|
8313
8462
|
for (const key of DEFAULT_INHERITED_ENV_VARS) {
|
|
8314
|
-
const value =
|
|
8463
|
+
const value = process7.env[key];
|
|
8315
8464
|
if (value === void 0) {
|
|
8316
8465
|
continue;
|
|
8317
8466
|
}
|
|
@@ -8347,7 +8496,7 @@ var StdioClientTransport = class {
|
|
|
8347
8496
|
},
|
|
8348
8497
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
8349
8498
|
shell: false,
|
|
8350
|
-
windowsHide:
|
|
8499
|
+
windowsHide: process7.platform === "win32" && isElectron(),
|
|
8351
8500
|
cwd: this._serverParams.cwd
|
|
8352
8501
|
});
|
|
8353
8502
|
this._process.on("error", (error) => {
|
|
@@ -8455,7 +8604,7 @@ var StdioClientTransport = class {
|
|
|
8455
8604
|
}
|
|
8456
8605
|
};
|
|
8457
8606
|
function isElectron() {
|
|
8458
|
-
return "type" in
|
|
8607
|
+
return "type" in process7;
|
|
8459
8608
|
}
|
|
8460
8609
|
|
|
8461
8610
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
@@ -10379,8 +10528,8 @@ var InMemoryTransport = class _InMemoryTransport {
|
|
|
10379
10528
|
};
|
|
10380
10529
|
|
|
10381
10530
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
10382
|
-
import
|
|
10383
|
-
var GEMINI_PREFERRED_FORMAT =
|
|
10531
|
+
import process8 from "node:process";
|
|
10532
|
+
var GEMINI_PREFERRED_FORMAT = process8.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
10384
10533
|
|
|
10385
10534
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
10386
10535
|
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
@@ -10453,7 +10602,7 @@ var cleanToolSchema = (schema) => {
|
|
|
10453
10602
|
|
|
10454
10603
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
10455
10604
|
import { cwd } from "node:process";
|
|
10456
|
-
import
|
|
10605
|
+
import process9 from "node:process";
|
|
10457
10606
|
import { createHash } from "node:crypto";
|
|
10458
10607
|
function createTransport(def) {
|
|
10459
10608
|
const defAny = def;
|
|
@@ -10494,7 +10643,7 @@ function createTransport(def) {
|
|
|
10494
10643
|
command: defAny.command,
|
|
10495
10644
|
args: defAny.args,
|
|
10496
10645
|
env: {
|
|
10497
|
-
...
|
|
10646
|
+
...process9.env,
|
|
10498
10647
|
...defAny.env ?? {}
|
|
10499
10648
|
},
|
|
10500
10649
|
cwd: cwd()
|
|
@@ -11144,7 +11293,7 @@ function endSpan(span, error) {
|
|
|
11144
11293
|
}
|
|
11145
11294
|
|
|
11146
11295
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
|
|
11147
|
-
import
|
|
11296
|
+
import process10 from "node:process";
|
|
11148
11297
|
var AgenticExecutor = class {
|
|
11149
11298
|
name;
|
|
11150
11299
|
allToolNames;
|
|
@@ -11164,13 +11313,13 @@ var AgenticExecutor = class {
|
|
|
11164
11313
|
this.logger = createLogger(`mcpc.agentic.${name}`, server);
|
|
11165
11314
|
this.toolSchemaMap = new Map(toolNameToDetailList);
|
|
11166
11315
|
try {
|
|
11167
|
-
this.tracingEnabled =
|
|
11316
|
+
this.tracingEnabled = process10.env.MCPC_TRACING_ENABLED === "true";
|
|
11168
11317
|
if (this.tracingEnabled) {
|
|
11169
11318
|
initializeTracing({
|
|
11170
11319
|
enabled: true,
|
|
11171
11320
|
serviceName: `mcpc-agentic-${name}`,
|
|
11172
|
-
exportTo:
|
|
11173
|
-
otlpEndpoint:
|
|
11321
|
+
exportTo: process10.env.MCPC_TRACING_EXPORT ?? "otlp",
|
|
11322
|
+
otlpEndpoint: process10.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
|
|
11174
11323
|
});
|
|
11175
11324
|
}
|
|
11176
11325
|
} catch {
|
|
@@ -13226,6 +13375,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
13226
13375
|
toolManager;
|
|
13227
13376
|
logger = createLogger("mcpc.compose");
|
|
13228
13377
|
fileLoaders = /* @__PURE__ */ new Map();
|
|
13378
|
+
pluginsDisposed = false;
|
|
13229
13379
|
// Legacy property for backward compatibility
|
|
13230
13380
|
get toolNameMapping() {
|
|
13231
13381
|
return this.toolManager.getToolNameMapping();
|
|
@@ -13701,11 +13851,21 @@ var ComposableMCPServer = class extends Server {
|
|
|
13701
13851
|
async disposePlugins() {
|
|
13702
13852
|
await this.pluginManager.dispose();
|
|
13703
13853
|
}
|
|
13854
|
+
/**
|
|
13855
|
+
* Dispose plugins only once to avoid duplicated cleanup in chained handlers.
|
|
13856
|
+
*/
|
|
13857
|
+
async disposePluginsOnce() {
|
|
13858
|
+
if (this.pluginsDisposed) {
|
|
13859
|
+
return;
|
|
13860
|
+
}
|
|
13861
|
+
this.pluginsDisposed = true;
|
|
13862
|
+
await this.disposePlugins();
|
|
13863
|
+
}
|
|
13704
13864
|
/**
|
|
13705
13865
|
* Close the server and ensure all plugins are disposed
|
|
13706
13866
|
*/
|
|
13707
13867
|
async close() {
|
|
13708
|
-
await this.
|
|
13868
|
+
await this.disposePluginsOnce();
|
|
13709
13869
|
await super.close();
|
|
13710
13870
|
}
|
|
13711
13871
|
async compose(name, description, depsConfig = {
|
|
@@ -13810,16 +13970,20 @@ var ComposableMCPServer = class extends Server {
|
|
|
13810
13970
|
server: this,
|
|
13811
13971
|
toolNames: Object.keys(allTools)
|
|
13812
13972
|
});
|
|
13973
|
+
const previousOnClose = this.onclose;
|
|
13813
13974
|
this.onclose = async () => {
|
|
13814
13975
|
await cleanupClients();
|
|
13815
|
-
await this.
|
|
13976
|
+
await this.disposePluginsOnce();
|
|
13816
13977
|
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
13978
|
+
previousOnClose?.();
|
|
13817
13979
|
};
|
|
13980
|
+
const previousOnError = this.onerror;
|
|
13818
13981
|
this.onerror = async (error) => {
|
|
13819
13982
|
await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
|
|
13820
13983
|
await cleanupClients();
|
|
13821
|
-
await this.
|
|
13984
|
+
await this.disposePluginsOnce();
|
|
13822
13985
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
13986
|
+
previousOnError?.(error);
|
|
13823
13987
|
};
|
|
13824
13988
|
const toolNameToDetailList = Object.entries(allTools);
|
|
13825
13989
|
const publicToolNames = this.getPublicToolNames();
|
|
@@ -13884,12 +14048,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
13884
14048
|
};
|
|
13885
14049
|
|
|
13886
14050
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
|
|
13887
|
-
import
|
|
13888
|
-
var isSCF = () => Boolean(
|
|
14051
|
+
import process11 from "node:process";
|
|
14052
|
+
var isSCF = () => Boolean(process11.env.SCF_RUNTIME || process11.env.PROD_SCF);
|
|
13889
14053
|
if (isSCF()) {
|
|
13890
14054
|
console.log({
|
|
13891
14055
|
isSCF: isSCF(),
|
|
13892
|
-
SCF_RUNTIME:
|
|
14056
|
+
SCF_RUNTIME: process11.env.SCF_RUNTIME
|
|
13893
14057
|
});
|
|
13894
14058
|
}
|
|
13895
14059
|
|