@mcpc-tech/cli 0.1.52 → 0.1.54

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
@@ -548,10 +548,9 @@ var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
548
548
  var CursorSchema = z.string();
549
549
  var TaskCreationParamsSchema = z.looseObject({
550
550
  /**
551
- * Time in milliseconds to keep task results available after completion.
552
- * If null, the task has unlimited lifetime until manually cleaned up.
551
+ * Requested duration in milliseconds to retain task from creation.
553
552
  */
554
- ttl: z.union([z.number(), z.null()]).optional(),
553
+ ttl: z.number().optional(),
555
554
  /**
556
555
  * Time in milliseconds to wait between task status requests.
557
556
  */
@@ -851,7 +850,11 @@ var ClientCapabilitiesSchema = z.object({
851
850
  /**
852
851
  * Present if the client supports task creation.
853
852
  */
854
- tasks: ClientTasksCapabilitySchema.optional()
853
+ tasks: ClientTasksCapabilitySchema.optional(),
854
+ /**
855
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
856
+ */
857
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
855
858
  });
856
859
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
857
860
  /**
@@ -913,7 +916,11 @@ var ServerCapabilitiesSchema = z.object({
913
916
  /**
914
917
  * Present if the server supports task creation.
915
918
  */
916
- tasks: ServerTasksCapabilitySchema.optional()
919
+ tasks: ServerTasksCapabilitySchema.optional(),
920
+ /**
921
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
922
+ */
923
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
917
924
  });
918
925
  var InitializeResultSchema = ResultSchema.extend({
919
926
  /**
@@ -1106,6 +1113,12 @@ var ResourceSchema = z.object({
1106
1113
  * The MIME type of this resource, if known.
1107
1114
  */
1108
1115
  mimeType: z.optional(z.string()),
1116
+ /**
1117
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
1118
+ *
1119
+ * This can be used by Hosts to display file sizes and estimate context window usage.
1120
+ */
1121
+ size: z.optional(z.number()),
1109
1122
  /**
1110
1123
  * Optional annotations for the client.
1111
1124
  */
@@ -2366,7 +2379,7 @@ var coreHandler = (app) => {
2366
2379
  };
2367
2380
 
2368
2381
  // __mcpc__cli_latest/node_modules/@hono/node-server/dist/index.mjs
2369
- import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
2382
+ import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2";
2370
2383
  import { Http2ServerRequest } from "http2";
2371
2384
  import { Readable } from "stream";
2372
2385
  import crypto2 from "crypto";
@@ -2580,15 +2593,17 @@ var Response2 = class _Response {
2580
2593
  this.#init = init;
2581
2594
  }
2582
2595
  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];
2596
+ ;
2597
+ this[cacheKey] = [init?.status || 200, body, headers || init?.headers];
2585
2598
  }
2586
2599
  }
2587
2600
  get headers() {
2588
2601
  const cache = this[cacheKey];
2589
2602
  if (cache) {
2590
2603
  if (!(cache[2] instanceof Headers)) {
2591
- cache[2] = new Headers(cache[2]);
2604
+ cache[2] = new Headers(
2605
+ cache[2] || { "content-type": "text/plain; charset=UTF-8" }
2606
+ );
2592
2607
  }
2593
2608
  return cache[2];
2594
2609
  }
@@ -2687,6 +2702,50 @@ if (typeof global.crypto === "undefined") {
2687
2702
  global.crypto = crypto2;
2688
2703
  }
2689
2704
  var outgoingEnded = Symbol("outgoingEnded");
2705
+ var incomingDraining = Symbol("incomingDraining");
2706
+ var DRAIN_TIMEOUT_MS = 500;
2707
+ var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
2708
+ var drainIncoming = (incoming) => {
2709
+ const incomingWithDrainState = incoming;
2710
+ if (incoming.destroyed || incomingWithDrainState[incomingDraining]) {
2711
+ return;
2712
+ }
2713
+ incomingWithDrainState[incomingDraining] = true;
2714
+ if (incoming instanceof Http2ServerRequest2) {
2715
+ try {
2716
+ ;
2717
+ incoming.stream?.close?.(h2constants.NGHTTP2_NO_ERROR);
2718
+ } catch {
2719
+ }
2720
+ return;
2721
+ }
2722
+ let bytesRead = 0;
2723
+ const cleanup = () => {
2724
+ clearTimeout(timer);
2725
+ incoming.off("data", onData);
2726
+ incoming.off("end", cleanup);
2727
+ incoming.off("error", cleanup);
2728
+ };
2729
+ const forceClose = () => {
2730
+ cleanup();
2731
+ const socket = incoming.socket;
2732
+ if (socket && !socket.destroyed) {
2733
+ socket.destroySoon();
2734
+ }
2735
+ };
2736
+ const timer = setTimeout(forceClose, DRAIN_TIMEOUT_MS);
2737
+ timer.unref?.();
2738
+ const onData = (chunk) => {
2739
+ bytesRead += chunk.length;
2740
+ if (bytesRead > MAX_DRAIN_BYTES) {
2741
+ forceClose();
2742
+ }
2743
+ };
2744
+ incoming.on("data", onData);
2745
+ incoming.on("end", cleanup);
2746
+ incoming.on("error", cleanup);
2747
+ incoming.resume();
2748
+ };
2690
2749
  var handleRequestError = () => new Response(null, {
2691
2750
  status: 400
2692
2751
  });
@@ -2713,15 +2772,32 @@ var flushHeaders = (outgoing) => {
2713
2772
  };
2714
2773
  var responseViaCache = async (res, outgoing) => {
2715
2774
  let [status, body, header] = res[cacheKey];
2716
- if (header instanceof Headers) {
2775
+ let hasContentLength = false;
2776
+ if (!header) {
2777
+ header = { "content-type": "text/plain; charset=UTF-8" };
2778
+ } else if (header instanceof Headers) {
2779
+ hasContentLength = header.has("content-length");
2717
2780
  header = buildOutgoingHttpHeaders(header);
2781
+ } else if (Array.isArray(header)) {
2782
+ const headerObj = new Headers(header);
2783
+ hasContentLength = headerObj.has("content-length");
2784
+ header = buildOutgoingHttpHeaders(headerObj);
2785
+ } else {
2786
+ for (const key in header) {
2787
+ if (key.length === 14 && key.toLowerCase() === "content-length") {
2788
+ hasContentLength = true;
2789
+ break;
2790
+ }
2791
+ }
2718
2792
  }
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;
2793
+ if (!hasContentLength) {
2794
+ if (typeof body === "string") {
2795
+ header["Content-Length"] = Buffer.byteLength(body);
2796
+ } else if (body instanceof Uint8Array) {
2797
+ header["Content-Length"] = body.byteLength;
2798
+ } else if (body instanceof Blob) {
2799
+ header["Content-Length"] = body.size;
2800
+ }
2725
2801
  }
2726
2802
  outgoing.writeHead(status, header);
2727
2803
  if (typeof body === "string" || body instanceof Uint8Array) {
@@ -2841,14 +2917,18 @@ var getRequestListener = (fetchCallback, options = {}) => {
2841
2917
  setTimeout(() => {
2842
2918
  if (!incomingEnded) {
2843
2919
  setTimeout(() => {
2844
- incoming.destroy();
2845
- outgoing.destroy();
2920
+ drainIncoming(incoming);
2846
2921
  });
2847
2922
  }
2848
2923
  });
2849
2924
  }
2850
2925
  };
2851
2926
  }
2927
+ outgoing.on("finish", () => {
2928
+ if (!incomingEnded) {
2929
+ drainIncoming(incoming);
2930
+ }
2931
+ });
2852
2932
  }
2853
2933
  outgoing.on("close", () => {
2854
2934
  const abortController = req[abortControllerKey];
@@ -2863,7 +2943,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
2863
2943
  setTimeout(() => {
2864
2944
  if (!incomingEnded) {
2865
2945
  setTimeout(() => {
2866
- incoming.destroy();
2946
+ drainIncoming(incoming);
2867
2947
  });
2868
2948
  }
2869
2949
  });
@@ -6703,7 +6783,7 @@ function getDefaultAgents() {
6703
6783
  }
6704
6784
 
6705
6785
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6706
- var CLI_VERSION = "0.1.52";
6786
+ var CLI_VERSION = "0.1.54";
6707
6787
  function extractServerName(command, commandArgs) {
6708
6788
  for (const arg of commandArgs) {
6709
6789
  if (!arg.startsWith("-")) {
@@ -7126,7 +7206,7 @@ function applyModeOverride(config, mode) {
7126
7206
  agent.options.mode = mode;
7127
7207
  if (mode === "ai_acp" && !agent.options.acpSettings) {
7128
7208
  agent.options.acpSettings = {
7129
- command: "claude-code-acp",
7209
+ command: "claude-agent-acp",
7130
7210
  args: [],
7131
7211
  session: {}
7132
7212
  };
@@ -7558,6 +7638,10 @@ var Protocol = class {
7558
7638
  this._progressHandlers.clear();
7559
7639
  this._taskProgressTokens.clear();
7560
7640
  this._pendingDebouncedNotifications.clear();
7641
+ for (const info of this._timeoutInfo.values()) {
7642
+ clearTimeout(info.timeoutId);
7643
+ }
7644
+ this._timeoutInfo.clear();
7561
7645
  for (const controller of this._requestHandlerAbortControllers.values()) {
7562
7646
  controller.abort();
7563
7647
  }
@@ -7688,7 +7772,9 @@ var Protocol = class {
7688
7772
  await capturedTransport?.send(errorResponse);
7689
7773
  }
7690
7774
  }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
7691
- this._requestHandlerAbortControllers.delete(request.id);
7775
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
7776
+ this._requestHandlerAbortControllers.delete(request.id);
7777
+ }
7692
7778
  });
7693
7779
  }
7694
7780
  _onprogress(notification) {
@@ -9812,7 +9898,7 @@ var StdioClientTransport = class {
9812
9898
  },
9813
9899
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9814
9900
  shell: false,
9815
- windowsHide: process6.platform === "win32" && isElectron(),
9901
+ windowsHide: process6.platform === "win32",
9816
9902
  cwd: this._serverParams.cwd
9817
9903
  });
9818
9904
  this._process.on("error", (error) => {
@@ -9919,9 +10005,6 @@ var StdioClientTransport = class {
9919
10005
  });
9920
10006
  }
9921
10007
  };
9922
- function isElectron() {
9923
- return "type" in process6;
9924
- }
9925
10008
 
9926
10009
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
9927
10010
  var ParseError = class extends Error {
@@ -10666,12 +10749,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
10666
10749
  var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
10667
10750
  function selectClientAuthMethod(clientInformation, supportedMethods) {
10668
10751
  const hasClientSecret = clientInformation.client_secret !== void 0;
10669
- if (supportedMethods.length === 0) {
10670
- return hasClientSecret ? "client_secret_post" : "none";
10671
- }
10672
- if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && supportedMethods.includes(clientInformation.token_endpoint_auth_method)) {
10752
+ if ("token_endpoint_auth_method" in clientInformation && clientInformation.token_endpoint_auth_method && isClientAuthMethod(clientInformation.token_endpoint_auth_method) && (supportedMethods.length === 0 || supportedMethods.includes(clientInformation.token_endpoint_auth_method))) {
10673
10753
  return clientInformation.token_endpoint_auth_method;
10674
10754
  }
10755
+ if (supportedMethods.length === 0) {
10756
+ return hasClientSecret ? "client_secret_basic" : "none";
10757
+ }
10675
10758
  if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
10676
10759
  return "client_secret_basic";
10677
10760
  }
@@ -10782,6 +10865,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10782
10865
  });
10783
10866
  }
10784
10867
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
10868
+ const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
10785
10869
  let clientInformation = await Promise.resolve(provider.clientInformation());
10786
10870
  if (!clientInformation) {
10787
10871
  if (authorizationCode !== void 0) {
@@ -10805,6 +10889,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10805
10889
  const fullInformation = await registerClient(authorizationServerUrl, {
10806
10890
  metadata,
10807
10891
  clientMetadata: provider.clientMetadata,
10892
+ scope: resolvedScope,
10808
10893
  fetchFn
10809
10894
  });
10810
10895
  await provider.saveClientInformation(fullInformation);
@@ -10848,7 +10933,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10848
10933
  clientInformation,
10849
10934
  state,
10850
10935
  redirectUrl: provider.redirectUrl,
10851
- scope: scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope,
10936
+ scope: resolvedScope,
10852
10937
  resource
10853
10938
  });
10854
10939
  await provider.saveCodeVerifier(codeVerifier);
@@ -11166,7 +11251,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
11166
11251
  fetchFn
11167
11252
  });
11168
11253
  }
11169
- async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
11254
+ async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
11170
11255
  let registrationUrl;
11171
11256
  if (metadata) {
11172
11257
  if (!metadata.registration_endpoint) {
@@ -11181,7 +11266,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
11181
11266
  headers: {
11182
11267
  "Content-Type": "application/json"
11183
11268
  },
11184
- body: JSON.stringify(clientMetadata)
11269
+ body: JSON.stringify({
11270
+ ...clientMetadata,
11271
+ ...scope !== void 0 ? { scope } : {}
11272
+ })
11185
11273
  });
11186
11274
  if (!response.ok) {
11187
11275
  throw await parseErrorResponse(response);
@@ -12276,7 +12364,7 @@ var SystemPrompts = {
12276
12364
  </rules>
12277
12365
 
12278
12366
  <format>
12279
- Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
12367
+ Get tool definitions: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
12280
12368
  Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
12281
12369
  </format>`,
12282
12370
  /**
@@ -12401,7 +12489,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
12401
12489
  *
12402
12490
  * Only two fields:
12403
12491
  * - `tool`: which tool to execute (enum includes "man" + all tool names)
12404
- * - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
12492
+ * - `args`: object with parameters. For "man": { tools: ["a", "b"] } to fetch tool definitions (including input/output schemas). For others: tool parameters.
12405
12493
  */
12406
12494
  forAgentic: function(allToolNames) {
12407
12495
  const toolEnum = [
@@ -14352,11 +14440,12 @@ var ToolManager = class {
14352
14440
  /**
14353
14441
  * Register a tool in the registry
14354
14442
  */
14355
- registerTool(name, description, schema, callback, options = {}) {
14443
+ registerTool(name, description, inputSchema, callback, options = {}) {
14356
14444
  this.toolRegistry.set(name, {
14357
14445
  callback,
14358
14446
  description,
14359
- schema
14447
+ inputSchema,
14448
+ outputSchema: options.outputSchema
14360
14449
  });
14361
14450
  if (options.hidden) {
14362
14451
  this.toolConfigs.set(name, {
@@ -14369,13 +14458,16 @@ var ToolManager = class {
14369
14458
  /**
14370
14459
  * Explicitly mark a tool as public (exposed to MCP clients)
14371
14460
  */
14372
- addPublicTool(name, description, schema) {
14461
+ addPublicTool(name, description, inputSchema, outputSchema) {
14373
14462
  const existingTool = this.publicTools.find((t) => t.name === name);
14374
14463
  if (!existingTool) {
14375
14464
  this.publicTools.push({
14376
14465
  name,
14377
14466
  description,
14378
- inputSchema: schema
14467
+ inputSchema,
14468
+ ...outputSchema ? {
14469
+ outputSchema
14470
+ } : {}
14379
14471
  });
14380
14472
  }
14381
14473
  this.toolConfigs.set(name, {
@@ -14501,10 +14593,13 @@ var ToolManager = class {
14501
14593
  getHiddenToolSchema(name) {
14502
14594
  const tool2 = this.toolRegistry.get(name);
14503
14595
  const config = this.toolConfigs.get(name);
14504
- if (tool2 && config?.visibility?.hidden && tool2.schema) {
14596
+ if (tool2 && config?.visibility?.hidden && tool2.inputSchema) {
14505
14597
  return {
14506
14598
  description: tool2.description,
14507
- schema: tool2.schema
14599
+ inputSchema: tool2.inputSchema,
14600
+ ...tool2.outputSchema ? {
14601
+ outputSchema: tool2.outputSchema
14602
+ } : {}
14508
14603
  };
14509
14604
  }
14510
14605
  return void 0;
@@ -14540,10 +14635,13 @@ var ToolManager = class {
14540
14635
  composedTools[name] = {
14541
14636
  name,
14542
14637
  description: tool2.description,
14543
- inputSchema: jsonSchema(tool2.schema || {
14638
+ inputSchema: jsonSchema(tool2.inputSchema || {
14544
14639
  type: "object",
14545
14640
  properties: {}
14546
14641
  }),
14642
+ ...tool2.outputSchema ? {
14643
+ outputSchema: jsonSchema(tool2.outputSchema)
14644
+ } : {},
14547
14645
  execute: tool2.callback
14548
14646
  };
14549
14647
  }
@@ -14560,10 +14658,13 @@ var ToolManager = class {
14560
14658
  return {
14561
14659
  name,
14562
14660
  description: tool2.description,
14563
- inputSchema: tool2.schema ?? {
14661
+ inputSchema: tool2.inputSchema ?? {
14564
14662
  type: "object",
14565
14663
  properties: {}
14566
14664
  },
14665
+ ...tool2.outputSchema ? {
14666
+ outputSchema: tool2.outputSchema
14667
+ } : {},
14567
14668
  execute: tool2.callback
14568
14669
  };
14569
14670
  }
@@ -14577,10 +14678,13 @@ var ToolManager = class {
14577
14678
  composedTools.push({
14578
14679
  name,
14579
14680
  description: tool2.description,
14580
- inputSchema: tool2.schema ?? {
14681
+ inputSchema: tool2.inputSchema ?? {
14581
14682
  type: "object",
14582
14683
  properties: {}
14583
14684
  },
14685
+ ...tool2.outputSchema ? {
14686
+ outputSchema: tool2.outputSchema
14687
+ } : {},
14584
14688
  execute: tool2.callback
14585
14689
  });
14586
14690
  }
@@ -14633,7 +14737,10 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
14633
14737
  const tempTool = {
14634
14738
  name: toolId,
14635
14739
  description: toolData.description,
14636
- inputSchema: toolData.schema || defaultSchema,
14740
+ inputSchema: toolData.inputSchema || defaultSchema,
14741
+ ...toolData.outputSchema ? {
14742
+ outputSchema: toolData.outputSchema
14743
+ } : {},
14637
14744
  execute: toolData.callback
14638
14745
  };
14639
14746
  const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
@@ -14645,7 +14752,9 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
14645
14752
  },
14646
14753
  transformationIndex: 0
14647
14754
  });
14648
- toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute);
14755
+ toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute, {
14756
+ outputSchema: processedTool.outputSchema
14757
+ });
14649
14758
  }
14650
14759
  }
14651
14760
  function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
@@ -14691,6 +14800,7 @@ var ComposableMCPServer = class extends Server {
14691
14800
  toolManager;
14692
14801
  logger = createLogger("mcpc.compose");
14693
14802
  fileLoaders = /* @__PURE__ */ new Map();
14803
+ pluginsDisposed = false;
14694
14804
  // Legacy property for backward compatibility
14695
14805
  get toolNameMapping() {
14696
14806
  return this.toolManager.getToolNameMapping();
@@ -14819,9 +14929,13 @@ var ComposableMCPServer = class extends Server {
14819
14929
  }
14820
14930
  tool(name, description, paramsSchema, cb, options = {}) {
14821
14931
  const jsonSchemaObj = extractJsonSchema(paramsSchema);
14822
- this.toolManager.registerTool(name, description, jsonSchemaObj, cb, options);
14932
+ const outputSchemaObj = options.outputSchema ? extractJsonSchema(options.outputSchema) : void 0;
14933
+ this.toolManager.registerTool(name, description, jsonSchemaObj, cb, {
14934
+ ...options,
14935
+ outputSchema: outputSchemaObj
14936
+ });
14823
14937
  if (!options.internal) {
14824
- this.toolManager.addPublicTool(name, description, jsonSchemaObj);
14938
+ this.toolManager.addPublicTool(name, description, jsonSchemaObj, outputSchemaObj);
14825
14939
  }
14826
14940
  if (options.plugins) {
14827
14941
  for (const plugin of options.plugins) {
@@ -15078,9 +15192,12 @@ var ComposableMCPServer = class extends Server {
15078
15192
  return {
15079
15193
  name,
15080
15194
  description: tool2?.description || "",
15081
- inputSchema: tool2?.schema || {
15195
+ inputSchema: tool2?.inputSchema || {
15082
15196
  type: "object"
15083
- }
15197
+ },
15198
+ ...tool2?.outputSchema ? {
15199
+ outputSchema: tool2.outputSchema
15200
+ } : {}
15084
15201
  };
15085
15202
  });
15086
15203
  }
@@ -15105,9 +15222,12 @@ var ComposableMCPServer = class extends Server {
15105
15222
  return Array.from(registry.entries()).map(([name, tool2]) => ({
15106
15223
  name,
15107
15224
  description: tool2?.description || "",
15108
- inputSchema: tool2?.schema || {
15225
+ inputSchema: tool2?.inputSchema || {
15109
15226
  type: "object"
15110
- }
15227
+ },
15228
+ ...tool2?.outputSchema ? {
15229
+ outputSchema: tool2.outputSchema
15230
+ } : {}
15111
15231
  }));
15112
15232
  }
15113
15233
  /**
@@ -15166,11 +15286,21 @@ var ComposableMCPServer = class extends Server {
15166
15286
  async disposePlugins() {
15167
15287
  await this.pluginManager.dispose();
15168
15288
  }
15289
+ /**
15290
+ * Dispose plugins only once to avoid duplicated cleanup in chained handlers.
15291
+ */
15292
+ async disposePluginsOnce() {
15293
+ if (this.pluginsDisposed) {
15294
+ return;
15295
+ }
15296
+ this.pluginsDisposed = true;
15297
+ await this.disposePlugins();
15298
+ }
15169
15299
  /**
15170
15300
  * Close the server and ensure all plugins are disposed
15171
15301
  */
15172
15302
  async close() {
15173
- await this.disposePlugins();
15303
+ await this.disposePluginsOnce();
15174
15304
  await super.close();
15175
15305
  }
15176
15306
  async compose(name, description, depsConfig = {
@@ -15239,7 +15369,9 @@ var ComposableMCPServer = class extends Server {
15239
15369
  });
15240
15370
  });
15241
15371
  Object.entries(tools).forEach(([toolId, tool2]) => {
15242
- this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute);
15372
+ this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute, {
15373
+ outputSchema: tool2.outputSchema
15374
+ });
15243
15375
  });
15244
15376
  const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
15245
15377
  const allTools = {
@@ -15275,16 +15407,20 @@ var ComposableMCPServer = class extends Server {
15275
15407
  server: this,
15276
15408
  toolNames: Object.keys(allTools)
15277
15409
  });
15410
+ const previousOnClose = this.onclose;
15278
15411
  this.onclose = async () => {
15279
15412
  await cleanupClients();
15280
- await this.disposePlugins();
15413
+ await this.disposePluginsOnce();
15281
15414
  await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
15415
+ previousOnClose?.();
15282
15416
  };
15417
+ const previousOnError = this.onerror;
15283
15418
  this.onerror = async (error) => {
15284
15419
  await this.logger.error(`[${name}] Event: error - ${error?.stack ?? String(error)}`);
15285
15420
  await cleanupClients();
15286
- await this.disposePlugins();
15421
+ await this.disposePluginsOnce();
15287
15422
  await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
15423
+ previousOnError?.(error);
15288
15424
  };
15289
15425
  const toolNameToDetailList = Object.entries(allTools);
15290
15426
  const publicToolNames = this.getPublicToolNames();
@@ -15296,7 +15432,8 @@ var ComposableMCPServer = class extends Server {
15296
15432
  return;
15297
15433
  }
15298
15434
  this.tool(toolId, tool2.description || "", jsonSchema(tool2.inputSchema), tool2.execute, {
15299
- internal: false
15435
+ internal: false,
15436
+ outputSchema: tool2.outputSchema
15300
15437
  });
15301
15438
  });
15302
15439
  await this.pluginManager.triggerComposeEnd({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/cli",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
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",