@mcpc-tech/cli 0.1.45 → 0.1.49
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 +15106 -0
- package/app.mjs +15099 -0
- package/bin/mcpc.cjs +78 -2
- package/bin/mcpc.mjs +78 -2
- package/bin.cjs +13795 -0
- package/bin.mjs +13800 -0
- package/index.cjs +15136 -0
- package/index.mjs +15125 -0
- package/package.json +25 -8
- package/server.cjs +15105 -0
- package/server.mjs +15110 -0
package/bin/mcpc.cjs
CHANGED
|
@@ -5243,7 +5243,7 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
5243
5243
|
var import_node_path5 = require("node:path");
|
|
5244
5244
|
var import_node_process3 = __toESM(require("node:process"), 1);
|
|
5245
5245
|
var DEFAULT_SKILLS_PATHS = [
|
|
5246
|
-
".
|
|
5246
|
+
".agent/skills"
|
|
5247
5247
|
];
|
|
5248
5248
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
5249
5249
|
function getGlobalPlugins(skillsPaths) {
|
|
@@ -6029,6 +6029,9 @@ var Protocol = class {
|
|
|
6029
6029
|
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
6030
6030
|
*/
|
|
6031
6031
|
async connect(transport) {
|
|
6032
|
+
if (this._transport) {
|
|
6033
|
+
throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
6034
|
+
}
|
|
6032
6035
|
this._transport = transport;
|
|
6033
6036
|
const _onclose = this.transport?.onclose;
|
|
6034
6037
|
this._transport.onclose = () => {
|
|
@@ -6061,6 +6064,10 @@ var Protocol = class {
|
|
|
6061
6064
|
this._progressHandlers.clear();
|
|
6062
6065
|
this._taskProgressTokens.clear();
|
|
6063
6066
|
this._pendingDebouncedNotifications.clear();
|
|
6067
|
+
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
6068
|
+
controller.abort();
|
|
6069
|
+
}
|
|
6070
|
+
this._requestHandlerAbortControllers.clear();
|
|
6064
6071
|
const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
6065
6072
|
this._transport = void 0;
|
|
6066
6073
|
this.onclose?.();
|
|
@@ -6111,6 +6118,8 @@ var Protocol = class {
|
|
|
6111
6118
|
sessionId: capturedTransport?.sessionId,
|
|
6112
6119
|
_meta: request.params?._meta,
|
|
6113
6120
|
sendNotification: async (notification) => {
|
|
6121
|
+
if (abortController.signal.aborted)
|
|
6122
|
+
return;
|
|
6114
6123
|
const notificationOptions = { relatedRequestId: request.id };
|
|
6115
6124
|
if (relatedTaskId) {
|
|
6116
6125
|
notificationOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -6118,6 +6127,9 @@ var Protocol = class {
|
|
|
6118
6127
|
await this.notification(notification, notificationOptions);
|
|
6119
6128
|
},
|
|
6120
6129
|
sendRequest: async (r, resultSchema, options) => {
|
|
6130
|
+
if (abortController.signal.aborted) {
|
|
6131
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
6132
|
+
}
|
|
6121
6133
|
const requestOptions = { ...options, relatedRequestId: request.id };
|
|
6122
6134
|
if (relatedTaskId && !requestOptions.relatedTask) {
|
|
6123
6135
|
requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -10853,7 +10865,8 @@ var ajv = new import_ajv2.Ajv({
|
|
|
10853
10865
|
import_ajv_formats2.default.default(ajv);
|
|
10854
10866
|
import_ajv_errors.default.default(ajv);
|
|
10855
10867
|
function validateSchema(data, schema) {
|
|
10856
|
-
const
|
|
10868
|
+
const cleanedSchema = cleanToolSchema(schema);
|
|
10869
|
+
const validate = ajv.compile(cleanedSchema);
|
|
10857
10870
|
if (!validate(data)) {
|
|
10858
10871
|
const errors = validate.errors;
|
|
10859
10872
|
const customErrors = errors.filter((err) => err.keyword === "errorMessage");
|
|
@@ -12904,6 +12917,25 @@ var ToolManager = class {
|
|
|
12904
12917
|
execute: tool2.callback
|
|
12905
12918
|
};
|
|
12906
12919
|
}
|
|
12920
|
+
/**
|
|
12921
|
+
* Get all tools as ComposedTool objects with execute callback
|
|
12922
|
+
* Includes both public and internal tools
|
|
12923
|
+
*/
|
|
12924
|
+
getAllComposedTools() {
|
|
12925
|
+
const composedTools = [];
|
|
12926
|
+
for (const [name, tool2] of this.toolRegistry.entries()) {
|
|
12927
|
+
composedTools.push({
|
|
12928
|
+
name,
|
|
12929
|
+
description: tool2.description,
|
|
12930
|
+
inputSchema: tool2.schema ?? {
|
|
12931
|
+
type: "object",
|
|
12932
|
+
properties: {}
|
|
12933
|
+
},
|
|
12934
|
+
execute: tool2.callback
|
|
12935
|
+
});
|
|
12936
|
+
}
|
|
12937
|
+
return composedTools;
|
|
12938
|
+
}
|
|
12907
12939
|
};
|
|
12908
12940
|
|
|
12909
12941
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js
|
|
@@ -13384,6 +13416,50 @@ var ComposableMCPServer = class extends Server {
|
|
|
13384
13416
|
const publicToolNames = this.getPublicToolNames();
|
|
13385
13417
|
return allToolNames.filter((name) => !publicToolNames.includes(name));
|
|
13386
13418
|
}
|
|
13419
|
+
/**
|
|
13420
|
+
* Get all internal tools with their full metadata (description, schema)
|
|
13421
|
+
* Internal tools are not exposed to MCP clients but available within the agent
|
|
13422
|
+
*/
|
|
13423
|
+
getInternalTools() {
|
|
13424
|
+
const internalNames = this.getInternalToolNames();
|
|
13425
|
+
const registry = this.toolManager.getToolRegistry();
|
|
13426
|
+
return internalNames.map((name) => {
|
|
13427
|
+
const tool2 = registry.get(name);
|
|
13428
|
+
return {
|
|
13429
|
+
name,
|
|
13430
|
+
description: tool2?.description || "",
|
|
13431
|
+
inputSchema: tool2?.schema || {
|
|
13432
|
+
type: "object"
|
|
13433
|
+
}
|
|
13434
|
+
};
|
|
13435
|
+
});
|
|
13436
|
+
}
|
|
13437
|
+
/**
|
|
13438
|
+
* Get a single tool with full details including execute callback
|
|
13439
|
+
* Works for both public and internal tools
|
|
13440
|
+
*/
|
|
13441
|
+
getComposedTool(name) {
|
|
13442
|
+
return this.toolManager.getComposedTool(name);
|
|
13443
|
+
}
|
|
13444
|
+
/**
|
|
13445
|
+
* Get all tools (public and internal) as composed tools with execute callback
|
|
13446
|
+
*/
|
|
13447
|
+
getAllComposedTools() {
|
|
13448
|
+
return this.toolManager.getAllComposedTools();
|
|
13449
|
+
}
|
|
13450
|
+
/**
|
|
13451
|
+
* Get all tools (public and internal) with full details
|
|
13452
|
+
*/
|
|
13453
|
+
getAllTools() {
|
|
13454
|
+
const registry = this.toolManager.getToolRegistry();
|
|
13455
|
+
return Array.from(registry.entries()).map(([name, tool2]) => ({
|
|
13456
|
+
name,
|
|
13457
|
+
description: tool2?.description || "",
|
|
13458
|
+
inputSchema: tool2?.schema || {
|
|
13459
|
+
type: "object"
|
|
13460
|
+
}
|
|
13461
|
+
}));
|
|
13462
|
+
}
|
|
13387
13463
|
/**
|
|
13388
13464
|
* Get hidden tool schema by name (for internal access)
|
|
13389
13465
|
*/
|
package/bin/mcpc.mjs
CHANGED
|
@@ -5251,7 +5251,7 @@ var defaultPlugin = markdownLoaderPlugin();
|
|
|
5251
5251
|
import { resolve as resolve3 } from "node:path";
|
|
5252
5252
|
import process4 from "node:process";
|
|
5253
5253
|
var DEFAULT_SKILLS_PATHS = [
|
|
5254
|
-
".
|
|
5254
|
+
".agent/skills"
|
|
5255
5255
|
];
|
|
5256
5256
|
var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
|
|
5257
5257
|
function getGlobalPlugins(skillsPaths) {
|
|
@@ -6037,6 +6037,9 @@ var Protocol = class {
|
|
|
6037
6037
|
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
6038
6038
|
*/
|
|
6039
6039
|
async connect(transport) {
|
|
6040
|
+
if (this._transport) {
|
|
6041
|
+
throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
6042
|
+
}
|
|
6040
6043
|
this._transport = transport;
|
|
6041
6044
|
const _onclose = this.transport?.onclose;
|
|
6042
6045
|
this._transport.onclose = () => {
|
|
@@ -6069,6 +6072,10 @@ var Protocol = class {
|
|
|
6069
6072
|
this._progressHandlers.clear();
|
|
6070
6073
|
this._taskProgressTokens.clear();
|
|
6071
6074
|
this._pendingDebouncedNotifications.clear();
|
|
6075
|
+
for (const controller of this._requestHandlerAbortControllers.values()) {
|
|
6076
|
+
controller.abort();
|
|
6077
|
+
}
|
|
6078
|
+
this._requestHandlerAbortControllers.clear();
|
|
6072
6079
|
const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed");
|
|
6073
6080
|
this._transport = void 0;
|
|
6074
6081
|
this.onclose?.();
|
|
@@ -6119,6 +6126,8 @@ var Protocol = class {
|
|
|
6119
6126
|
sessionId: capturedTransport?.sessionId,
|
|
6120
6127
|
_meta: request.params?._meta,
|
|
6121
6128
|
sendNotification: async (notification) => {
|
|
6129
|
+
if (abortController.signal.aborted)
|
|
6130
|
+
return;
|
|
6122
6131
|
const notificationOptions = { relatedRequestId: request.id };
|
|
6123
6132
|
if (relatedTaskId) {
|
|
6124
6133
|
notificationOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -6126,6 +6135,9 @@ var Protocol = class {
|
|
|
6126
6135
|
await this.notification(notification, notificationOptions);
|
|
6127
6136
|
},
|
|
6128
6137
|
sendRequest: async (r, resultSchema, options) => {
|
|
6138
|
+
if (abortController.signal.aborted) {
|
|
6139
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
6140
|
+
}
|
|
6129
6141
|
const requestOptions = { ...options, relatedRequestId: request.id };
|
|
6130
6142
|
if (relatedTaskId && !requestOptions.relatedTask) {
|
|
6131
6143
|
requestOptions.relatedTask = { taskId: relatedTaskId };
|
|
@@ -10861,7 +10873,8 @@ var ajv = new Ajv2({
|
|
|
10861
10873
|
addFormats.default(ajv);
|
|
10862
10874
|
ajvErrors.default(ajv);
|
|
10863
10875
|
function validateSchema(data, schema) {
|
|
10864
|
-
const
|
|
10876
|
+
const cleanedSchema = cleanToolSchema(schema);
|
|
10877
|
+
const validate = ajv.compile(cleanedSchema);
|
|
10865
10878
|
if (!validate(data)) {
|
|
10866
10879
|
const errors = validate.errors;
|
|
10867
10880
|
const customErrors = errors.filter((err) => err.keyword === "errorMessage");
|
|
@@ -12911,6 +12924,25 @@ var ToolManager = class {
|
|
|
12911
12924
|
execute: tool2.callback
|
|
12912
12925
|
};
|
|
12913
12926
|
}
|
|
12927
|
+
/**
|
|
12928
|
+
* Get all tools as ComposedTool objects with execute callback
|
|
12929
|
+
* Includes both public and internal tools
|
|
12930
|
+
*/
|
|
12931
|
+
getAllComposedTools() {
|
|
12932
|
+
const composedTools = [];
|
|
12933
|
+
for (const [name, tool2] of this.toolRegistry.entries()) {
|
|
12934
|
+
composedTools.push({
|
|
12935
|
+
name,
|
|
12936
|
+
description: tool2.description,
|
|
12937
|
+
inputSchema: tool2.schema ?? {
|
|
12938
|
+
type: "object",
|
|
12939
|
+
properties: {}
|
|
12940
|
+
},
|
|
12941
|
+
execute: tool2.callback
|
|
12942
|
+
});
|
|
12943
|
+
}
|
|
12944
|
+
return composedTools;
|
|
12945
|
+
}
|
|
12914
12946
|
};
|
|
12915
12947
|
|
|
12916
12948
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/schema.js
|
|
@@ -13391,6 +13423,50 @@ var ComposableMCPServer = class extends Server {
|
|
|
13391
13423
|
const publicToolNames = this.getPublicToolNames();
|
|
13392
13424
|
return allToolNames.filter((name) => !publicToolNames.includes(name));
|
|
13393
13425
|
}
|
|
13426
|
+
/**
|
|
13427
|
+
* Get all internal tools with their full metadata (description, schema)
|
|
13428
|
+
* Internal tools are not exposed to MCP clients but available within the agent
|
|
13429
|
+
*/
|
|
13430
|
+
getInternalTools() {
|
|
13431
|
+
const internalNames = this.getInternalToolNames();
|
|
13432
|
+
const registry = this.toolManager.getToolRegistry();
|
|
13433
|
+
return internalNames.map((name) => {
|
|
13434
|
+
const tool2 = registry.get(name);
|
|
13435
|
+
return {
|
|
13436
|
+
name,
|
|
13437
|
+
description: tool2?.description || "",
|
|
13438
|
+
inputSchema: tool2?.schema || {
|
|
13439
|
+
type: "object"
|
|
13440
|
+
}
|
|
13441
|
+
};
|
|
13442
|
+
});
|
|
13443
|
+
}
|
|
13444
|
+
/**
|
|
13445
|
+
* Get a single tool with full details including execute callback
|
|
13446
|
+
* Works for both public and internal tools
|
|
13447
|
+
*/
|
|
13448
|
+
getComposedTool(name) {
|
|
13449
|
+
return this.toolManager.getComposedTool(name);
|
|
13450
|
+
}
|
|
13451
|
+
/**
|
|
13452
|
+
* Get all tools (public and internal) as composed tools with execute callback
|
|
13453
|
+
*/
|
|
13454
|
+
getAllComposedTools() {
|
|
13455
|
+
return this.toolManager.getAllComposedTools();
|
|
13456
|
+
}
|
|
13457
|
+
/**
|
|
13458
|
+
* Get all tools (public and internal) with full details
|
|
13459
|
+
*/
|
|
13460
|
+
getAllTools() {
|
|
13461
|
+
const registry = this.toolManager.getToolRegistry();
|
|
13462
|
+
return Array.from(registry.entries()).map(([name, tool2]) => ({
|
|
13463
|
+
name,
|
|
13464
|
+
description: tool2?.description || "",
|
|
13465
|
+
inputSchema: tool2?.schema || {
|
|
13466
|
+
type: "object"
|
|
13467
|
+
}
|
|
13468
|
+
}));
|
|
13469
|
+
}
|
|
13394
13470
|
/**
|
|
13395
13471
|
* Get hidden tool schema by name (for internal access)
|
|
13396
13472
|
*/
|