@mcpc-tech/cli 0.1.53 → 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/bin.cjs CHANGED
@@ -535,10 +535,9 @@ var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
535
535
  var CursorSchema = z.string();
536
536
  var TaskCreationParamsSchema = z.looseObject({
537
537
  /**
538
- * Time in milliseconds to keep task results available after completion.
539
- * If null, the task has unlimited lifetime until manually cleaned up.
538
+ * Requested duration in milliseconds to retain task from creation.
540
539
  */
541
- ttl: z.union([z.number(), z.null()]).optional(),
540
+ ttl: z.number().optional(),
542
541
  /**
543
542
  * Time in milliseconds to wait between task status requests.
544
543
  */
@@ -838,7 +837,11 @@ var ClientCapabilitiesSchema = z.object({
838
837
  /**
839
838
  * Present if the client supports task creation.
840
839
  */
841
- tasks: ClientTasksCapabilitySchema.optional()
840
+ tasks: ClientTasksCapabilitySchema.optional(),
841
+ /**
842
+ * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
843
+ */
844
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
842
845
  });
843
846
  var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
844
847
  /**
@@ -899,7 +902,11 @@ var ServerCapabilitiesSchema = z.object({
899
902
  /**
900
903
  * Present if the server supports task creation.
901
904
  */
902
- tasks: ServerTasksCapabilitySchema.optional()
905
+ tasks: ServerTasksCapabilitySchema.optional(),
906
+ /**
907
+ * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
908
+ */
909
+ extensions: z.record(z.string(), AssertObjectSchema).optional()
903
910
  });
904
911
  var InitializeResultSchema = ResultSchema.extend({
905
912
  /**
@@ -1092,6 +1099,12 @@ var ResourceSchema = z.object({
1092
1099
  * The MIME type of this resource, if known.
1093
1100
  */
1094
1101
  mimeType: z.optional(z.string()),
1102
+ /**
1103
+ * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
1104
+ *
1105
+ * This can be used by Hosts to display file sizes and estimate context window usage.
1106
+ */
1107
+ size: z.optional(z.number()),
1095
1108
  /**
1096
1109
  * Optional annotations for the client.
1097
1110
  */
@@ -2377,6 +2390,8 @@ if (typeof global.crypto === "undefined") {
2377
2390
  global.crypto = import_crypto.default;
2378
2391
  }
2379
2392
  var outgoingEnded = Symbol("outgoingEnded");
2393
+ var incomingDraining = Symbol("incomingDraining");
2394
+ var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
2380
2395
 
2381
2396
  // __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
2382
2397
  var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s;
@@ -5480,7 +5495,7 @@ function getDefaultAgents() {
5480
5495
  }
5481
5496
 
5482
5497
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
5483
- var CLI_VERSION = "0.1.53";
5498
+ var CLI_VERSION = "0.1.54";
5484
5499
  function extractServerName(command, commandArgs) {
5485
5500
  for (const arg of commandArgs) {
5486
5501
  if (!arg.startsWith("-")) {
@@ -6263,6 +6278,10 @@ var Protocol = class {
6263
6278
  this._progressHandlers.clear();
6264
6279
  this._taskProgressTokens.clear();
6265
6280
  this._pendingDebouncedNotifications.clear();
6281
+ for (const info of this._timeoutInfo.values()) {
6282
+ clearTimeout(info.timeoutId);
6283
+ }
6284
+ this._timeoutInfo.clear();
6266
6285
  for (const controller of this._requestHandlerAbortControllers.values()) {
6267
6286
  controller.abort();
6268
6287
  }
@@ -6393,7 +6412,9 @@ var Protocol = class {
6393
6412
  await capturedTransport?.send(errorResponse);
6394
6413
  }
6395
6414
  }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
6396
- this._requestHandlerAbortControllers.delete(request.id);
6415
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
6416
+ this._requestHandlerAbortControllers.delete(request.id);
6417
+ }
6397
6418
  });
6398
6419
  }
6399
6420
  _onprogress(notification) {
@@ -8487,7 +8508,7 @@ var StdioClientTransport = class {
8487
8508
  },
8488
8509
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
8489
8510
  shell: false,
8490
- windowsHide: import_node_process6.default.platform === "win32" && isElectron(),
8511
+ windowsHide: import_node_process6.default.platform === "win32",
8491
8512
  cwd: this._serverParams.cwd
8492
8513
  });
8493
8514
  this._process.on("error", (error) => {
@@ -8594,9 +8615,6 @@ var StdioClientTransport = class {
8594
8615
  });
8595
8616
  }
8596
8617
  };
8597
- function isElectron() {
8598
- return "type" in import_node_process6.default;
8599
- }
8600
8618
 
8601
8619
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
8602
8620
  var ParseError = class extends Error {
@@ -9341,12 +9359,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
9341
9359
  var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
9342
9360
  function selectClientAuthMethod(clientInformation, supportedMethods) {
9343
9361
  const hasClientSecret = clientInformation.client_secret !== void 0;
9344
- if (supportedMethods.length === 0) {
9345
- return hasClientSecret ? "client_secret_post" : "none";
9346
- }
9347
- 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)) {
9362
+ 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))) {
9348
9363
  return clientInformation.token_endpoint_auth_method;
9349
9364
  }
9365
+ if (supportedMethods.length === 0) {
9366
+ return hasClientSecret ? "client_secret_basic" : "none";
9367
+ }
9350
9368
  if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
9351
9369
  return "client_secret_basic";
9352
9370
  }
@@ -9457,6 +9475,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
9457
9475
  });
9458
9476
  }
9459
9477
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
9478
+ const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
9460
9479
  let clientInformation = await Promise.resolve(provider.clientInformation());
9461
9480
  if (!clientInformation) {
9462
9481
  if (authorizationCode !== void 0) {
@@ -9480,6 +9499,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
9480
9499
  const fullInformation = await registerClient(authorizationServerUrl, {
9481
9500
  metadata,
9482
9501
  clientMetadata: provider.clientMetadata,
9502
+ scope: resolvedScope,
9483
9503
  fetchFn
9484
9504
  });
9485
9505
  await provider.saveClientInformation(fullInformation);
@@ -9523,7 +9543,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
9523
9543
  clientInformation,
9524
9544
  state,
9525
9545
  redirectUrl: provider.redirectUrl,
9526
- scope: scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope,
9546
+ scope: resolvedScope,
9527
9547
  resource
9528
9548
  });
9529
9549
  await provider.saveCodeVerifier(codeVerifier);
@@ -9841,7 +9861,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
9841
9861
  fetchFn
9842
9862
  });
9843
9863
  }
9844
- async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
9864
+ async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
9845
9865
  let registrationUrl;
9846
9866
  if (metadata) {
9847
9867
  if (!metadata.registration_endpoint) {
@@ -9856,7 +9876,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
9856
9876
  headers: {
9857
9877
  "Content-Type": "application/json"
9858
9878
  },
9859
- body: JSON.stringify(clientMetadata)
9879
+ body: JSON.stringify({
9880
+ ...clientMetadata,
9881
+ ...scope !== void 0 ? { scope } : {}
9882
+ })
9860
9883
  });
9861
9884
  if (!response.ok) {
9862
9885
  throw await parseErrorResponse(response);
@@ -10951,7 +10974,7 @@ var SystemPrompts = {
10951
10974
  </rules>
10952
10975
 
10953
10976
  <format>
10954
- Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
10977
+ Get tool definitions: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
10955
10978
  Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
10956
10979
  </format>`,
10957
10980
  /**
@@ -11076,7 +11099,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
11076
11099
  *
11077
11100
  * Only two fields:
11078
11101
  * - `tool`: which tool to execute (enum includes "man" + all tool names)
11079
- * - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
11102
+ * - `args`: object with parameters. For "man": { tools: ["a", "b"] } to fetch tool definitions (including input/output schemas). For others: tool parameters.
11080
11103
  */
11081
11104
  forAgentic: function(allToolNames) {
11082
11105
  const toolEnum = [
@@ -13028,11 +13051,12 @@ var ToolManager = class {
13028
13051
  /**
13029
13052
  * Register a tool in the registry
13030
13053
  */
13031
- registerTool(name, description, schema, callback, options = {}) {
13054
+ registerTool(name, description, inputSchema, callback, options = {}) {
13032
13055
  this.toolRegistry.set(name, {
13033
13056
  callback,
13034
13057
  description,
13035
- schema
13058
+ inputSchema,
13059
+ outputSchema: options.outputSchema
13036
13060
  });
13037
13061
  if (options.hidden) {
13038
13062
  this.toolConfigs.set(name, {
@@ -13045,13 +13069,16 @@ var ToolManager = class {
13045
13069
  /**
13046
13070
  * Explicitly mark a tool as public (exposed to MCP clients)
13047
13071
  */
13048
- addPublicTool(name, description, schema) {
13072
+ addPublicTool(name, description, inputSchema, outputSchema) {
13049
13073
  const existingTool = this.publicTools.find((t) => t.name === name);
13050
13074
  if (!existingTool) {
13051
13075
  this.publicTools.push({
13052
13076
  name,
13053
13077
  description,
13054
- inputSchema: schema
13078
+ inputSchema,
13079
+ ...outputSchema ? {
13080
+ outputSchema
13081
+ } : {}
13055
13082
  });
13056
13083
  }
13057
13084
  this.toolConfigs.set(name, {
@@ -13177,10 +13204,13 @@ var ToolManager = class {
13177
13204
  getHiddenToolSchema(name) {
13178
13205
  const tool2 = this.toolRegistry.get(name);
13179
13206
  const config = this.toolConfigs.get(name);
13180
- if (tool2 && config?.visibility?.hidden && tool2.schema) {
13207
+ if (tool2 && config?.visibility?.hidden && tool2.inputSchema) {
13181
13208
  return {
13182
13209
  description: tool2.description,
13183
- schema: tool2.schema
13210
+ inputSchema: tool2.inputSchema,
13211
+ ...tool2.outputSchema ? {
13212
+ outputSchema: tool2.outputSchema
13213
+ } : {}
13184
13214
  };
13185
13215
  }
13186
13216
  return void 0;
@@ -13216,10 +13246,13 @@ var ToolManager = class {
13216
13246
  composedTools[name] = {
13217
13247
  name,
13218
13248
  description: tool2.description,
13219
- inputSchema: jsonSchema(tool2.schema || {
13249
+ inputSchema: jsonSchema(tool2.inputSchema || {
13220
13250
  type: "object",
13221
13251
  properties: {}
13222
13252
  }),
13253
+ ...tool2.outputSchema ? {
13254
+ outputSchema: jsonSchema(tool2.outputSchema)
13255
+ } : {},
13223
13256
  execute: tool2.callback
13224
13257
  };
13225
13258
  }
@@ -13236,10 +13269,13 @@ var ToolManager = class {
13236
13269
  return {
13237
13270
  name,
13238
13271
  description: tool2.description,
13239
- inputSchema: tool2.schema ?? {
13272
+ inputSchema: tool2.inputSchema ?? {
13240
13273
  type: "object",
13241
13274
  properties: {}
13242
13275
  },
13276
+ ...tool2.outputSchema ? {
13277
+ outputSchema: tool2.outputSchema
13278
+ } : {},
13243
13279
  execute: tool2.callback
13244
13280
  };
13245
13281
  }
@@ -13253,10 +13289,13 @@ var ToolManager = class {
13253
13289
  composedTools.push({
13254
13290
  name,
13255
13291
  description: tool2.description,
13256
- inputSchema: tool2.schema ?? {
13292
+ inputSchema: tool2.inputSchema ?? {
13257
13293
  type: "object",
13258
13294
  properties: {}
13259
13295
  },
13296
+ ...tool2.outputSchema ? {
13297
+ outputSchema: tool2.outputSchema
13298
+ } : {},
13260
13299
  execute: tool2.callback
13261
13300
  });
13262
13301
  }
@@ -13309,7 +13348,10 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
13309
13348
  const tempTool = {
13310
13349
  name: toolId,
13311
13350
  description: toolData.description,
13312
- inputSchema: toolData.schema || defaultSchema,
13351
+ inputSchema: toolData.inputSchema || defaultSchema,
13352
+ ...toolData.outputSchema ? {
13353
+ outputSchema: toolData.outputSchema
13354
+ } : {},
13313
13355
  execute: toolData.callback
13314
13356
  };
13315
13357
  const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
@@ -13321,7 +13363,9 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
13321
13363
  },
13322
13364
  transformationIndex: 0
13323
13365
  });
13324
- toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute);
13366
+ toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute, {
13367
+ outputSchema: processedTool.outputSchema
13368
+ });
13325
13369
  }
13326
13370
  }
13327
13371
  function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
@@ -13496,9 +13540,13 @@ var ComposableMCPServer = class extends Server {
13496
13540
  }
13497
13541
  tool(name, description, paramsSchema, cb, options = {}) {
13498
13542
  const jsonSchemaObj = extractJsonSchema(paramsSchema);
13499
- this.toolManager.registerTool(name, description, jsonSchemaObj, cb, options);
13543
+ const outputSchemaObj = options.outputSchema ? extractJsonSchema(options.outputSchema) : void 0;
13544
+ this.toolManager.registerTool(name, description, jsonSchemaObj, cb, {
13545
+ ...options,
13546
+ outputSchema: outputSchemaObj
13547
+ });
13500
13548
  if (!options.internal) {
13501
- this.toolManager.addPublicTool(name, description, jsonSchemaObj);
13549
+ this.toolManager.addPublicTool(name, description, jsonSchemaObj, outputSchemaObj);
13502
13550
  }
13503
13551
  if (options.plugins) {
13504
13552
  for (const plugin of options.plugins) {
@@ -13755,9 +13803,12 @@ var ComposableMCPServer = class extends Server {
13755
13803
  return {
13756
13804
  name,
13757
13805
  description: tool2?.description || "",
13758
- inputSchema: tool2?.schema || {
13806
+ inputSchema: tool2?.inputSchema || {
13759
13807
  type: "object"
13760
- }
13808
+ },
13809
+ ...tool2?.outputSchema ? {
13810
+ outputSchema: tool2.outputSchema
13811
+ } : {}
13761
13812
  };
13762
13813
  });
13763
13814
  }
@@ -13782,9 +13833,12 @@ var ComposableMCPServer = class extends Server {
13782
13833
  return Array.from(registry.entries()).map(([name, tool2]) => ({
13783
13834
  name,
13784
13835
  description: tool2?.description || "",
13785
- inputSchema: tool2?.schema || {
13836
+ inputSchema: tool2?.inputSchema || {
13786
13837
  type: "object"
13787
- }
13838
+ },
13839
+ ...tool2?.outputSchema ? {
13840
+ outputSchema: tool2.outputSchema
13841
+ } : {}
13788
13842
  }));
13789
13843
  }
13790
13844
  /**
@@ -13926,7 +13980,9 @@ var ComposableMCPServer = class extends Server {
13926
13980
  });
13927
13981
  });
13928
13982
  Object.entries(tools).forEach(([toolId, tool2]) => {
13929
- this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute);
13983
+ this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute, {
13984
+ outputSchema: tool2.outputSchema
13985
+ });
13930
13986
  });
13931
13987
  const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
13932
13988
  const allTools = {
@@ -13987,7 +14043,8 @@ var ComposableMCPServer = class extends Server {
13987
14043
  return;
13988
14044
  }
13989
14045
  this.tool(toolId, tool2.description || "", jsonSchema(tool2.inputSchema), tool2.execute, {
13990
- internal: false
14046
+ internal: false,
14047
+ outputSchema: tool2.outputSchema
13991
14048
  });
13992
14049
  });
13993
14050
  await this.pluginManager.triggerComposeEnd({