@mcpc-tech/cli 0.1.5 → 0.1.6
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/bin/mcpc.mjs +80 -45
- package/package.json +1 -1
- package/types/src/app.d.ts.map +1 -1
- package/types/src/config/loader.d.ts.map +1 -1
package/bin/mcpc.mjs
CHANGED
|
@@ -41,6 +41,56 @@ var init_schema = __esm({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
45
|
+
import process2 from "node:process";
|
|
46
|
+
var GEMINI_PREFERRED_FORMAT;
|
|
47
|
+
var init_config = __esm({
|
|
48
|
+
"__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js"() {
|
|
49
|
+
GEMINI_PREFERRED_FORMAT = process2.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
54
|
+
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
55
|
+
var init_json = __esm({
|
|
56
|
+
"__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js"() {
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/provider.js
|
|
61
|
+
function sanitizePropertyKey(name) {
|
|
62
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, "_").substring(0, 64);
|
|
63
|
+
}
|
|
64
|
+
var createGoogleCompatibleJSONSchema;
|
|
65
|
+
var init_provider = __esm({
|
|
66
|
+
"__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/provider.js"() {
|
|
67
|
+
init_config();
|
|
68
|
+
init_json();
|
|
69
|
+
createGoogleCompatibleJSONSchema = (schema) => {
|
|
70
|
+
if (!GEMINI_PREFERRED_FORMAT) {
|
|
71
|
+
return schema;
|
|
72
|
+
}
|
|
73
|
+
const { oneOf: _oneOf, allOf: _allOf, anyOf: _anyOf, ...cleanSchema } = schema;
|
|
74
|
+
const removeAdditionalProperties = (obj) => {
|
|
75
|
+
if (Array.isArray(obj)) {
|
|
76
|
+
return obj.map(removeAdditionalProperties);
|
|
77
|
+
}
|
|
78
|
+
if (obj && typeof obj === "object") {
|
|
79
|
+
const result = {};
|
|
80
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
81
|
+
if (key !== "additionalProperties") {
|
|
82
|
+
result[key] = removeAdditionalProperties(value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
return obj;
|
|
88
|
+
};
|
|
89
|
+
return removeAdditionalProperties(cleanSchema);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
44
94
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/logger.js
|
|
45
95
|
function createLogger(name, server2) {
|
|
46
96
|
return new MCPLogger(name, server2);
|
|
@@ -167,15 +217,17 @@ var init_tool_name_mapping_plugin = __esm({
|
|
|
167
217
|
transformTool: (tool, context2) => {
|
|
168
218
|
const server2 = context2.server;
|
|
169
219
|
const toolName = context2.toolName;
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
220
|
+
const originalName = tool._originalName || toolName;
|
|
221
|
+
const dotNotation = originalName.replace(/_/g, ".");
|
|
222
|
+
const underscoreNotation = originalName.replace(/\./g, "_");
|
|
223
|
+
if (dotNotation !== originalName && server2.toolNameMapping) {
|
|
173
224
|
server2.toolNameMapping.set(dotNotation, toolName);
|
|
174
|
-
server2.toolNameMapping.set(toolName, dotNotation);
|
|
175
225
|
}
|
|
176
|
-
if (underscoreNotation !==
|
|
226
|
+
if (underscoreNotation !== originalName && server2.toolNameMapping) {
|
|
177
227
|
server2.toolNameMapping.set(underscoreNotation, toolName);
|
|
178
|
-
|
|
228
|
+
}
|
|
229
|
+
if (originalName !== toolName && server2.toolNameMapping) {
|
|
230
|
+
server2.toolNameMapping.set(originalName, toolName);
|
|
179
231
|
}
|
|
180
232
|
return tool;
|
|
181
233
|
}
|
|
@@ -566,7 +618,8 @@ function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicTool
|
|
|
566
618
|
const baseProperties = baseSchema.type === "object" && baseSchema.properties ? baseSchema.properties : {};
|
|
567
619
|
const baseRequired = baseSchema.type === "object" && Array.isArray(baseSchema.required) ? baseSchema.required : [];
|
|
568
620
|
const updatedProperties = updateRefPaths(baseProperties, toolName);
|
|
569
|
-
|
|
621
|
+
const sanitizedKey = sanitizePropertyKey(toolName);
|
|
622
|
+
depGroups[sanitizedKey] = {
|
|
570
623
|
type: "object",
|
|
571
624
|
description: tool.description,
|
|
572
625
|
properties: updatedProperties,
|
|
@@ -591,6 +644,7 @@ var init_compose_helpers = __esm({
|
|
|
591
644
|
"__mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/compose-helpers.js"() {
|
|
592
645
|
init_schema2();
|
|
593
646
|
init_schema();
|
|
647
|
+
init_provider();
|
|
594
648
|
}
|
|
595
649
|
});
|
|
596
650
|
|
|
@@ -775,8 +829,9 @@ function smitheryToolNameCompatibale(name, scope) {
|
|
|
775
829
|
}
|
|
776
830
|
|
|
777
831
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
|
|
832
|
+
init_provider();
|
|
778
833
|
import { cwd } from "node:process";
|
|
779
|
-
import
|
|
834
|
+
import process3 from "node:process";
|
|
780
835
|
import { createHash } from "node:crypto";
|
|
781
836
|
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
782
837
|
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
@@ -822,7 +877,7 @@ async function getOrCreateMcpClient(defKey, def) {
|
|
|
822
877
|
command: def.command,
|
|
823
878
|
args: def.args,
|
|
824
879
|
env: {
|
|
825
|
-
...
|
|
880
|
+
...process3.env,
|
|
826
881
|
...def.env ?? {}
|
|
827
882
|
},
|
|
828
883
|
cwd: cwd()
|
|
@@ -876,11 +931,11 @@ var cleanupAllPooledClients = async () => {
|
|
|
876
931
|
}
|
|
877
932
|
}));
|
|
878
933
|
};
|
|
879
|
-
|
|
934
|
+
process3.once?.("exit", () => {
|
|
880
935
|
cleanupAllPooledClients();
|
|
881
936
|
});
|
|
882
|
-
|
|
883
|
-
cleanupAllPooledClients().finally(() =>
|
|
937
|
+
process3.once?.("SIGINT", () => {
|
|
938
|
+
cleanupAllPooledClients().finally(() => process3.exit(0));
|
|
884
939
|
});
|
|
885
940
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
886
941
|
const allTools = {};
|
|
@@ -898,7 +953,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
898
953
|
const { tools } = await client.listTools();
|
|
899
954
|
tools.forEach((tool) => {
|
|
900
955
|
const { toolNameWithScope, toolName: internalToolName } = smitheryToolNameCompatibale(tool.name, name);
|
|
901
|
-
const
|
|
956
|
+
const rawToolId = `${serverId}_${internalToolName}`;
|
|
957
|
+
const toolId = sanitizePropertyKey(rawToolId);
|
|
902
958
|
if (filterIn && !filterIn({
|
|
903
959
|
action: internalToolName,
|
|
904
960
|
tool,
|
|
@@ -917,7 +973,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
917
973
|
});
|
|
918
974
|
allTools[toolId] = {
|
|
919
975
|
...tool,
|
|
920
|
-
execute
|
|
976
|
+
execute,
|
|
977
|
+
_originalName: toolNameWithScope
|
|
921
978
|
};
|
|
922
979
|
});
|
|
923
980
|
} catch (error) {
|
|
@@ -939,37 +996,7 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
939
996
|
|
|
940
997
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-tool-registrar.js
|
|
941
998
|
init_schema();
|
|
942
|
-
|
|
943
|
-
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
|
|
944
|
-
import process3 from "node:process";
|
|
945
|
-
var GEMINI_PREFERRED_FORMAT = process3.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
946
|
-
|
|
947
|
-
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
|
|
948
|
-
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
949
|
-
|
|
950
|
-
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/provider.js
|
|
951
|
-
var createGoogleCompatibleJSONSchema = (schema) => {
|
|
952
|
-
if (!GEMINI_PREFERRED_FORMAT) {
|
|
953
|
-
return schema;
|
|
954
|
-
}
|
|
955
|
-
const { oneOf: _oneOf, allOf: _allOf, anyOf: _anyOf, ...cleanSchema } = schema;
|
|
956
|
-
const removeAdditionalProperties = (obj) => {
|
|
957
|
-
if (Array.isArray(obj)) {
|
|
958
|
-
return obj.map(removeAdditionalProperties);
|
|
959
|
-
}
|
|
960
|
-
if (obj && typeof obj === "object") {
|
|
961
|
-
const result = {};
|
|
962
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
963
|
-
if (key !== "additionalProperties") {
|
|
964
|
-
result[key] = removeAdditionalProperties(value);
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
return result;
|
|
968
|
-
}
|
|
969
|
-
return obj;
|
|
970
|
-
};
|
|
971
|
-
return removeAdditionalProperties(cleanSchema);
|
|
972
|
-
};
|
|
999
|
+
init_provider();
|
|
973
1000
|
|
|
974
1001
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/prompts/index.js
|
|
975
1002
|
var SystemPrompts = {
|
|
@@ -2639,6 +2666,9 @@ var WorkflowState = class {
|
|
|
2639
2666
|
}
|
|
2640
2667
|
};
|
|
2641
2668
|
|
|
2669
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-tool-registrar.js
|
|
2670
|
+
init_provider();
|
|
2671
|
+
|
|
2642
2672
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/workflow/workflow-executor.js
|
|
2643
2673
|
import { Ajv as Ajv3 } from "ajv";
|
|
2644
2674
|
import { AggregateAjvError as AggregateAjvError3 } from "@segment/ajv-human-errors";
|
|
@@ -3110,6 +3140,8 @@ function processToolTags({ description, tagToResults, $, tools, toolOverrides, t
|
|
|
3110
3140
|
const toolId = findToolId(toolName, tools, toolNameMapping);
|
|
3111
3141
|
if (toolId) {
|
|
3112
3142
|
$(toolEl).replaceWith(`<action action="${toolId}"/>`);
|
|
3143
|
+
} else {
|
|
3144
|
+
$(toolEl).remove();
|
|
3113
3145
|
}
|
|
3114
3146
|
}
|
|
3115
3147
|
});
|
|
@@ -3868,6 +3900,9 @@ if (isSCF()) {
|
|
|
3868
3900
|
});
|
|
3869
3901
|
}
|
|
3870
3902
|
|
|
3903
|
+
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/mod.js
|
|
3904
|
+
init_json();
|
|
3905
|
+
|
|
3871
3906
|
// __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/set-up-mcp-compose.js
|
|
3872
3907
|
function parseMcpcConfigs(conf) {
|
|
3873
3908
|
const mcpcConfigs = conf ?? [];
|
package/package.json
CHANGED
package/types/src/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAI5D,cAAc,mBAAmB,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sources":["../../src/app.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,4BAAwC;AAI5D,cAAc,mBAAmB,0BAAmD;AACpF,cAAc,UAAU,6BAA6B;AAErD,OAAO,cAAM,eACX,SAAS,eACR,QAAQ,qBA8BT;AAEF,OAAO,cAAM,iBAAgB,YAO3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sources":["../../../src/config/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CC,GAED,cAAc,iBAAiB,0BAAgC;AAK/D,iBAAiB;EACf;;GAEC,GACD,OAAO,MAAM;EACb;;GAEC,GACD,UAAU,MAAM;EAChB;;GAEC,GACD;IACE,QAAQ,OAAO,MAAM,EAAE,OAAO;IAC9B,WAAW,OAAO,MAAM,EAAE,OAAO;;EAEnC;;GAEC,GACD,QAAQ;;AAwHV;;;CAGC,GACD,OAAO,iBAAe,cAAc,QAAQ,aAAa,IAAI;AAoK7D;;CAEC,GACD,OAAO,iBAAS,eAAe,QAAQ,UAAU,GAAG,IAAI"}
|