@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/index.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 spawn2(command, args, options) {
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 = spawn2;
525
- module.exports.spawn = spawn2;
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;
@@ -2580,15 +2580,17 @@ var Response2 = class _Response {
2580
2580
  this.#init = init;
2581
2581
  }
2582
2582
  if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
2583
- headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
2584
- this[cacheKey] = [init?.status || 200, body, headers];
2583
+ ;
2584
+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
2585
2585
  }
2586
2586
  }
2587
2587
  get headers() {
2588
2588
  const cache = this[cacheKey];
2589
2589
  if (cache) {
2590
2590
  if (!(cache[2] instanceof Headers)) {
2591
- cache[2] = new Headers(cache[2]);
2591
+ cache[2] = new Headers(
2592
+ cache[2] || { "content-type": "text/plain; charset=UTF-8" }
2593
+ );
2592
2594
  }
2593
2595
  return cache[2];
2594
2596
  }
@@ -2713,15 +2715,32 @@ var flushHeaders = (outgoing) => {
2713
2715
  };
2714
2716
  var responseViaCache = async (res, outgoing) => {
2715
2717
  let [status, body, header] = res[cacheKey];
2716
- if (header instanceof Headers) {
2718
+ let hasContentLength = false;
2719
+ if (!header) {
2720
+ header = { "content-type": "text/plain; charset=UTF-8" };
2721
+ } else if (header instanceof Headers) {
2722
+ hasContentLength = header.has("content-length");
2717
2723
  header = buildOutgoingHttpHeaders(header);
2724
+ } else if (Array.isArray(header)) {
2725
+ const headerObj = new Headers(header);
2726
+ hasContentLength = headerObj.has("content-length");
2727
+ header = buildOutgoingHttpHeaders(headerObj);
2728
+ } else {
2729
+ for (const key in header) {
2730
+ if (key.length === 14 && key.toLowerCase() === "content-length") {
2731
+ hasContentLength = true;
2732
+ break;
2733
+ }
2734
+ }
2718
2735
  }
2719
- if (typeof body === "string") {
2720
- header["Content-Length"] = Buffer.byteLength(body);
2721
- } else if (body instanceof Uint8Array) {
2722
- header["Content-Length"] = body.byteLength;
2723
- } else if (body instanceof Blob) {
2724
- header["Content-Length"] = body.size;
2736
+ if (!hasContentLength) {
2737
+ if (typeof body === "string") {
2738
+ header["Content-Length"] = Buffer.byteLength(body);
2739
+ } else if (body instanceof Uint8Array) {
2740
+ header["Content-Length"] = body.byteLength;
2741
+ } else if (body instanceof Blob) {
2742
+ header["Content-Length"] = body.size;
2743
+ }
2725
2744
  }
2726
2745
  outgoing.writeHead(status, header);
2727
2746
  if (typeof body === "string" || body instanceof Uint8Array) {
@@ -3874,7 +3893,7 @@ function parseArgs(args, options) {
3874
3893
  import { mkdir, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
3875
3894
  import { homedir } from "node:os";
3876
3895
  import { dirname, join as join3, resolve as resolve4 } from "node:path";
3877
- import process4 from "node:process";
3896
+ import process5 from "node:process";
3878
3897
 
3879
3898
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
3880
3899
  import { mkdtemp, writeFile } from "node:fs/promises";
@@ -4435,6 +4454,152 @@ Skill path: ${meta.basePath}
4435
4454
  };
4436
4455
  }
4437
4456
 
4457
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/bash.js
4458
+ import { spawn } from "node:child_process";
4459
+ import process2 from "node:process";
4460
+ var DEFAULT_MAX_BYTES = 1e5;
4461
+ var DEFAULT_MAX_LINES = 2e3;
4462
+ var DEFAULT_TIMEOUT_MS = 6e4;
4463
+ function truncateOutput(stdout, stderr, maxBytes = DEFAULT_MAX_BYTES, maxLines = DEFAULT_MAX_LINES) {
4464
+ const fullOutput = (stderr ? `STDERR:
4465
+ ${stderr}
4466
+
4467
+ STDOUT:
4468
+ ` : "") + stdout;
4469
+ const lines = fullOutput.split("\n");
4470
+ if (lines.length > maxLines) {
4471
+ const truncatedLines = lines.slice(-maxLines);
4472
+ return {
4473
+ output: `[OUTPUT TRUNCATED] Showing last ${maxLines} lines of ${lines.length} total
4474
+
4475
+ ` + truncatedLines.join("\n"),
4476
+ truncated: true
4477
+ };
4478
+ }
4479
+ if (fullOutput.length > maxBytes) {
4480
+ const truncatedBytes = fullOutput.slice(-maxBytes);
4481
+ return {
4482
+ output: `[OUTPUT TRUNCATED] Showing last ${maxBytes} bytes of ${fullOutput.length} total
4483
+
4484
+ ` + truncatedBytes,
4485
+ truncated: true
4486
+ };
4487
+ }
4488
+ return {
4489
+ output: fullOutput,
4490
+ truncated: false
4491
+ };
4492
+ }
4493
+ function executeBash(command, cwd2, timeoutMs) {
4494
+ return new Promise((resolve5) => {
4495
+ const stdout = [];
4496
+ const stderr = [];
4497
+ const proc = spawn("bash", [
4498
+ "-c",
4499
+ command
4500
+ ], {
4501
+ cwd: cwd2,
4502
+ stdio: [
4503
+ "ignore",
4504
+ "pipe",
4505
+ "pipe"
4506
+ ]
4507
+ });
4508
+ proc.stdout?.on("data", (data) => {
4509
+ stdout.push(data.toString());
4510
+ });
4511
+ proc.stderr?.on("data", (data) => {
4512
+ stderr.push(data.toString());
4513
+ });
4514
+ proc.on("close", (code) => {
4515
+ resolve5({
4516
+ stdout: stdout.join(""),
4517
+ stderr: stderr.join(""),
4518
+ exitCode: code
4519
+ });
4520
+ });
4521
+ proc.on("error", (err) => {
4522
+ resolve5({
4523
+ stdout: "",
4524
+ stderr: err.message,
4525
+ exitCode: null
4526
+ });
4527
+ });
4528
+ setTimeout(() => {
4529
+ proc.kill("SIGTERM");
4530
+ resolve5({
4531
+ stdout: stdout.join(""),
4532
+ stderr: stderr.join("") + "\n\n[TIMEOUT] Command execution timed out",
4533
+ exitCode: null
4534
+ });
4535
+ }, timeoutMs);
4536
+ });
4537
+ }
4538
+ function createBashPlugin(options = {}) {
4539
+ const { maxBytes, maxLines, timeoutMs } = {
4540
+ maxBytes: DEFAULT_MAX_BYTES,
4541
+ maxLines: DEFAULT_MAX_LINES,
4542
+ timeoutMs: DEFAULT_TIMEOUT_MS,
4543
+ ...options
4544
+ };
4545
+ let serverRef = null;
4546
+ return {
4547
+ name: "plugin-bash",
4548
+ version: "1.0.0",
4549
+ // Store server reference for tool registration
4550
+ configureServer: (server) => {
4551
+ serverRef = server;
4552
+ },
4553
+ // Register bash tool with agent name prefix
4554
+ composeStart: (context2) => {
4555
+ if (!serverRef) return;
4556
+ const agentName = context2.serverName;
4557
+ const toolName = `${agentName}__bash`;
4558
+ 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.", {
4559
+ type: "object",
4560
+ properties: {
4561
+ command: {
4562
+ type: "string",
4563
+ description: "The bash command to execute"
4564
+ },
4565
+ cwd: {
4566
+ type: "string",
4567
+ description: "Optional: Working directory for the command (defaults to current directory)"
4568
+ }
4569
+ },
4570
+ required: [
4571
+ "command"
4572
+ ]
4573
+ }, async (args) => {
4574
+ const cwd2 = args.cwd || process2.cwd();
4575
+ const result = await executeBash(args.command, cwd2, timeoutMs);
4576
+ const { output, truncated } = truncateOutput(result.stdout, result.stderr, maxBytes, maxLines);
4577
+ let finalOutput = output;
4578
+ if (result.exitCode !== null && result.exitCode !== 0) {
4579
+ finalOutput = `[EXIT CODE: ${result.exitCode}]
4580
+ ` + finalOutput;
4581
+ }
4582
+ if (truncated) {
4583
+ finalOutput += `
4584
+
4585
+ [Note: Output was truncated]`;
4586
+ }
4587
+ return {
4588
+ content: [
4589
+ {
4590
+ type: "text",
4591
+ text: finalOutput
4592
+ }
4593
+ ],
4594
+ isError: result.exitCode !== null && result.exitCode !== 0
4595
+ };
4596
+ }, {
4597
+ internal: true
4598
+ });
4599
+ }
4600
+ };
4601
+ }
4602
+
4438
4603
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
4439
4604
  import { createCodeExecutionPlugin } from "@mcpc-tech/plugin-code-execution";
4440
4605
 
@@ -6414,10 +6579,10 @@ function parse(content, options = {}) {
6414
6579
  }
6415
6580
 
6416
6581
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
6417
- import process2 from "node:process";
6582
+ import process3 from "node:process";
6418
6583
  function replaceEnvVars(str2) {
6419
6584
  return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
6420
- const value = process2.env[varName];
6585
+ const value = process3.env[varName];
6421
6586
  if (value !== void 0) {
6422
6587
  return value;
6423
6588
  }
@@ -6516,18 +6681,19 @@ var defaultPlugin = markdownLoaderPlugin();
6516
6681
 
6517
6682
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
6518
6683
  import { resolve as resolve3 } from "node:path";
6519
- import process3 from "node:process";
6684
+ import process4 from "node:process";
6520
6685
  var DEFAULT_SKILLS_PATHS = [
6521
6686
  ".agent/skills"
6522
6687
  ];
6523
6688
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
6524
6689
  function getGlobalPlugins(skillsPaths) {
6525
- const resolvedPaths = skillsPaths.map((p2) => resolve3(process3.cwd(), p2));
6690
+ const resolvedPaths = skillsPaths.map((p2) => resolve3(process4.cwd(), p2));
6526
6691
  return [
6527
6692
  markdownLoaderPlugin(),
6528
6693
  createSkillsPlugin({
6529
6694
  paths: resolvedPaths
6530
- })
6695
+ }),
6696
+ createBashPlugin()
6531
6697
  ];
6532
6698
  }
6533
6699
  function getAgentPlugins() {
@@ -6556,7 +6722,7 @@ function getDefaultAgents() {
6556
6722
  }
6557
6723
 
6558
6724
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6559
- var CLI_VERSION = "0.1.51";
6725
+ var CLI_VERSION = "0.1.53";
6560
6726
  function extractServerName(command, commandArgs) {
6561
6727
  for (const arg of commandArgs) {
6562
6728
  if (!arg.startsWith("-")) {
@@ -6616,7 +6782,7 @@ async function saveUserConfig(config, newAgentName) {
6616
6782
  async function createWrapConfig(args) {
6617
6783
  if (!args.mcpServers || args.mcpServers.length === 0) {
6618
6784
  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'");
6619
- process4.exit(1);
6785
+ process5.exit(1);
6620
6786
  }
6621
6787
  const mcpServers = {};
6622
6788
  const serverNames = [];
@@ -6739,7 +6905,7 @@ function parseMcpServer(cmdString, transportType) {
6739
6905
  };
6740
6906
  }
6741
6907
  function parseCLIArgs() {
6742
- const args = parseArgs(process4.argv.slice(2), {
6908
+ const args = parseArgs(process5.argv.slice(2), {
6743
6909
  boolean: [
6744
6910
  "help",
6745
6911
  "version",
@@ -6828,15 +6994,15 @@ async function loadConfig() {
6828
6994
  const args = parseCLIArgs();
6829
6995
  if (args.version) {
6830
6996
  printVersion();
6831
- process4.exit(0);
6997
+ process5.exit(0);
6832
6998
  }
6833
6999
  if (args.help) {
6834
7000
  printHelp();
6835
- process4.exit(0);
7001
+ process5.exit(0);
6836
7002
  }
6837
7003
  if (args.cwd) {
6838
- const targetCwd = resolve4(process4.cwd(), args.cwd);
6839
- process4.chdir(targetCwd);
7004
+ const targetCwd = resolve4(process5.cwd(), args.cwd);
7005
+ process5.chdir(targetCwd);
6840
7006
  console.error(`Changed working directory to: ${targetCwd}`);
6841
7007
  }
6842
7008
  const mergeSkills = (config) => {
@@ -6848,7 +7014,7 @@ async function loadConfig() {
6848
7014
  ...args,
6849
7015
  saveConfig: true
6850
7016
  });
6851
- process4.exit(0);
7017
+ process5.exit(0);
6852
7018
  }
6853
7019
  if (args.wrap) {
6854
7020
  return mergeSkills(await createWrapConfig({
@@ -6865,16 +7031,16 @@ async function loadConfig() {
6865
7031
  throw error;
6866
7032
  }
6867
7033
  }
6868
- if (process4.env.MCPC_CONFIG) {
7034
+ if (process5.env.MCPC_CONFIG) {
6869
7035
  try {
6870
- const parsed = JSON.parse(process4.env.MCPC_CONFIG);
7036
+ const parsed = JSON.parse(process5.env.MCPC_CONFIG);
6871
7037
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
6872
7038
  } catch (error) {
6873
7039
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
6874
7040
  throw error;
6875
7041
  }
6876
7042
  }
6877
- const configUrl = args.configUrl || process4.env.MCPC_CONFIG_URL;
7043
+ const configUrl = args.configUrl || process5.env.MCPC_CONFIG_URL;
6878
7044
  if (configUrl) {
6879
7045
  try {
6880
7046
  const headers = {
@@ -6895,7 +7061,7 @@ async function loadConfig() {
6895
7061
  throw error;
6896
7062
  }
6897
7063
  }
6898
- const configFile = args.configFile || process4.env.MCPC_CONFIG_FILE;
7064
+ const configFile = args.configFile || process5.env.MCPC_CONFIG_FILE;
6899
7065
  if (configFile) {
6900
7066
  try {
6901
7067
  const config = await loadConfigFromFile(configFile);
@@ -6920,7 +7086,7 @@ async function loadConfig() {
6920
7086
  throw error;
6921
7087
  }
6922
7088
  }
6923
- const defaultJsonConfigPath = resolve4(process4.cwd(), "mcpc.config.json");
7089
+ const defaultJsonConfigPath = resolve4(process5.cwd(), "mcpc.config.json");
6924
7090
  try {
6925
7091
  const config = await loadConfigFromFile(defaultJsonConfigPath);
6926
7092
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -6935,7 +7101,7 @@ async function loadConfig() {
6935
7101
  }
6936
7102
  function replaceEnvVars2(str2) {
6937
7103
  return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
6938
- return process4.env[varName] || "";
7104
+ return process5.env[varName] || "";
6939
7105
  });
6940
7106
  }
6941
7107
  function isMarkdownFile2(path) {
@@ -6979,7 +7145,7 @@ function applyModeOverride(config, mode) {
6979
7145
  agent.options.mode = mode;
6980
7146
  if (mode === "ai_acp" && !agent.options.acpSettings) {
6981
7147
  agent.options.acpSettings = {
6982
- command: "claude-code-acp",
7148
+ command: "claude-agent-acp",
6983
7149
  args: [],
6984
7150
  session: {}
6985
7151
  };
@@ -9577,7 +9743,7 @@ var Client = class extends Protocol {
9577
9743
 
9578
9744
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9579
9745
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
9580
- import process5 from "node:process";
9746
+ import process6 from "node:process";
9581
9747
  import { PassThrough } from "node:stream";
9582
9748
 
9583
9749
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
@@ -9609,7 +9775,7 @@ function serializeMessage(message) {
9609
9775
  }
9610
9776
 
9611
9777
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
9612
- var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
9778
+ var DEFAULT_INHERITED_ENV_VARS = process6.platform === "win32" ? [
9613
9779
  "APPDATA",
9614
9780
  "HOMEDRIVE",
9615
9781
  "HOMEPATH",
@@ -9629,7 +9795,7 @@ var DEFAULT_INHERITED_ENV_VARS = process5.platform === "win32" ? [
9629
9795
  function getDefaultEnvironment() {
9630
9796
  const env = {};
9631
9797
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
9632
- const value = process5.env[key];
9798
+ const value = process6.env[key];
9633
9799
  if (value === void 0) {
9634
9800
  continue;
9635
9801
  }
@@ -9665,7 +9831,7 @@ var StdioClientTransport = class {
9665
9831
  },
9666
9832
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9667
9833
  shell: false,
9668
- windowsHide: process5.platform === "win32" && isElectron(),
9834
+ windowsHide: process6.platform === "win32" && isElectron(),
9669
9835
  cwd: this._serverParams.cwd
9670
9836
  });
9671
9837
  this._process.on("error", (error) => {
@@ -9773,7 +9939,7 @@ var StdioClientTransport = class {
9773
9939
  }
9774
9940
  };
9775
9941
  function isElectron() {
9776
- return "type" in process5;
9942
+ return "type" in process6;
9777
9943
  }
9778
9944
 
9779
9945
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -11697,8 +11863,8 @@ var InMemoryTransport = class _InMemoryTransport {
11697
11863
  };
11698
11864
 
11699
11865
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
11700
- import process6 from "node:process";
11701
- var GEMINI_PREFERRED_FORMAT = process6.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11866
+ import process7 from "node:process";
11867
+ var GEMINI_PREFERRED_FORMAT = process7.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
11702
11868
 
11703
11869
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
11704
11870
  import { jsonrepair as jsonrepair2 } from "jsonrepair";
@@ -11771,7 +11937,7 @@ var cleanToolSchema = (schema) => {
11771
11937
 
11772
11938
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
11773
11939
  import { cwd } from "node:process";
11774
- import process7 from "node:process";
11940
+ import process8 from "node:process";
11775
11941
  import { createHash } from "node:crypto";
11776
11942
  function createTransport(def) {
11777
11943
  const defAny = def;
@@ -11812,7 +11978,7 @@ function createTransport(def) {
11812
11978
  command: defAny.command,
11813
11979
  args: defAny.args,
11814
11980
  env: {
11815
- ...process7.env,
11981
+ ...process8.env,
11816
11982
  ...defAny.env ?? {}
11817
11983
  },
11818
11984
  cwd: cwd()
@@ -12462,7 +12628,7 @@ function endSpan(span, error) {
12462
12628
  }
12463
12629
 
12464
12630
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
12465
- import process8 from "node:process";
12631
+ import process9 from "node:process";
12466
12632
  var AgenticExecutor = class {
12467
12633
  name;
12468
12634
  allToolNames;
@@ -12482,13 +12648,13 @@ var AgenticExecutor = class {
12482
12648
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
12483
12649
  this.toolSchemaMap = new Map(toolNameToDetailList);
12484
12650
  try {
12485
- this.tracingEnabled = process8.env.MCPC_TRACING_ENABLED === "true";
12651
+ this.tracingEnabled = process9.env.MCPC_TRACING_ENABLED === "true";
12486
12652
  if (this.tracingEnabled) {
12487
12653
  initializeTracing({
12488
12654
  enabled: true,
12489
12655
  serviceName: `mcpc-agentic-${name}`,
12490
- exportTo: process8.env.MCPC_TRACING_EXPORT ?? "otlp",
12491
- otlpEndpoint: process8.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12656
+ exportTo: process9.env.MCPC_TRACING_EXPORT ?? "otlp",
12657
+ otlpEndpoint: process9.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
12492
12658
  });
12493
12659
  }
12494
12660
  } catch {
@@ -14544,6 +14710,7 @@ var ComposableMCPServer = class extends Server {
14544
14710
  toolManager;
14545
14711
  logger = createLogger("mcpc.compose");
14546
14712
  fileLoaders = /* @__PURE__ */ new Map();
14713
+ pluginsDisposed = false;
14547
14714
  // Legacy property for backward compatibility
14548
14715
  get toolNameMapping() {
14549
14716
  return this.toolManager.getToolNameMapping();
@@ -15019,11 +15186,21 @@ var ComposableMCPServer = class extends Server {
15019
15186
  async disposePlugins() {
15020
15187
  await this.pluginManager.dispose();
15021
15188
  }
15189
+ /**
15190
+ * Dispose plugins only once to avoid duplicated cleanup in chained handlers.
15191
+ */
15192
+ async disposePluginsOnce() {
15193
+ if (this.pluginsDisposed) {
15194
+ return;
15195
+ }
15196
+ this.pluginsDisposed = true;
15197
+ await this.disposePlugins();
15198
+ }
15022
15199
  /**
15023
15200
  * Close the server and ensure all plugins are disposed
15024
15201
  */
15025
15202
  async close() {
15026
- await this.disposePlugins();
15203
+ await this.disposePluginsOnce();
15027
15204
  await super.close();
15028
15205
  }
15029
15206
  async compose(name, description, depsConfig = {
@@ -15128,16 +15305,20 @@ var ComposableMCPServer = class extends Server {
15128
15305
  server: this,
15129
15306
  toolNames: Object.keys(allTools)
15130
15307
  });
15308
+ const previousOnClose = this.onclose;
15131
15309
  this.onclose = async () => {
15132
15310
  await cleanupClients();
15133
- await this.disposePlugins();
15311
+ await this.disposePluginsOnce();
15134
15312
  await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
15313
+ previousOnClose?.();
15135
15314
  };
15315
+ const previousOnError = this.onerror;
15136
15316
  this.onerror = async (error) => {
15137
15317
  await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
15138
15318
  await cleanupClients();
15139
- await this.disposePlugins();
15319
+ await this.disposePluginsOnce();
15140
15320
  await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
15321
+ previousOnError?.(error);
15141
15322
  };
15142
15323
  const toolNameToDetailList = Object.entries(allTools);
15143
15324
  const publicToolNames = this.getPublicToolNames();
@@ -15202,12 +15383,12 @@ var ComposableMCPServer = class extends Server {
15202
15383
  };
15203
15384
 
15204
15385
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
15205
- import process9 from "node:process";
15206
- var isSCF = () => Boolean(process9.env.SCF_RUNTIME || process9.env.PROD_SCF);
15386
+ import process10 from "node:process";
15387
+ var isSCF = () => Boolean(process10.env.SCF_RUNTIME || process10.env.PROD_SCF);
15207
15388
  if (isSCF()) {
15208
15389
  console.log({
15209
15390
  isSCF: isSCF(),
15210
- SCF_RUNTIME: process9.env.SCF_RUNTIME
15391
+ SCF_RUNTIME: process10.env.SCF_RUNTIME
15211
15392
  });
15212
15393
  }
15213
15394
 
@@ -15290,8 +15471,8 @@ var createApp = (config) => {
15290
15471
 
15291
15472
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/server.js
15292
15473
  import { OpenAPIHono as OpenAPIHono2 } from "@hono/zod-openapi";
15293
- import process10 from "node:process";
15294
- var port = Number(process10.env.PORT || "3002");
15474
+ import process11 from "node:process";
15475
+ var port = Number(process11.env.PORT || "3002");
15295
15476
  var hostname = "0.0.0.0";
15296
15477
  async function main() {
15297
15478
  const config = await loadConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.51",
3
+ "version": "0.1.53",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "dependencies": {
6
6
  "@hono/zod-openapi": "^0.19.2",
@@ -8,7 +8,7 @@
8
8
  "@modelcontextprotocol/sdk": "^1.8.0",
9
9
  "zod": "^3.24.2",
10
10
  "@ai-sdk/provider": "^2.0.0",
11
- "@mcpc-tech/acp-ai-provider": "^0.1.20",
11
+ "@mcpc-tech/acp-ai-provider": "^0.1.52",
12
12
  "@mcpc-tech/ripgrep-napi": "^0.0.4",
13
13
  "@opentelemetry/api": "^1.9.0",
14
14
  "@opentelemetry/exporter-trace-otlp-http": "^0.56.0",