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