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