@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/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";
@@ -2689,6 +2702,50 @@ if (typeof global.crypto === "undefined") {
2689
2702
  global.crypto = crypto2;
2690
2703
  }
2691
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
+ };
2692
2749
  var handleRequestError = () => new Response(null, {
2693
2750
  status: 400
2694
2751
  });
@@ -2860,14 +2917,18 @@ var getRequestListener = (fetchCallback, options = {}) => {
2860
2917
  setTimeout(() => {
2861
2918
  if (!incomingEnded) {
2862
2919
  setTimeout(() => {
2863
- incoming.destroy();
2864
- outgoing.destroy();
2920
+ drainIncoming(incoming);
2865
2921
  });
2866
2922
  }
2867
2923
  });
2868
2924
  }
2869
2925
  };
2870
2926
  }
2927
+ outgoing.on("finish", () => {
2928
+ if (!incomingEnded) {
2929
+ drainIncoming(incoming);
2930
+ }
2931
+ });
2871
2932
  }
2872
2933
  outgoing.on("close", () => {
2873
2934
  const abortController = req[abortControllerKey];
@@ -2882,7 +2943,7 @@ var getRequestListener = (fetchCallback, options = {}) => {
2882
2943
  setTimeout(() => {
2883
2944
  if (!incomingEnded) {
2884
2945
  setTimeout(() => {
2885
- incoming.destroy();
2946
+ drainIncoming(incoming);
2886
2947
  });
2887
2948
  }
2888
2949
  });
@@ -6722,7 +6783,7 @@ function getDefaultAgents() {
6722
6783
  }
6723
6784
 
6724
6785
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
6725
- var CLI_VERSION = "0.1.53";
6786
+ var CLI_VERSION = "0.1.54";
6726
6787
  function extractServerName(command, commandArgs) {
6727
6788
  for (const arg of commandArgs) {
6728
6789
  if (!arg.startsWith("-")) {
@@ -7577,6 +7638,10 @@ var Protocol = class {
7577
7638
  this._progressHandlers.clear();
7578
7639
  this._taskProgressTokens.clear();
7579
7640
  this._pendingDebouncedNotifications.clear();
7641
+ for (const info of this._timeoutInfo.values()) {
7642
+ clearTimeout(info.timeoutId);
7643
+ }
7644
+ this._timeoutInfo.clear();
7580
7645
  for (const controller of this._requestHandlerAbortControllers.values()) {
7581
7646
  controller.abort();
7582
7647
  }
@@ -7707,7 +7772,9 @@ var Protocol = class {
7707
7772
  await capturedTransport?.send(errorResponse);
7708
7773
  }
7709
7774
  }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
7710
- this._requestHandlerAbortControllers.delete(request.id);
7775
+ if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
7776
+ this._requestHandlerAbortControllers.delete(request.id);
7777
+ }
7711
7778
  });
7712
7779
  }
7713
7780
  _onprogress(notification) {
@@ -9831,7 +9898,7 @@ var StdioClientTransport = class {
9831
9898
  },
9832
9899
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
9833
9900
  shell: false,
9834
- windowsHide: process6.platform === "win32" && isElectron(),
9901
+ windowsHide: process6.platform === "win32",
9835
9902
  cwd: this._serverParams.cwd
9836
9903
  });
9837
9904
  this._process.on("error", (error) => {
@@ -9938,9 +10005,6 @@ var StdioClientTransport = class {
9938
10005
  });
9939
10006
  }
9940
10007
  };
9941
- function isElectron() {
9942
- return "type" in process6;
9943
- }
9944
10008
 
9945
10009
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
9946
10010
  var ParseError = class extends Error {
@@ -10685,12 +10749,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
10685
10749
  var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
10686
10750
  function selectClientAuthMethod(clientInformation, supportedMethods) {
10687
10751
  const hasClientSecret = clientInformation.client_secret !== void 0;
10688
- if (supportedMethods.length === 0) {
10689
- return hasClientSecret ? "client_secret_post" : "none";
10690
- }
10691
- 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))) {
10692
10753
  return clientInformation.token_endpoint_auth_method;
10693
10754
  }
10755
+ if (supportedMethods.length === 0) {
10756
+ return hasClientSecret ? "client_secret_basic" : "none";
10757
+ }
10694
10758
  if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
10695
10759
  return "client_secret_basic";
10696
10760
  }
@@ -10801,6 +10865,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10801
10865
  });
10802
10866
  }
10803
10867
  const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
10868
+ const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
10804
10869
  let clientInformation = await Promise.resolve(provider.clientInformation());
10805
10870
  if (!clientInformation) {
10806
10871
  if (authorizationCode !== void 0) {
@@ -10824,6 +10889,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10824
10889
  const fullInformation = await registerClient(authorizationServerUrl, {
10825
10890
  metadata,
10826
10891
  clientMetadata: provider.clientMetadata,
10892
+ scope: resolvedScope,
10827
10893
  fetchFn
10828
10894
  });
10829
10895
  await provider.saveClientInformation(fullInformation);
@@ -10867,7 +10933,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
10867
10933
  clientInformation,
10868
10934
  state,
10869
10935
  redirectUrl: provider.redirectUrl,
10870
- scope: scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope,
10936
+ scope: resolvedScope,
10871
10937
  resource
10872
10938
  });
10873
10939
  await provider.saveCodeVerifier(codeVerifier);
@@ -11185,7 +11251,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
11185
11251
  fetchFn
11186
11252
  });
11187
11253
  }
11188
- async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
11254
+ async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
11189
11255
  let registrationUrl;
11190
11256
  if (metadata) {
11191
11257
  if (!metadata.registration_endpoint) {
@@ -11200,7 +11266,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
11200
11266
  headers: {
11201
11267
  "Content-Type": "application/json"
11202
11268
  },
11203
- body: JSON.stringify(clientMetadata)
11269
+ body: JSON.stringify({
11270
+ ...clientMetadata,
11271
+ ...scope !== void 0 ? { scope } : {}
11272
+ })
11204
11273
  });
11205
11274
  if (!response.ok) {
11206
11275
  throw await parseErrorResponse(response);
@@ -12295,7 +12364,7 @@ var SystemPrompts = {
12295
12364
  </rules>
12296
12365
 
12297
12366
  <format>
12298
- Get tool schemas: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
12367
+ Get tool definitions: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
12299
12368
  Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
12300
12369
  </format>`,
12301
12370
  /**
@@ -12420,7 +12489,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
12420
12489
  *
12421
12490
  * Only two fields:
12422
12491
  * - `tool`: which tool to execute (enum includes "man" + all tool names)
12423
- * - `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.
12424
12493
  */
12425
12494
  forAgentic: function(allToolNames) {
12426
12495
  const toolEnum = [
@@ -14371,11 +14440,12 @@ var ToolManager = class {
14371
14440
  /**
14372
14441
  * Register a tool in the registry
14373
14442
  */
14374
- registerTool(name, description, schema, callback, options = {}) {
14443
+ registerTool(name, description, inputSchema, callback, options = {}) {
14375
14444
  this.toolRegistry.set(name, {
14376
14445
  callback,
14377
14446
  description,
14378
- schema
14447
+ inputSchema,
14448
+ outputSchema: options.outputSchema
14379
14449
  });
14380
14450
  if (options.hidden) {
14381
14451
  this.toolConfigs.set(name, {
@@ -14388,13 +14458,16 @@ var ToolManager = class {
14388
14458
  /**
14389
14459
  * Explicitly mark a tool as public (exposed to MCP clients)
14390
14460
  */
14391
- addPublicTool(name, description, schema) {
14461
+ addPublicTool(name, description, inputSchema, outputSchema) {
14392
14462
  const existingTool = this.publicTools.find((t) => t.name === name);
14393
14463
  if (!existingTool) {
14394
14464
  this.publicTools.push({
14395
14465
  name,
14396
14466
  description,
14397
- inputSchema: schema
14467
+ inputSchema,
14468
+ ...outputSchema ? {
14469
+ outputSchema
14470
+ } : {}
14398
14471
  });
14399
14472
  }
14400
14473
  this.toolConfigs.set(name, {
@@ -14520,10 +14593,13 @@ var ToolManager = class {
14520
14593
  getHiddenToolSchema(name) {
14521
14594
  const tool2 = this.toolRegistry.get(name);
14522
14595
  const config = this.toolConfigs.get(name);
14523
- if (tool2 && config?.visibility?.hidden && tool2.schema) {
14596
+ if (tool2 && config?.visibility?.hidden && tool2.inputSchema) {
14524
14597
  return {
14525
14598
  description: tool2.description,
14526
- schema: tool2.schema
14599
+ inputSchema: tool2.inputSchema,
14600
+ ...tool2.outputSchema ? {
14601
+ outputSchema: tool2.outputSchema
14602
+ } : {}
14527
14603
  };
14528
14604
  }
14529
14605
  return void 0;
@@ -14559,10 +14635,13 @@ var ToolManager = class {
14559
14635
  composedTools[name] = {
14560
14636
  name,
14561
14637
  description: tool2.description,
14562
- inputSchema: jsonSchema(tool2.schema || {
14638
+ inputSchema: jsonSchema(tool2.inputSchema || {
14563
14639
  type: "object",
14564
14640
  properties: {}
14565
14641
  }),
14642
+ ...tool2.outputSchema ? {
14643
+ outputSchema: jsonSchema(tool2.outputSchema)
14644
+ } : {},
14566
14645
  execute: tool2.callback
14567
14646
  };
14568
14647
  }
@@ -14579,10 +14658,13 @@ var ToolManager = class {
14579
14658
  return {
14580
14659
  name,
14581
14660
  description: tool2.description,
14582
- inputSchema: tool2.schema ?? {
14661
+ inputSchema: tool2.inputSchema ?? {
14583
14662
  type: "object",
14584
14663
  properties: {}
14585
14664
  },
14665
+ ...tool2.outputSchema ? {
14666
+ outputSchema: tool2.outputSchema
14667
+ } : {},
14586
14668
  execute: tool2.callback
14587
14669
  };
14588
14670
  }
@@ -14596,10 +14678,13 @@ var ToolManager = class {
14596
14678
  composedTools.push({
14597
14679
  name,
14598
14680
  description: tool2.description,
14599
- inputSchema: tool2.schema ?? {
14681
+ inputSchema: tool2.inputSchema ?? {
14600
14682
  type: "object",
14601
14683
  properties: {}
14602
14684
  },
14685
+ ...tool2.outputSchema ? {
14686
+ outputSchema: tool2.outputSchema
14687
+ } : {},
14603
14688
  execute: tool2.callback
14604
14689
  });
14605
14690
  }
@@ -14652,7 +14737,10 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
14652
14737
  const tempTool = {
14653
14738
  name: toolId,
14654
14739
  description: toolData.description,
14655
- inputSchema: toolData.schema || defaultSchema,
14740
+ inputSchema: toolData.inputSchema || defaultSchema,
14741
+ ...toolData.outputSchema ? {
14742
+ outputSchema: toolData.outputSchema
14743
+ } : {},
14656
14744
  execute: toolData.callback
14657
14745
  };
14658
14746
  const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
@@ -14664,7 +14752,9 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
14664
14752
  },
14665
14753
  transformationIndex: 0
14666
14754
  });
14667
- 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
+ });
14668
14758
  }
14669
14759
  }
14670
14760
  function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
@@ -14839,9 +14929,13 @@ var ComposableMCPServer = class extends Server {
14839
14929
  }
14840
14930
  tool(name, description, paramsSchema, cb, options = {}) {
14841
14931
  const jsonSchemaObj = extractJsonSchema(paramsSchema);
14842
- 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
+ });
14843
14937
  if (!options.internal) {
14844
- this.toolManager.addPublicTool(name, description, jsonSchemaObj);
14938
+ this.toolManager.addPublicTool(name, description, jsonSchemaObj, outputSchemaObj);
14845
14939
  }
14846
14940
  if (options.plugins) {
14847
14941
  for (const plugin of options.plugins) {
@@ -15098,9 +15192,12 @@ var ComposableMCPServer = class extends Server {
15098
15192
  return {
15099
15193
  name,
15100
15194
  description: tool2?.description || "",
15101
- inputSchema: tool2?.schema || {
15195
+ inputSchema: tool2?.inputSchema || {
15102
15196
  type: "object"
15103
- }
15197
+ },
15198
+ ...tool2?.outputSchema ? {
15199
+ outputSchema: tool2.outputSchema
15200
+ } : {}
15104
15201
  };
15105
15202
  });
15106
15203
  }
@@ -15125,9 +15222,12 @@ var ComposableMCPServer = class extends Server {
15125
15222
  return Array.from(registry.entries()).map(([name, tool2]) => ({
15126
15223
  name,
15127
15224
  description: tool2?.description || "",
15128
- inputSchema: tool2?.schema || {
15225
+ inputSchema: tool2?.inputSchema || {
15129
15226
  type: "object"
15130
- }
15227
+ },
15228
+ ...tool2?.outputSchema ? {
15229
+ outputSchema: tool2.outputSchema
15230
+ } : {}
15131
15231
  }));
15132
15232
  }
15133
15233
  /**
@@ -15269,7 +15369,9 @@ var ComposableMCPServer = class extends Server {
15269
15369
  });
15270
15370
  });
15271
15371
  Object.entries(tools).forEach(([toolId, tool2]) => {
15272
- 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
+ });
15273
15375
  });
15274
15376
  const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
15275
15377
  const allTools = {
@@ -15330,7 +15432,8 @@ var ComposableMCPServer = class extends Server {
15330
15432
  return;
15331
15433
  }
15332
15434
  this.tool(toolId, tool2.description || "", jsonSchema(tool2.inputSchema), tool2.execute, {
15333
- internal: false
15435
+ internal: false,
15436
+ outputSchema: tool2.outputSchema
15334
15437
  });
15335
15438
  });
15336
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.53",
3
+ "version": "0.1.54",
4
4
  "homepage": "https://jsr.io/@mcpc/cli",
5
5
  "dependencies": {
6
6
  "@hono/zod-openapi": "^0.19.2",