@mcpc-tech/core 0.2.10 → 0.2.12
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 +58 -13
- package/package.json +1 -1
- package/types/src/compose.d.ts +3 -0
- package/types/src/compose.d.ts.map +1 -1
package/index.mjs
CHANGED
|
@@ -92,7 +92,7 @@ var init_json = __esm({
|
|
|
92
92
|
|
|
93
93
|
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/provider.js
|
|
94
94
|
function sanitizePropertyKey(name) {
|
|
95
|
-
return name.replace(/[
|
|
95
|
+
return name.replace(/[@.,/\\:;!?#$%^&*()[\]{}]/g, "_").substring(0, 64);
|
|
96
96
|
}
|
|
97
97
|
var createGoogleCompatibleJSONSchema;
|
|
98
98
|
var init_provider = __esm({
|
|
@@ -284,12 +284,21 @@ var init_logging_plugin = __esm({
|
|
|
284
284
|
const { stats } = context2;
|
|
285
285
|
const server = context2.server;
|
|
286
286
|
const publicTools = Array.from(new Set(server.getPublicToolNames().map(String)));
|
|
287
|
+
const internalTools = Array.from(new Set(server.getInternalToolNames().map(String)));
|
|
287
288
|
const hiddenTools = Array.from(new Set(server.getHiddenToolNames().map(String)));
|
|
289
|
+
const normalInternal = internalTools.filter((name) => !hiddenTools.includes(name));
|
|
288
290
|
if (publicTools.length > 0) {
|
|
289
291
|
await logger2.info(` \u251C\u2500 Public: ${publicTools.join(", ")}`);
|
|
290
292
|
}
|
|
291
|
-
if (
|
|
292
|
-
|
|
293
|
+
if (internalTools.length > 0) {
|
|
294
|
+
const parts = [];
|
|
295
|
+
if (normalInternal.length > 0) {
|
|
296
|
+
parts.push(normalInternal.join(", "));
|
|
297
|
+
}
|
|
298
|
+
if (hiddenTools.length > 0) {
|
|
299
|
+
parts.push(`(${hiddenTools.join(", ")})`);
|
|
300
|
+
}
|
|
301
|
+
await logger2.info(` \u251C\u2500 Internal: ${parts.join(", ")}`);
|
|
293
302
|
}
|
|
294
303
|
await logger2.info(` \u2514\u2500 Total: ${stats.totalTools} tools`);
|
|
295
304
|
}
|
|
@@ -3397,6 +3406,7 @@ var PluginManager = class {
|
|
|
3397
3406
|
};
|
|
3398
3407
|
|
|
3399
3408
|
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/tool-manager.js
|
|
3409
|
+
init_schema();
|
|
3400
3410
|
var ToolManager = class {
|
|
3401
3411
|
toolRegistry = /* @__PURE__ */ new Map();
|
|
3402
3412
|
toolConfigs = /* @__PURE__ */ new Map();
|
|
@@ -3581,6 +3591,25 @@ var ToolManager = class {
|
|
|
3581
3591
|
getToolRegistry() {
|
|
3582
3592
|
return this.toolRegistry;
|
|
3583
3593
|
}
|
|
3594
|
+
/**
|
|
3595
|
+
* Get all registered tools as ComposedTool objects
|
|
3596
|
+
* This includes tools registered via server.tool() in setup hooks
|
|
3597
|
+
*/
|
|
3598
|
+
getRegisteredToolsAsComposed() {
|
|
3599
|
+
const composedTools = {};
|
|
3600
|
+
for (const [name, tool] of this.toolRegistry.entries()) {
|
|
3601
|
+
composedTools[name] = {
|
|
3602
|
+
name,
|
|
3603
|
+
description: tool.description,
|
|
3604
|
+
inputSchema: jsonSchema(tool.schema || {
|
|
3605
|
+
type: "object",
|
|
3606
|
+
properties: {}
|
|
3607
|
+
}),
|
|
3608
|
+
execute: tool.callback
|
|
3609
|
+
};
|
|
3610
|
+
}
|
|
3611
|
+
return composedTools;
|
|
3612
|
+
}
|
|
3584
3613
|
};
|
|
3585
3614
|
|
|
3586
3615
|
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
@@ -3743,6 +3772,14 @@ var ComposableMCPServer = class extends Server {
|
|
|
3743
3772
|
getHiddenToolNames() {
|
|
3744
3773
|
return this.toolManager.getHiddenToolNames();
|
|
3745
3774
|
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Get all internal tool names (tools that are not public)
|
|
3777
|
+
*/
|
|
3778
|
+
getInternalToolNames() {
|
|
3779
|
+
const allToolNames = Array.from(this.toolManager.getToolRegistry().keys());
|
|
3780
|
+
const publicToolNames = this.getPublicToolNames();
|
|
3781
|
+
return allToolNames.filter((name) => !publicToolNames.includes(name));
|
|
3782
|
+
}
|
|
3746
3783
|
/**
|
|
3747
3784
|
* Get hidden tool schema by name (for internal access)
|
|
3748
3785
|
*/
|
|
@@ -3845,7 +3882,6 @@ var ComposableMCPServer = class extends Server {
|
|
|
3845
3882
|
availableToolNames.add(toolNameWithScope);
|
|
3846
3883
|
availableToolNames.add(toolId);
|
|
3847
3884
|
availableToolNames.add(`${mcpName}.${ALL_TOOLS_PLACEHOLDER2}`);
|
|
3848
|
-
availableToolNames.add(mcpName);
|
|
3849
3885
|
this.toolManager.setToolNameMapping(toolNameWithScope, toolId);
|
|
3850
3886
|
const internalName = toolNameWithScope.includes(".") ? toolNameWithScope.split(".").slice(1).join(".") : toolNameWithScope;
|
|
3851
3887
|
if (!this.toolNameMapping.has(internalName)) {
|
|
@@ -3876,14 +3912,23 @@ var ComposableMCPServer = class extends Server {
|
|
|
3876
3912
|
await this.logger.warning(` Available tools: ${Array.from(availableToolNames).sort().join(", ")}`);
|
|
3877
3913
|
}
|
|
3878
3914
|
Object.entries(tools).forEach(([toolId, tool]) => {
|
|
3879
|
-
this.toolManager.registerTool(toolId, tool.description || "
|
|
3915
|
+
this.toolManager.registerTool(toolId, tool.description || "", tool.inputSchema, tool.execute);
|
|
3880
3916
|
});
|
|
3881
|
-
|
|
3882
|
-
|
|
3917
|
+
const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
|
|
3918
|
+
const allTools = {
|
|
3919
|
+
...tools
|
|
3920
|
+
};
|
|
3921
|
+
for (const [toolName, tool] of Object.entries(registeredTools)) {
|
|
3922
|
+
if (!allTools[toolName]) {
|
|
3923
|
+
allTools[toolName] = tool;
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
await this.processToolsWithPlugins(allTools, options.mode ?? "agentic");
|
|
3927
|
+
await this.pluginManager.triggerFinalizeComposition(allTools, {
|
|
3883
3928
|
serverName: name ?? "anonymous",
|
|
3884
3929
|
mode: options.mode ?? "agentic",
|
|
3885
3930
|
server: this,
|
|
3886
|
-
toolNames: Object.keys(
|
|
3931
|
+
toolNames: Object.keys(allTools)
|
|
3887
3932
|
});
|
|
3888
3933
|
this.onclose = async () => {
|
|
3889
3934
|
await cleanupClients();
|
|
@@ -3896,16 +3941,16 @@ var ComposableMCPServer = class extends Server {
|
|
|
3896
3941
|
await this.disposePlugins();
|
|
3897
3942
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
3898
3943
|
};
|
|
3899
|
-
const toolNameToDetailList = Object.entries(
|
|
3944
|
+
const toolNameToDetailList = Object.entries(allTools);
|
|
3900
3945
|
const publicToolNames = this.getPublicToolNames();
|
|
3901
3946
|
const hiddenToolNames = this.getHiddenToolNames();
|
|
3902
3947
|
const contextToolNames = toolNameToDetailList.map(([name2]) => name2).filter((n) => !hiddenToolNames.includes(n));
|
|
3903
3948
|
publicToolNames.forEach((toolId) => {
|
|
3904
|
-
const tool =
|
|
3949
|
+
const tool = allTools[toolId];
|
|
3905
3950
|
if (!tool) {
|
|
3906
|
-
throw new Error(`Public tool ${toolId} not found in registry, available: ${Object.keys(
|
|
3951
|
+
throw new Error(`Public tool ${toolId} not found in registry, available: ${Object.keys(allTools).join(", ")}`);
|
|
3907
3952
|
}
|
|
3908
|
-
this.tool(toolId, tool.description || "
|
|
3953
|
+
this.tool(toolId, tool.description || "", jsonSchema(tool.inputSchema), tool.execute, {
|
|
3909
3954
|
internal: false
|
|
3910
3955
|
});
|
|
3911
3956
|
});
|
|
@@ -3930,7 +3975,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
3930
3975
|
description = processToolTags({
|
|
3931
3976
|
...desTags,
|
|
3932
3977
|
description,
|
|
3933
|
-
tools,
|
|
3978
|
+
tools: allTools,
|
|
3934
3979
|
toolOverrides: /* @__PURE__ */ new Map(),
|
|
3935
3980
|
toolNameMapping: toolNameToIdMapping
|
|
3936
3981
|
});
|
package/package.json
CHANGED
package/types/src/compose.d.ts
CHANGED
|
@@ -39,6 +39,9 @@ export declare class ComposableMCPServer extends Server {
|
|
|
39
39
|
/**
|
|
40
40
|
* Get all hidden tool names
|
|
41
41
|
*/ getHiddenToolNames(): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get all internal tool names (tools that are not public)
|
|
44
|
+
*/ getInternalToolNames(): string[];
|
|
42
45
|
/**
|
|
43
46
|
* Get hidden tool schema by name (for internal access)
|
|
44
47
|
*/ getHiddenToolSchema(name: string): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sources":["../../src/compose.ts"],"names":[],"mappings":"AAAA,SAGE,KAAK,cAAc,EAGnB,KAAK,IAAI,6CAC6C;AACxD,SAAwC,KAAK,MAAM,4BAA4B;AAC/E,cAAc,iBAAiB,6BAA6B;AAC5D,SACE,MAAM,EACN,KAAK,aAAa,oDAC2C;AAC/D,YAAY,aAAyB;AAGrC,cAAc,iBAAiB,kCAAkC;AACjE,cAAc,UAAU,EAAE,YAAY,qBAAqB;AAQ3D,cAA4B,UAAU,EAAE,UAAU,4BAA4B;AAU9E,OAAO,cAAM,4BAA4B;EACvC,QAAQ,mBAA6B;EACrC,QAAQ,iBAAyB;EACjC,QAAQ,YAAsC;EAG9C,IAAI,mBAAmB,IAAI,MAAM,EAAE,MAAM;EAIzC,YAAY,aAAa,cAAc,EAAE,SAAS,aAAa;EAiB/D;;GAEC,GACD,AAAM,sBAAsB,QAAQ,IAAI;UAqB1B;UAwDN;EAIR,KAAK,GACH,MAAM,MAAM,EACZ,aAAa,MAAM,EACnB,cAAc,OAAO,KAAK,UAAU,EACpC,KAAK,MAAM,GAAG,QAAQ,OAAO,KAAK,OAAO,EACzC;IAAW,WAAW,OAAO;IAAE,UAAU;GAAmB;EAqE9D;;GAEC,GACD,gBAAgB,MAAM,MAAM,GAAG,eAAe,SAAS;EAIvD;;GAEC,GACD,eAAe,QAAQ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