@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/app.cjs +145 -42
- package/app.mjs +146 -43
- package/bin/mcpc.cjs +96 -39
- package/bin/mcpc.mjs +96 -39
- package/bin.cjs +96 -39
- package/bin.mjs +96 -39
- package/index.cjs +145 -42
- package/index.mjs +146 -43
- package/package.json +1 -1
- package/server.cjs +145 -42
- package/server.mjs +146 -43
package/bin/mcpc.mjs
CHANGED
|
@@ -544,10 +544,9 @@ var ProgressTokenSchema = z.union([z.string(), z.number().int()]);
|
|
|
544
544
|
var CursorSchema = z.string();
|
|
545
545
|
var TaskCreationParamsSchema = z.looseObject({
|
|
546
546
|
/**
|
|
547
|
-
*
|
|
548
|
-
* If null, the task has unlimited lifetime until manually cleaned up.
|
|
547
|
+
* Requested duration in milliseconds to retain task from creation.
|
|
549
548
|
*/
|
|
550
|
-
ttl: z.
|
|
549
|
+
ttl: z.number().optional(),
|
|
551
550
|
/**
|
|
552
551
|
* Time in milliseconds to wait between task status requests.
|
|
553
552
|
*/
|
|
@@ -847,7 +846,11 @@ var ClientCapabilitiesSchema = z.object({
|
|
|
847
846
|
/**
|
|
848
847
|
* Present if the client supports task creation.
|
|
849
848
|
*/
|
|
850
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
849
|
+
tasks: ClientTasksCapabilitySchema.optional(),
|
|
850
|
+
/**
|
|
851
|
+
* Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
852
|
+
*/
|
|
853
|
+
extensions: z.record(z.string(), AssertObjectSchema).optional()
|
|
851
854
|
});
|
|
852
855
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
853
856
|
/**
|
|
@@ -908,7 +911,11 @@ var ServerCapabilitiesSchema = z.object({
|
|
|
908
911
|
/**
|
|
909
912
|
* Present if the server supports task creation.
|
|
910
913
|
*/
|
|
911
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
914
|
+
tasks: ServerTasksCapabilitySchema.optional(),
|
|
915
|
+
/**
|
|
916
|
+
* Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
|
|
917
|
+
*/
|
|
918
|
+
extensions: z.record(z.string(), AssertObjectSchema).optional()
|
|
912
919
|
});
|
|
913
920
|
var InitializeResultSchema = ResultSchema.extend({
|
|
914
921
|
/**
|
|
@@ -1101,6 +1108,12 @@ var ResourceSchema = z.object({
|
|
|
1101
1108
|
* The MIME type of this resource, if known.
|
|
1102
1109
|
*/
|
|
1103
1110
|
mimeType: z.optional(z.string()),
|
|
1111
|
+
/**
|
|
1112
|
+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
|
|
1113
|
+
*
|
|
1114
|
+
* This can be used by Hosts to display file sizes and estimate context window usage.
|
|
1115
|
+
*/
|
|
1116
|
+
size: z.optional(z.number()),
|
|
1104
1117
|
/**
|
|
1105
1118
|
* Optional annotations for the client.
|
|
1106
1119
|
*/
|
|
@@ -2386,6 +2399,8 @@ if (typeof global.crypto === "undefined") {
|
|
|
2386
2399
|
global.crypto = crypto2;
|
|
2387
2400
|
}
|
|
2388
2401
|
var outgoingEnded = Symbol("outgoingEnded");
|
|
2402
|
+
var incomingDraining = Symbol("incomingDraining");
|
|
2403
|
+
var MAX_DRAIN_BYTES = 64 * 1024 * 1024;
|
|
2389
2404
|
|
|
2390
2405
|
// __mcpc__cli_latest/node_modules/@jsr/std__cli/parse_args.js
|
|
2391
2406
|
var FLAG_REGEXP = /^(?:-(?:(?<doubleDash>-)(?<negated>no-)?)?)(?<key>.+?)(?:=(?<value>.*))?$/s;
|
|
@@ -5489,7 +5504,7 @@ function getDefaultAgents() {
|
|
|
5489
5504
|
}
|
|
5490
5505
|
|
|
5491
5506
|
// __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
|
|
5492
|
-
var CLI_VERSION = "0.1.
|
|
5507
|
+
var CLI_VERSION = "0.1.54";
|
|
5493
5508
|
function extractServerName(command, commandArgs) {
|
|
5494
5509
|
for (const arg of commandArgs) {
|
|
5495
5510
|
if (!arg.startsWith("-")) {
|
|
@@ -6272,6 +6287,10 @@ var Protocol = class {
|
|
|
6272
6287
|
this._progressHandlers.clear();
|
|
6273
6288
|
this._taskProgressTokens.clear();
|
|
6274
6289
|
this._pendingDebouncedNotifications.clear();
|
|
6290
|
+
for (const info of this._timeoutInfo.values()) {
|
|
6291
|
+
clearTimeout(info.timeoutId);
|
|
6292
|
+
}
|
|
6293
|
+
this._timeoutInfo.clear();
|
|
6275
6294
|
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
6276
6295
|
controller.abort();
|
|
6277
6296
|
}
|
|
@@ -6402,7 +6421,9 @@ var Protocol = class {
|
|
|
6402
6421
|
await capturedTransport?.send(errorResponse);
|
|
6403
6422
|
}
|
|
6404
6423
|
}).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => {
|
|
6405
|
-
this._requestHandlerAbortControllers.
|
|
6424
|
+
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
|
|
6425
|
+
this._requestHandlerAbortControllers.delete(request.id);
|
|
6426
|
+
}
|
|
6406
6427
|
});
|
|
6407
6428
|
}
|
|
6408
6429
|
_onprogress(notification) {
|
|
@@ -8496,7 +8517,7 @@ var StdioClientTransport = class {
|
|
|
8496
8517
|
},
|
|
8497
8518
|
stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
|
|
8498
8519
|
shell: false,
|
|
8499
|
-
windowsHide: process7.platform === "win32"
|
|
8520
|
+
windowsHide: process7.platform === "win32",
|
|
8500
8521
|
cwd: this._serverParams.cwd
|
|
8501
8522
|
});
|
|
8502
8523
|
this._process.on("error", (error) => {
|
|
@@ -8603,9 +8624,6 @@ var StdioClientTransport = class {
|
|
|
8603
8624
|
});
|
|
8604
8625
|
}
|
|
8605
8626
|
};
|
|
8606
|
-
function isElectron() {
|
|
8607
|
-
return "type" in process7;
|
|
8608
|
-
}
|
|
8609
8627
|
|
|
8610
8628
|
// __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
|
|
8611
8629
|
var ParseError = class extends Error {
|
|
@@ -9350,12 +9368,12 @@ var AUTHORIZATION_CODE_RESPONSE_TYPE = "code";
|
|
|
9350
9368
|
var AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
|
|
9351
9369
|
function selectClientAuthMethod(clientInformation, supportedMethods) {
|
|
9352
9370
|
const hasClientSecret = clientInformation.client_secret !== void 0;
|
|
9353
|
-
if (supportedMethods.length === 0) {
|
|
9354
|
-
return hasClientSecret ? "client_secret_post" : "none";
|
|
9355
|
-
}
|
|
9356
|
-
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)) {
|
|
9371
|
+
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))) {
|
|
9357
9372
|
return clientInformation.token_endpoint_auth_method;
|
|
9358
9373
|
}
|
|
9374
|
+
if (supportedMethods.length === 0) {
|
|
9375
|
+
return hasClientSecret ? "client_secret_basic" : "none";
|
|
9376
|
+
}
|
|
9359
9377
|
if (hasClientSecret && supportedMethods.includes("client_secret_basic")) {
|
|
9360
9378
|
return "client_secret_basic";
|
|
9361
9379
|
}
|
|
@@ -9466,6 +9484,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
9466
9484
|
});
|
|
9467
9485
|
}
|
|
9468
9486
|
const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
9487
|
+
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
9469
9488
|
let clientInformation = await Promise.resolve(provider.clientInformation());
|
|
9470
9489
|
if (!clientInformation) {
|
|
9471
9490
|
if (authorizationCode !== void 0) {
|
|
@@ -9489,6 +9508,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
9489
9508
|
const fullInformation = await registerClient(authorizationServerUrl, {
|
|
9490
9509
|
metadata,
|
|
9491
9510
|
clientMetadata: provider.clientMetadata,
|
|
9511
|
+
scope: resolvedScope,
|
|
9492
9512
|
fetchFn
|
|
9493
9513
|
});
|
|
9494
9514
|
await provider.saveClientInformation(fullInformation);
|
|
@@ -9532,7 +9552,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
9532
9552
|
clientInformation,
|
|
9533
9553
|
state,
|
|
9534
9554
|
redirectUrl: provider.redirectUrl,
|
|
9535
|
-
scope:
|
|
9555
|
+
scope: resolvedScope,
|
|
9536
9556
|
resource
|
|
9537
9557
|
});
|
|
9538
9558
|
await provider.saveCodeVerifier(codeVerifier);
|
|
@@ -9850,7 +9870,7 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
9850
9870
|
fetchFn
|
|
9851
9871
|
});
|
|
9852
9872
|
}
|
|
9853
|
-
async function registerClient(authorizationServerUrl, { metadata, clientMetadata, fetchFn }) {
|
|
9873
|
+
async function registerClient(authorizationServerUrl, { metadata, clientMetadata, scope, fetchFn }) {
|
|
9854
9874
|
let registrationUrl;
|
|
9855
9875
|
if (metadata) {
|
|
9856
9876
|
if (!metadata.registration_endpoint) {
|
|
@@ -9865,7 +9885,10 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
9865
9885
|
headers: {
|
|
9866
9886
|
"Content-Type": "application/json"
|
|
9867
9887
|
},
|
|
9868
|
-
body: JSON.stringify(
|
|
9888
|
+
body: JSON.stringify({
|
|
9889
|
+
...clientMetadata,
|
|
9890
|
+
...scope !== void 0 ? { scope } : {}
|
|
9891
|
+
})
|
|
9869
9892
|
});
|
|
9870
9893
|
if (!response.ok) {
|
|
9871
9894
|
throw await parseErrorResponse(response);
|
|
@@ -10960,7 +10983,7 @@ var SystemPrompts = {
|
|
|
10960
10983
|
</rules>
|
|
10961
10984
|
|
|
10962
10985
|
<format>
|
|
10963
|
-
Get tool
|
|
10986
|
+
Get tool definitions: \`{ "tool": "man", "args": { "tools": ["tool1", "tool2"] } }\`
|
|
10964
10987
|
Execute a tool: \`{ "tool": "tool_name", "args": { /* parameters */ } }\`
|
|
10965
10988
|
</format>`,
|
|
10966
10989
|
/**
|
|
@@ -11085,7 +11108,7 @@ function createArgsDefFactory(_name, _allToolNames, _depGroups, _predefinedSteps
|
|
|
11085
11108
|
*
|
|
11086
11109
|
* Only two fields:
|
|
11087
11110
|
* - `tool`: which tool to execute (enum includes "man" + all tool names)
|
|
11088
|
-
* - `args`: object with parameters. For "man": { tools: ["a", "b"] }. For others: tool parameters.
|
|
11111
|
+
* - `args`: object with parameters. For "man": { tools: ["a", "b"] } to fetch tool definitions (including input/output schemas). For others: tool parameters.
|
|
11089
11112
|
*/
|
|
11090
11113
|
forAgentic: function(allToolNames) {
|
|
11091
11114
|
const toolEnum = [
|
|
@@ -13036,11 +13059,12 @@ var ToolManager = class {
|
|
|
13036
13059
|
/**
|
|
13037
13060
|
* Register a tool in the registry
|
|
13038
13061
|
*/
|
|
13039
|
-
registerTool(name, description,
|
|
13062
|
+
registerTool(name, description, inputSchema, callback, options = {}) {
|
|
13040
13063
|
this.toolRegistry.set(name, {
|
|
13041
13064
|
callback,
|
|
13042
13065
|
description,
|
|
13043
|
-
|
|
13066
|
+
inputSchema,
|
|
13067
|
+
outputSchema: options.outputSchema
|
|
13044
13068
|
});
|
|
13045
13069
|
if (options.hidden) {
|
|
13046
13070
|
this.toolConfigs.set(name, {
|
|
@@ -13053,13 +13077,16 @@ var ToolManager = class {
|
|
|
13053
13077
|
/**
|
|
13054
13078
|
* Explicitly mark a tool as public (exposed to MCP clients)
|
|
13055
13079
|
*/
|
|
13056
|
-
addPublicTool(name, description,
|
|
13080
|
+
addPublicTool(name, description, inputSchema, outputSchema) {
|
|
13057
13081
|
const existingTool = this.publicTools.find((t) => t.name === name);
|
|
13058
13082
|
if (!existingTool) {
|
|
13059
13083
|
this.publicTools.push({
|
|
13060
13084
|
name,
|
|
13061
13085
|
description,
|
|
13062
|
-
inputSchema
|
|
13086
|
+
inputSchema,
|
|
13087
|
+
...outputSchema ? {
|
|
13088
|
+
outputSchema
|
|
13089
|
+
} : {}
|
|
13063
13090
|
});
|
|
13064
13091
|
}
|
|
13065
13092
|
this.toolConfigs.set(name, {
|
|
@@ -13185,10 +13212,13 @@ var ToolManager = class {
|
|
|
13185
13212
|
getHiddenToolSchema(name) {
|
|
13186
13213
|
const tool2 = this.toolRegistry.get(name);
|
|
13187
13214
|
const config = this.toolConfigs.get(name);
|
|
13188
|
-
if (tool2 && config?.visibility?.hidden && tool2.
|
|
13215
|
+
if (tool2 && config?.visibility?.hidden && tool2.inputSchema) {
|
|
13189
13216
|
return {
|
|
13190
13217
|
description: tool2.description,
|
|
13191
|
-
|
|
13218
|
+
inputSchema: tool2.inputSchema,
|
|
13219
|
+
...tool2.outputSchema ? {
|
|
13220
|
+
outputSchema: tool2.outputSchema
|
|
13221
|
+
} : {}
|
|
13192
13222
|
};
|
|
13193
13223
|
}
|
|
13194
13224
|
return void 0;
|
|
@@ -13224,10 +13254,13 @@ var ToolManager = class {
|
|
|
13224
13254
|
composedTools[name] = {
|
|
13225
13255
|
name,
|
|
13226
13256
|
description: tool2.description,
|
|
13227
|
-
inputSchema: jsonSchema(tool2.
|
|
13257
|
+
inputSchema: jsonSchema(tool2.inputSchema || {
|
|
13228
13258
|
type: "object",
|
|
13229
13259
|
properties: {}
|
|
13230
13260
|
}),
|
|
13261
|
+
...tool2.outputSchema ? {
|
|
13262
|
+
outputSchema: jsonSchema(tool2.outputSchema)
|
|
13263
|
+
} : {},
|
|
13231
13264
|
execute: tool2.callback
|
|
13232
13265
|
};
|
|
13233
13266
|
}
|
|
@@ -13244,10 +13277,13 @@ var ToolManager = class {
|
|
|
13244
13277
|
return {
|
|
13245
13278
|
name,
|
|
13246
13279
|
description: tool2.description,
|
|
13247
|
-
inputSchema: tool2.
|
|
13280
|
+
inputSchema: tool2.inputSchema ?? {
|
|
13248
13281
|
type: "object",
|
|
13249
13282
|
properties: {}
|
|
13250
13283
|
},
|
|
13284
|
+
...tool2.outputSchema ? {
|
|
13285
|
+
outputSchema: tool2.outputSchema
|
|
13286
|
+
} : {},
|
|
13251
13287
|
execute: tool2.callback
|
|
13252
13288
|
};
|
|
13253
13289
|
}
|
|
@@ -13261,10 +13297,13 @@ var ToolManager = class {
|
|
|
13261
13297
|
composedTools.push({
|
|
13262
13298
|
name,
|
|
13263
13299
|
description: tool2.description,
|
|
13264
|
-
inputSchema: tool2.
|
|
13300
|
+
inputSchema: tool2.inputSchema ?? {
|
|
13265
13301
|
type: "object",
|
|
13266
13302
|
properties: {}
|
|
13267
13303
|
},
|
|
13304
|
+
...tool2.outputSchema ? {
|
|
13305
|
+
outputSchema: tool2.outputSchema
|
|
13306
|
+
} : {},
|
|
13268
13307
|
execute: tool2.callback
|
|
13269
13308
|
});
|
|
13270
13309
|
}
|
|
@@ -13317,7 +13356,10 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
|
|
|
13317
13356
|
const tempTool = {
|
|
13318
13357
|
name: toolId,
|
|
13319
13358
|
description: toolData.description,
|
|
13320
|
-
inputSchema: toolData.
|
|
13359
|
+
inputSchema: toolData.inputSchema || defaultSchema,
|
|
13360
|
+
...toolData.outputSchema ? {
|
|
13361
|
+
outputSchema: toolData.outputSchema
|
|
13362
|
+
} : {},
|
|
13321
13363
|
execute: toolData.callback
|
|
13322
13364
|
};
|
|
13323
13365
|
const processedTool = await pluginManager.applyTransformToolHooks(tempTool, {
|
|
@@ -13329,7 +13371,9 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
|
|
|
13329
13371
|
},
|
|
13330
13372
|
transformationIndex: 0
|
|
13331
13373
|
});
|
|
13332
|
-
toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute
|
|
13374
|
+
toolManager.registerTool(toolId, processedTool.description || toolData.description, processedTool.inputSchema, processedTool.execute, {
|
|
13375
|
+
outputSchema: processedTool.outputSchema
|
|
13376
|
+
});
|
|
13333
13377
|
}
|
|
13334
13378
|
}
|
|
13335
13379
|
function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
|
|
@@ -13504,9 +13548,13 @@ var ComposableMCPServer = class extends Server {
|
|
|
13504
13548
|
}
|
|
13505
13549
|
tool(name, description, paramsSchema, cb, options = {}) {
|
|
13506
13550
|
const jsonSchemaObj = extractJsonSchema(paramsSchema);
|
|
13507
|
-
|
|
13551
|
+
const outputSchemaObj = options.outputSchema ? extractJsonSchema(options.outputSchema) : void 0;
|
|
13552
|
+
this.toolManager.registerTool(name, description, jsonSchemaObj, cb, {
|
|
13553
|
+
...options,
|
|
13554
|
+
outputSchema: outputSchemaObj
|
|
13555
|
+
});
|
|
13508
13556
|
if (!options.internal) {
|
|
13509
|
-
this.toolManager.addPublicTool(name, description, jsonSchemaObj);
|
|
13557
|
+
this.toolManager.addPublicTool(name, description, jsonSchemaObj, outputSchemaObj);
|
|
13510
13558
|
}
|
|
13511
13559
|
if (options.plugins) {
|
|
13512
13560
|
for (const plugin of options.plugins) {
|
|
@@ -13763,9 +13811,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
13763
13811
|
return {
|
|
13764
13812
|
name,
|
|
13765
13813
|
description: tool2?.description || "",
|
|
13766
|
-
inputSchema: tool2?.
|
|
13814
|
+
inputSchema: tool2?.inputSchema || {
|
|
13767
13815
|
type: "object"
|
|
13768
|
-
}
|
|
13816
|
+
},
|
|
13817
|
+
...tool2?.outputSchema ? {
|
|
13818
|
+
outputSchema: tool2.outputSchema
|
|
13819
|
+
} : {}
|
|
13769
13820
|
};
|
|
13770
13821
|
});
|
|
13771
13822
|
}
|
|
@@ -13790,9 +13841,12 @@ var ComposableMCPServer = class extends Server {
|
|
|
13790
13841
|
return Array.from(registry.entries()).map(([name, tool2]) => ({
|
|
13791
13842
|
name,
|
|
13792
13843
|
description: tool2?.description || "",
|
|
13793
|
-
inputSchema: tool2?.
|
|
13844
|
+
inputSchema: tool2?.inputSchema || {
|
|
13794
13845
|
type: "object"
|
|
13795
|
-
}
|
|
13846
|
+
},
|
|
13847
|
+
...tool2?.outputSchema ? {
|
|
13848
|
+
outputSchema: tool2.outputSchema
|
|
13849
|
+
} : {}
|
|
13796
13850
|
}));
|
|
13797
13851
|
}
|
|
13798
13852
|
/**
|
|
@@ -13934,7 +13988,9 @@ var ComposableMCPServer = class extends Server {
|
|
|
13934
13988
|
});
|
|
13935
13989
|
});
|
|
13936
13990
|
Object.entries(tools).forEach(([toolId, tool2]) => {
|
|
13937
|
-
this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute
|
|
13991
|
+
this.toolManager.registerTool(toolId, tool2.description || "", tool2.inputSchema, tool2.execute, {
|
|
13992
|
+
outputSchema: tool2.outputSchema
|
|
13993
|
+
});
|
|
13938
13994
|
});
|
|
13939
13995
|
const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
|
|
13940
13996
|
const allTools = {
|
|
@@ -13995,7 +14051,8 @@ var ComposableMCPServer = class extends Server {
|
|
|
13995
14051
|
return;
|
|
13996
14052
|
}
|
|
13997
14053
|
this.tool(toolId, tool2.description || "", jsonSchema(tool2.inputSchema), tool2.execute, {
|
|
13998
|
-
internal: false
|
|
14054
|
+
internal: false,
|
|
14055
|
+
outputSchema: tool2.outputSchema
|
|
13999
14056
|
});
|
|
14000
14057
|
});
|
|
14001
14058
|
await this.pluginManager.triggerComposeEnd({
|