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