@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/bin/mcpc.cjs CHANGED
@@ -502,7 +502,7 @@ var require_cross_spawn = __commonJS({
502
502
  var cp = require("child_process");
503
503
  var parse2 = require_parse();
504
504
  var enoent = require_enoent();
505
- function spawn2(command, args, options) {
505
+ function spawn3(command, args, options) {
506
506
  const parsed = parse2(command, args, options);
507
507
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
508
508
  enoent.hookChildProcess(spawned, parsed);
@@ -514,8 +514,8 @@ var require_cross_spawn = __commonJS({
514
514
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
515
515
  return result;
516
516
  }
517
- module2.exports = spawn2;
518
- module2.exports.spawn = spawn2;
517
+ module2.exports = spawn3;
518
+ module2.exports.spawn = spawn3;
519
519
  module2.exports.sync = spawnSync;
520
520
  module2.exports._parse = parse2;
521
521
  module2.exports._enoent = enoent;
@@ -2334,15 +2334,17 @@ var Response2 = class _Response {
2334
2334
  this.#init = init;
2335
2335
  }
2336
2336
  if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
2337
- headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
2338
- this[cacheKey] = [init?.status || 200, body, headers];
2337
+ ;
2338
+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
2339
2339
  }
2340
2340
  }
2341
2341
  get headers() {
2342
2342
  const cache = this[cacheKey];
2343
2343
  if (cache) {
2344
2344
  if (!(cache[2] instanceof Headers)) {
2345
- cache[2] = new Headers(cache[2]);
2345
+ cache[2] = new Headers(
2346
+ cache[2] || { "content-type": "text/plain; charset=UTF-8" }
2347
+ );
2346
2348
  }
2347
2349
  return cache[2];
2348
2350
  }
@@ -2650,7 +2652,7 @@ function parseArgs(args, options) {
2650
2652
  var import_promises4 = require("node:fs/promises");
2651
2653
  var import_node_os3 = require("node:os");
2652
2654
  var import_node_path6 = require("node:path");
2653
- var import_node_process4 = __toESM(require("node:process"), 1);
2655
+ var import_node_process5 = __toESM(require("node:process"), 1);
2654
2656
 
2655
2657
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
2656
2658
  var import_promises = require("node:fs/promises");
@@ -3211,6 +3213,152 @@ Skill path: ${meta.basePath}
3211
3213
  };
3212
3214
  }
3213
3215
 
3216
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
3217
+ var import_node_child_process = require("node:child_process");
3218
+ var import_node_process2 = __toESM(require("node:process"), 1);
3219
+ var DEFAULT_MAX_BYTES = 1e5;
3220
+ var DEFAULT_MAX_LINES = 2e3;
3221
+ var DEFAULT_TIMEOUT_MS = 6e4;
3222
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
3223
+ const fullOutput = (stderr ? `STDERR:
3224
+ ${stderr}
3225
+
3226
+ STDOUT:
3227
+ ` : "") + stdout;
3228
+ const lines = fullOutput.split("\n");
3229
+ if (lines.length > maxLines) {
3230
+ const truncatedLines = lines.slice(-maxLines);
3231
+ return {
3232
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
3233
+
3234
+ ` + truncatedLines.join("\n"),
3235
+ truncated: true
3236
+ };
3237
+ }
3238
+ if (fullOutput.length > maxBytes) {
3239
+ const truncatedBytes = fullOutput.slice(-maxBytes);
3240
+ return {
3241
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
3242
+
3243
+ ` + truncatedBytes,
3244
+ truncated: true
3245
+ };
3246
+ }
3247
+ return {
3248
+ output: fullOutput,
3249
+ truncated: false
3250
+ };
3251
+ }
3252
+ function executeBash(command, cwd2, timeoutMs) {
3253
+ return new Promise((resolve5) => {
3254
+ const stdout = [];
3255
+ const stderr = [];
3256
+ const proc = (0, import_node_child_process.spawn)("bash", [
3257
+ "-c",
3258
+ command
3259
+ ], {
3260
+ cwd: cwd2,
3261
+ stdio: [
3262
+ "ignore",
3263
+ "pipe",
3264
+ "pipe"
3265
+ ]
3266
+ });
3267
+ proc.stdout?.on("data", (data) => {
3268
+ stdout.push(data.toString());
3269
+ });
3270
+ proc.stderr?.on("data", (data) => {
3271
+ stderr.push(data.toString());
3272
+ });
3273
+ proc.on("close", (code) => {
3274
+ resolve5({
3275
+ stdout: stdout.join(""),
3276
+ stderr: stderr.join(""),
3277
+ exitCode: code
3278
+ });
3279
+ });
3280
+ proc.on("error", (err) => {
3281
+ resolve5({
3282
+ stdout: "",
3283
+ stderr: err.message,
3284
+ exitCode: null
3285
+ });
3286
+ });
3287
+ setTimeout(() => {
3288
+ proc.kill("SIGTERM");
3289
+ resolve5({
3290
+ stdout: stdout.join(""),
3291
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
3292
+ exitCode: null
3293
+ });
3294
+ }, timeoutMs);
3295
+ });
3296
+ }
3297
+ function createBashPlugin(options = {}) {
3298
+ const { maxBytes, maxLines, timeoutMs } = {
3299
+ maxBytes: DEFAULT_MAX_BYTES,
3300
+ maxLines: DEFAULT_MAX_LINES,
3301
+ timeoutMs: DEFAULT_TIMEOUT_MS,
3302
+ ...options
3303
+ };
3304
+ let serverRef = null;
3305
+ return {
3306
+ name: "plugin-bash",
3307
+ version: "1.0.0",
3308
+ // Store server reference for tool registration
3309
+ configureServer: (server) => {
3310
+ serverRef = server;
3311
+ },
3312
+ // Register bash tool with agent name prefix
3313
+ composeStart: (context2) => {
3314
+ if (!serverRef) return;
3315
+ const agentName = context2.serverName;
3316
+ const toolName = `${agentName}__bash`;
3317
+ 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.", {
3318
+ type: "object",
3319
+ properties: {
3320
+ command: {
3321
+ type: "string",
3322
+ description: "The bash command to execute"
3323
+ },
3324
+ cwd: {
3325
+ type: "string",
3326
+ description: "Optional: Working directory for the command (defaults to current directory)"
3327
+ }
3328
+ },
3329
+ required: [
3330
+ "command"
3331
+ ]
3332
+ }, async (args) => {
3333
+ const cwd2 = args.cwd || import_node_process2.default.cwd();
3334
+ const result = await executeBash(args.command, cwd2, timeoutMs);
3335
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
3336
+ let finalOutput = output;
3337
+ if (result.exitCode !== null && result.exitCode !== 0) {
3338
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
3339
+ ` + finalOutput;
3340
+ }
3341
+ if (truncated) {
3342
+ finalOutput += `
3343
+
3344
+ [Note: Output was truncated]`;
3345
+ }
3346
+ return {
3347
+ content: [
3348
+ {
3349
+ type: "text",
3350
+ text: finalOutput
3351
+ }
3352
+ ],
3353
+ isError: result.exitCode !== null && result.exitCode !== 0
3354
+ };
3355
+ }, {
3356
+ internal: true
3357
+ });
3358
+ }
3359
+ };
3360
+ }
3361
+
3214
3362
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
3215
3363
  var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
3216
3364
 
@@ -5190,10 +5338,10 @@ function parse(content, options = {}) {
5190
5338
  }
5191
5339
 
5192
5340
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
5193
- var import_node_process2 = __toESM(require("node:process"), 1);
5341
+ var import_node_process3 = __toESM(require("node:process"), 1);
5194
5342
  function replaceEnvVars(str2) {
5195
5343
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
5196
- const value = import_node_process2.default.env[varName];
5344
+ const value = import_node_process3.default.env[varName];
5197
5345
  if (value !== void 0) {
5198
5346
  return value;
5199
5347
  }
@@ -5292,18 +5440,19 @@ var defaultPlugin = markdownLoaderPlugin();
5292
5440
 
5293
5441
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
5294
5442
  var import_node_path5 = require("node:path");
5295
- var import_node_process3 = __toESM(require("node:process"), 1);
5443
+ var import_node_process4 = __toESM(require("node:process"), 1);
5296
5444
  var DEFAULT_SKILLS_PATHS = [
5297
5445
  ".agent/skills"
5298
5446
  ];
5299
5447
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
5300
5448
  function getGlobalPlugins(skillsPaths) {
5301
- const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
5449
+ const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process4.default.cwd(), p2));
5302
5450
  return [
5303
5451
  markdownLoaderPlugin(),
5304
5452
  createSkillsPlugin({
5305
5453
  paths: resolvedPaths
5306
- })
5454
+ }),
5455
+ createBashPlugin()
5307
5456
  ];
5308
5457
  }
5309
5458
  function getAgentPlugins() {
@@ -5332,7 +5481,7 @@ function getDefaultAgents() {
5332
5481
  }
5333
5482
 
5334
5483
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
5335
- var CLI_VERSION = "0.1.51";
5484
+ var CLI_VERSION = "0.1.53";
5336
5485
  function extractServerName(command, commandArgs) {
5337
5486
  for (const arg of commandArgs) {
5338
5487
  if (!arg.startsWith("-")) {
@@ -5392,7 +5541,7 @@ async function saveUserConfig(config, newAgentName) {
5392
5541
  async function createWrapConfig(args) {
5393
5542
  if (!args.mcpServers || args.mcpServers.length === 0) {
5394
5543
  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'");
5395
- import_node_process4.default.exit(1);
5544
+ import_node_process5.default.exit(1);
5396
5545
  }
5397
5546
  const mcpServers = {};
5398
5547
  const serverNames = [];
@@ -5515,7 +5664,7 @@ function parseMcpServer(cmdString, transportType) {
5515
5664
  };
5516
5665
  }
5517
5666
  function parseCLIArgs() {
5518
- const args = parseArgs(import_node_process4.default.argv.slice(2), {
5667
+ const args = parseArgs(import_node_process5.default.argv.slice(2), {
5519
5668
  boolean: [
5520
5669
  "help",
5521
5670
  "version",
@@ -5604,15 +5753,15 @@ async function loadConfig() {
5604
5753
  const args = parseCLIArgs();
5605
5754
  if (args.version) {
5606
5755
  printVersion();
5607
- import_node_process4.default.exit(0);
5756
+ import_node_process5.default.exit(0);
5608
5757
  }
5609
5758
  if (args.help) {
5610
5759
  printHelp();
5611
- import_node_process4.default.exit(0);
5760
+ import_node_process5.default.exit(0);
5612
5761
  }
5613
5762
  if (args.cwd) {
5614
- const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
5615
- import_node_process4.default.chdir(targetCwd);
5763
+ const targetCwd = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), args.cwd);
5764
+ import_node_process5.default.chdir(targetCwd);
5616
5765
  console.error(`Changed working directory to: ${targetCwd}`);
5617
5766
  }
5618
5767
  const mergeSkills = (config) => {
@@ -5624,7 +5773,7 @@ async function loadConfig() {
5624
5773
  ...args,
5625
5774
  saveConfig: true
5626
5775
  });
5627
- import_node_process4.default.exit(0);
5776
+ import_node_process5.default.exit(0);
5628
5777
  }
5629
5778
  if (args.wrap) {
5630
5779
  return mergeSkills(await createWrapConfig({
@@ -5641,16 +5790,16 @@ async function loadConfig() {
5641
5790
  throw error;
5642
5791
  }
5643
5792
  }
5644
- if (import_node_process4.default.env.MCPC_CONFIG) {
5793
+ if (import_node_process5.default.env.MCPC_CONFIG) {
5645
5794
  try {
5646
- const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
5795
+ const parsed = JSON.parse(import_node_process5.default.env.MCPC_CONFIG);
5647
5796
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
5648
5797
  } catch (error) {
5649
5798
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
5650
5799
  throw error;
5651
5800
  }
5652
5801
  }
5653
- const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
5802
+ const configUrl = args.configUrl || import_node_process5.default.env.MCPC_CONFIG_URL;
5654
5803
  if (configUrl) {
5655
5804
  try {
5656
5805
  const headers = {
@@ -5671,7 +5820,7 @@ async function loadConfig() {
5671
5820
  throw error;
5672
5821
  }
5673
5822
  }
5674
- const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
5823
+ const configFile = args.configFile || import_node_process5.default.env.MCPC_CONFIG_FILE;
5675
5824
  if (configFile) {
5676
5825
  try {
5677
5826
  const config = await loadConfigFromFile(configFile);
@@ -5696,7 +5845,7 @@ async function loadConfig() {
5696
5845
  throw error;
5697
5846
  }
5698
5847
  }
5699
- const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
5848
+ const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process5.default.cwd(), "mcpc.config.json");
5700
5849
  try {
5701
5850
  const config = await loadConfigFromFile(defaultJsonConfigPath);
5702
5851
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -5711,7 +5860,7 @@ async function loadConfig() {
5711
5860
  }
5712
5861
  function replaceEnvVars2(str2) {
5713
5862
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
5714
- return import_node_process4.default.env[varName] || "";
5863
+ return import_node_process5.default.env[varName] || "";
5715
5864
  });
5716
5865
  }
5717
5866
  function isMarkdownFile2(path) {
@@ -5755,7 +5904,7 @@ function applyModeOverride(config, mode) {
5755
5904
  agent.options.mode = mode;
5756
5905
  if (mode === "ai_acp" && !agent.options.acpSettings) {
5757
5906
  agent.options.acpSettings = {
5758
- command: "claude-code-acp",
5907
+ command: "claude-agent-acp",
5759
5908
  args: [],
5760
5909
  session: {}
5761
5910
  };
@@ -8281,9 +8430,9 @@ var Client = class extends Protocol {
8281
8430
 
8282
8431
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
8283
8432
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
8284
- var import_node_process5 = __toESM(require("node:process"), 1);
8433
+ var import_node_process6 = __toESM(require("node:process"), 1);
8285
8434
  var import_node_stream = require("node:stream");
8286
- var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
8435
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process6.default.platform === "win32" ? [
8287
8436
  "APPDATA",
8288
8437
  "HOMEDRIVE",
8289
8438
  "HOMEPATH",
@@ -8303,7 +8452,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win3
8303
8452
  function getDefaultEnvironment() {
8304
8453
  const env = {};
8305
8454
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
8306
- const value = import_node_process5.default.env[key];
8455
+ const value = import_node_process6.default.env[key];
8307
8456
  if (value === void 0) {
8308
8457
  continue;
8309
8458
  }
@@ -8339,7 +8488,7 @@ var StdioClientTransport = class {
8339
8488
  },
8340
8489
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
8341
8490
  shell: false,
8342
- windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
8491
+ windowsHide: import_node_process6.default.platform === "win32" && isElectron(),
8343
8492
  cwd: this._serverParams.cwd
8344
8493
  });
8345
8494
  this._process.on("error", (error) => {
@@ -8447,7 +8596,7 @@ var StdioClientTransport = class {
8447
8596
  }
8448
8597
  };
8449
8598
  function isElectron() {
8450
- return "type" in import_node_process5.default;
8599
+ return "type" in import_node_process6.default;
8451
8600
  }
8452
8601
 
8453
8602
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -10371,8 +10520,8 @@ var InMemoryTransport = class _InMemoryTransport {
10371
10520
  };
10372
10521
 
10373
10522
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
10374
- var import_node_process6 = __toESM(require("node:process"), 1);
10375
- var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10523
+ var import_node_process7 = __toESM(require("node:process"), 1);
10524
+ var GEMINI_PREFERRED_FORMAT = import_node_process7.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10376
10525
 
10377
10526
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
10378
10527
  var import_jsonrepair2 = require("jsonrepair");
@@ -10444,8 +10593,8 @@ var cleanToolSchema = (schema) => {
10444
10593
  };
10445
10594
 
10446
10595
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
10447
- var import_node_process7 = require("node:process");
10448
- var import_node_process8 = __toESM(require("node:process"), 1);
10596
+ var import_node_process8 = require("node:process");
10597
+ var import_node_process9 = __toESM(require("node:process"), 1);
10449
10598
  var import_node_crypto = require("node:crypto");
10450
10599
  function createTransport(def) {
10451
10600
  const defAny = def;
@@ -10486,10 +10635,10 @@ function createTransport(def) {
10486
10635
  command: defAny.command,
10487
10636
  args: defAny.args,
10488
10637
  env: {
10489
- ...import_node_process8.default.env,
10638
+ ...import_node_process9.default.env,
10490
10639
  ...defAny.env ?? {}
10491
10640
  },
10492
- cwd: (0, import_node_process7.cwd)()
10641
+ cwd: (0, import_node_process8.cwd)()
10493
10642
  });
10494
10643
  }
10495
10644
  throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
@@ -11136,7 +11285,7 @@ function endSpan(span, error) {
11136
11285
  }
11137
11286
 
11138
11287
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
11139
- var import_node_process9 = __toESM(require("node:process"), 1);
11288
+ var import_node_process10 = __toESM(require("node:process"), 1);
11140
11289
  var AgenticExecutor = class {
11141
11290
  name;
11142
11291
  allToolNames;
@@ -11156,13 +11305,13 @@ var AgenticExecutor = class {
11156
11305
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
11157
11306
  this.toolSchemaMap = new Map(toolNameToDetailList);
11158
11307
  try {
11159
- this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
11308
+ this.tracingEnabled = import_node_process10.default.env.MCPC_TRACING_ENABLED === "true";
11160
11309
  if (this.tracingEnabled) {
11161
11310
  initializeTracing({
11162
11311
  enabled: true,
11163
11312
  serviceName: `mcpc-agentic-${name}`,
11164
- exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
11165
- otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11313
+ exportTo: import_node_process10.default.env.MCPC_TRACING_EXPORT ?? "otlp",
11314
+ otlpEndpoint: import_node_process10.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
11166
11315
  });
11167
11316
  }
11168
11317
  } catch {
@@ -13219,6 +13368,7 @@ var ComposableMCPServer = class extends Server {
13219
13368
  toolManager;
13220
13369
  logger = createLogger("mcpc.compose");
13221
13370
  fileLoaders = /* @__PURE__ */ new Map();
13371
+ pluginsDisposed = false;
13222
13372
  // Legacy property for backward compatibility
13223
13373
  get toolNameMapping() {
13224
13374
  return this.toolManager.getToolNameMapping();
@@ -13694,11 +13844,21 @@ var ComposableMCPServer = class extends Server {
13694
13844
  async disposePlugins() {
13695
13845
  await this.pluginManager.dispose();
13696
13846
  }
13847
+ /**
13848
+ * Dispose plugins only once to avoid duplicated cleanup in chained handlers.
13849
+ */
13850
+ async disposePluginsOnce() {
13851
+ if (this.pluginsDisposed) {
13852
+ return;
13853
+ }
13854
+ this.pluginsDisposed = true;
13855
+ await this.disposePlugins();
13856
+ }
13697
13857
  /**
13698
13858
  * Close the server and ensure all plugins are disposed
13699
13859
  */
13700
13860
  async close() {
13701
- await this.disposePlugins();
13861
+ await this.disposePluginsOnce();
13702
13862
  await super.close();
13703
13863
  }
13704
13864
  async compose(name, description, depsConfig = {
@@ -13803,16 +13963,20 @@ var ComposableMCPServer = class extends Server {
13803
13963
  server: this,
13804
13964
  toolNames: Object.keys(allTools)
13805
13965
  });
13966
+ const previousOnClose = this.onclose;
13806
13967
  this.onclose = async () => {
13807
13968
  await cleanupClients();
13808
- await this.disposePlugins();
13969
+ await this.disposePluginsOnce();
13809
13970
  await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
13971
+ previousOnClose?.();
13810
13972
  };
13973
+ const previousOnError = this.onerror;
13811
13974
  this.onerror = async (error) => {
13812
13975
  await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
13813
13976
  await cleanupClients();
13814
- await this.disposePlugins();
13977
+ await this.disposePluginsOnce();
13815
13978
  await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
13979
+ previousOnError?.(error);
13816
13980
  };
13817
13981
  const toolNameToDetailList = Object.entries(allTools);
13818
13982
  const publicToolNames = this.getPublicToolNames();
@@ -13877,12 +14041,12 @@ var ComposableMCPServer = class extends Server {
13877
14041
  };
13878
14042
 
13879
14043
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
13880
- var import_node_process10 = __toESM(require("node:process"), 1);
13881
- var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
14044
+ var import_node_process11 = __toESM(require("node:process"), 1);
14045
+ var isSCF = () => Boolean(import_node_process11.default.env.SCF_RUNTIME || import_node_process11.default.env.PROD_SCF);
13882
14046
  if (isSCF()) {
13883
14047
  console.log({
13884
14048
  isSCF: isSCF(),
13885
- SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
14049
+ SCF_RUNTIME: import_node_process11.default.env.SCF_RUNTIME
13886
14050
  });
13887
14051
  }
13888
14052