@mcpc-tech/core 0.2.3 → 0.2.5
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/README.md +3 -0
- package/index.mjs +175 -146
- package/package.json +1 -1
- package/plugins/large-result.mjs +5 -5
- package/plugins/search.mjs +3 -3
- package/plugins.mjs +4 -4
- package/types/src/ai-sdk-adapter.d.ts +14 -20
- package/types/src/ai-sdk-adapter.d.ts.map +1 -1
- package/types/src/utils/common/mcp.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @mcpc/core
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@mcpc-tech/core)
|
|
4
|
+
[](https://jsr.io/@mcpc/core)
|
|
5
|
+
|
|
3
6
|
**Build agentic MCP servers by composing existing MCP tools.**
|
|
4
7
|
|
|
5
8
|
The core SDK for creating agentic Model Context Protocol (MCP) servers. Compose
|
package/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var __export = (target, all) => {
|
|
|
11
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/schema.js
|
|
15
15
|
function jsonSchema(schema, options = {}) {
|
|
16
16
|
if (isWrappedSchema(schema)) {
|
|
17
17
|
return schema;
|
|
@@ -35,19 +35,102 @@ function extractJsonSchema(schema) {
|
|
|
35
35
|
}
|
|
36
36
|
var schemaSymbol, validatorSymbol;
|
|
37
37
|
var init_schema = __esm({
|
|
38
|
-
"
|
|
38
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/schema.js"() {
|
|
39
39
|
schemaSymbol = Symbol.for("mcpc.schema");
|
|
40
40
|
validatorSymbol = Symbol.for("mcpc.validator");
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
//
|
|
44
|
+
// __mcpc__core_latest/node_modules/@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__core_latest/node_modules/@mcpc/core/src/utils/common/config.js"() {
|
|
49
|
+
GEMINI_PREFERRED_FORMAT = process2.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/json.js
|
|
54
|
+
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
55
|
+
import { inspect } from "node:util";
|
|
56
|
+
function parseJSON2(text, throwError) {
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(text);
|
|
59
|
+
} catch (_error) {
|
|
60
|
+
try {
|
|
61
|
+
const repairedText = jsonrepair2(text);
|
|
62
|
+
console.warn(`Failed to parse JSON, attempting to repair, result: ${text}`);
|
|
63
|
+
if (throwError) {
|
|
64
|
+
throw _error;
|
|
65
|
+
}
|
|
66
|
+
return JSON.parse(repairedText);
|
|
67
|
+
} catch {
|
|
68
|
+
if (throwError) {
|
|
69
|
+
throw new Error("Failed to parse repaired JSON");
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function truncateJSON(obj) {
|
|
76
|
+
return inspect(obj, {
|
|
77
|
+
depth: 3,
|
|
78
|
+
colors: false,
|
|
79
|
+
maxStringLength: 120
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function optionalObject(obj, condition) {
|
|
83
|
+
if (condition) {
|
|
84
|
+
return obj;
|
|
85
|
+
}
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
var init_json = __esm({
|
|
89
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/json.js"() {
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/provider.js
|
|
94
|
+
function sanitizePropertyKey(name) {
|
|
95
|
+
return name.replace(/[^a-zA-Z0-9_-]/g, "_").substring(0, 64);
|
|
96
|
+
}
|
|
97
|
+
var createGoogleCompatibleJSONSchema;
|
|
98
|
+
var init_provider = __esm({
|
|
99
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/provider.js"() {
|
|
100
|
+
init_config();
|
|
101
|
+
init_json();
|
|
102
|
+
createGoogleCompatibleJSONSchema = (schema) => {
|
|
103
|
+
if (!GEMINI_PREFERRED_FORMAT) {
|
|
104
|
+
return schema;
|
|
105
|
+
}
|
|
106
|
+
const { oneOf: _oneOf, allOf: _allOf, anyOf: _anyOf, ...cleanSchema } = schema;
|
|
107
|
+
const removeAdditionalProperties = (obj) => {
|
|
108
|
+
if (Array.isArray(obj)) {
|
|
109
|
+
return obj.map(removeAdditionalProperties);
|
|
110
|
+
}
|
|
111
|
+
if (obj && typeof obj === "object") {
|
|
112
|
+
const result = {};
|
|
113
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
114
|
+
if (key !== "additionalProperties") {
|
|
115
|
+
result[key] = removeAdditionalProperties(value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
return obj;
|
|
121
|
+
};
|
|
122
|
+
return removeAdditionalProperties(cleanSchema);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/logger.js
|
|
45
128
|
function createLogger(name, server) {
|
|
46
129
|
return new MCPLogger(name, server);
|
|
47
130
|
}
|
|
48
131
|
var LOG_LEVELS, MCPLogger, logger;
|
|
49
132
|
var init_logger = __esm({
|
|
50
|
-
"
|
|
133
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/logger.js"() {
|
|
51
134
|
LOG_LEVELS = {
|
|
52
135
|
debug: 0,
|
|
53
136
|
info: 1,
|
|
@@ -90,16 +173,8 @@ var init_logger = __esm({
|
|
|
90
173
|
}
|
|
91
174
|
logToConsole(level, data) {
|
|
92
175
|
const message = typeof data === "string" ? data : JSON.stringify(data);
|
|
93
|
-
const prefix = `[${this.loggerName}]`;
|
|
94
|
-
|
|
95
|
-
console.debug(prefix, message);
|
|
96
|
-
} else if (level === "info" || level === "notice") {
|
|
97
|
-
console.info(prefix, message);
|
|
98
|
-
} else if (level === "warning") {
|
|
99
|
-
console.warn(prefix, message);
|
|
100
|
-
} else {
|
|
101
|
-
console.error(prefix, message);
|
|
102
|
-
}
|
|
176
|
+
const prefix = `[${this.loggerName}:${level}]`;
|
|
177
|
+
console.error(prefix, message);
|
|
103
178
|
}
|
|
104
179
|
debug(data) {
|
|
105
180
|
return this.log("debug", data);
|
|
@@ -135,10 +210,10 @@ var init_logger = __esm({
|
|
|
135
210
|
}
|
|
136
211
|
});
|
|
137
212
|
|
|
138
|
-
//
|
|
213
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/config-plugin.js
|
|
139
214
|
var createConfigPlugin, config_plugin_default;
|
|
140
215
|
var init_config_plugin = __esm({
|
|
141
|
-
"
|
|
216
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/config-plugin.js"() {
|
|
142
217
|
createConfigPlugin = () => ({
|
|
143
218
|
name: "built-in-config",
|
|
144
219
|
version: "1.0.0",
|
|
@@ -156,10 +231,10 @@ var init_config_plugin = __esm({
|
|
|
156
231
|
}
|
|
157
232
|
});
|
|
158
233
|
|
|
159
|
-
//
|
|
234
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/tool-name-mapping-plugin.js
|
|
160
235
|
var createToolNameMappingPlugin, tool_name_mapping_plugin_default;
|
|
161
236
|
var init_tool_name_mapping_plugin = __esm({
|
|
162
|
-
"
|
|
237
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/tool-name-mapping-plugin.js"() {
|
|
163
238
|
createToolNameMappingPlugin = () => ({
|
|
164
239
|
name: "built-in-tool-name-mapping",
|
|
165
240
|
version: "1.0.0",
|
|
@@ -167,15 +242,17 @@ var init_tool_name_mapping_plugin = __esm({
|
|
|
167
242
|
transformTool: (tool, context2) => {
|
|
168
243
|
const server = context2.server;
|
|
169
244
|
const toolName = context2.toolName;
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
245
|
+
const originalName = tool._originalName || toolName;
|
|
246
|
+
const dotNotation = originalName.replace(/_/g, ".");
|
|
247
|
+
const underscoreNotation = originalName.replace(/\./g, "_");
|
|
248
|
+
if (dotNotation !== originalName && server.toolNameMapping) {
|
|
173
249
|
server.toolNameMapping.set(dotNotation, toolName);
|
|
174
|
-
server.toolNameMapping.set(toolName, dotNotation);
|
|
175
250
|
}
|
|
176
|
-
if (underscoreNotation !==
|
|
251
|
+
if (underscoreNotation !== originalName && server.toolNameMapping) {
|
|
177
252
|
server.toolNameMapping.set(underscoreNotation, toolName);
|
|
178
|
-
|
|
253
|
+
}
|
|
254
|
+
if (originalName !== toolName && server.toolNameMapping) {
|
|
255
|
+
server.toolNameMapping.set(originalName, toolName);
|
|
179
256
|
}
|
|
180
257
|
return tool;
|
|
181
258
|
}
|
|
@@ -184,10 +261,10 @@ var init_tool_name_mapping_plugin = __esm({
|
|
|
184
261
|
}
|
|
185
262
|
});
|
|
186
263
|
|
|
187
|
-
//
|
|
264
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/logging-plugin.js
|
|
188
265
|
var createLoggingPlugin, logging_plugin_default;
|
|
189
266
|
var init_logging_plugin = __esm({
|
|
190
|
-
"
|
|
267
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/logging-plugin.js"() {
|
|
191
268
|
init_logger();
|
|
192
269
|
createLoggingPlugin = (options = {}) => {
|
|
193
270
|
const { enabled = true, verbose = false, compact: compact2 = true } = options;
|
|
@@ -226,7 +303,7 @@ var init_logging_plugin = __esm({
|
|
|
226
303
|
}
|
|
227
304
|
});
|
|
228
305
|
|
|
229
|
-
//
|
|
306
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/index.js
|
|
230
307
|
var built_in_exports = {};
|
|
231
308
|
__export(built_in_exports, {
|
|
232
309
|
createConfigPlugin: () => createConfigPlugin,
|
|
@@ -242,7 +319,7 @@ function getBuiltInPlugins() {
|
|
|
242
319
|
];
|
|
243
320
|
}
|
|
244
321
|
var init_built_in = __esm({
|
|
245
|
-
"
|
|
322
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/index.js"() {
|
|
246
323
|
init_config_plugin();
|
|
247
324
|
init_tool_name_mapping_plugin();
|
|
248
325
|
init_logging_plugin();
|
|
@@ -252,7 +329,7 @@ var init_built_in = __esm({
|
|
|
252
329
|
}
|
|
253
330
|
});
|
|
254
331
|
|
|
255
|
-
//
|
|
332
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugin-utils.js
|
|
256
333
|
var plugin_utils_exports = {};
|
|
257
334
|
__export(plugin_utils_exports, {
|
|
258
335
|
checkCircularDependencies: () => checkCircularDependencies,
|
|
@@ -459,12 +536,12 @@ function validatePlugins(plugins) {
|
|
|
459
536
|
}
|
|
460
537
|
var pluginCache;
|
|
461
538
|
var init_plugin_utils = __esm({
|
|
462
|
-
"
|
|
539
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugin-utils.js"() {
|
|
463
540
|
pluginCache = /* @__PURE__ */ new Map();
|
|
464
541
|
}
|
|
465
542
|
});
|
|
466
543
|
|
|
467
|
-
//
|
|
544
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/schema.js
|
|
468
545
|
import traverse from "json-schema-traverse";
|
|
469
546
|
function updateRefPaths(schema, wrapperPath) {
|
|
470
547
|
if (!schema || typeof schema !== "object") {
|
|
@@ -496,11 +573,11 @@ function updateRefPaths(schema, wrapperPath) {
|
|
|
496
573
|
return clonedSchema;
|
|
497
574
|
}
|
|
498
575
|
var init_schema2 = __esm({
|
|
499
|
-
"
|
|
576
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/schema.js"() {
|
|
500
577
|
}
|
|
501
578
|
});
|
|
502
579
|
|
|
503
|
-
//
|
|
580
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/compose-helpers.js
|
|
504
581
|
var compose_helpers_exports = {};
|
|
505
582
|
__export(compose_helpers_exports, {
|
|
506
583
|
buildDependencyGroups: () => buildDependencyGroups,
|
|
@@ -566,7 +643,8 @@ function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicTool
|
|
|
566
643
|
const baseProperties = baseSchema.type === "object" && baseSchema.properties ? baseSchema.properties : {};
|
|
567
644
|
const baseRequired = baseSchema.type === "object" && Array.isArray(baseSchema.required) ? baseSchema.required : [];
|
|
568
645
|
const updatedProperties = updateRefPaths(baseProperties, toolName);
|
|
569
|
-
|
|
646
|
+
const sanitizedKey = sanitizePropertyKey(toolName);
|
|
647
|
+
depGroups[sanitizedKey] = {
|
|
570
648
|
type: "object",
|
|
571
649
|
description: tool.description,
|
|
572
650
|
properties: updatedProperties,
|
|
@@ -588,18 +666,19 @@ function registerGlobalTools(globalToolNames, tools, server) {
|
|
|
588
666
|
});
|
|
589
667
|
}
|
|
590
668
|
var init_compose_helpers = __esm({
|
|
591
|
-
"
|
|
669
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/compose-helpers.js"() {
|
|
592
670
|
init_schema2();
|
|
593
671
|
init_schema();
|
|
672
|
+
init_provider();
|
|
594
673
|
}
|
|
595
674
|
});
|
|
596
675
|
|
|
597
|
-
//
|
|
676
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
598
677
|
init_schema();
|
|
599
678
|
import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
600
679
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
601
680
|
|
|
602
|
-
//
|
|
681
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/json.js
|
|
603
682
|
import { jsonrepair } from "jsonrepair";
|
|
604
683
|
function stripMarkdownAndText(text) {
|
|
605
684
|
text = text.trim();
|
|
@@ -634,7 +713,7 @@ function parseJSON(text, throwError) {
|
|
|
634
713
|
}
|
|
635
714
|
}
|
|
636
715
|
|
|
637
|
-
//
|
|
716
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/ai.js
|
|
638
717
|
var p = (template, options = {}) => {
|
|
639
718
|
const { missingVariableHandling = "warn" } = options;
|
|
640
719
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -670,7 +749,7 @@ var p = (template, options = {}) => {
|
|
|
670
749
|
};
|
|
671
750
|
};
|
|
672
751
|
|
|
673
|
-
//
|
|
752
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/tool-tags.js
|
|
674
753
|
import { load } from "cheerio";
|
|
675
754
|
function parseTags(htmlString, tags) {
|
|
676
755
|
const $ = load(htmlString, {
|
|
@@ -689,10 +768,10 @@ function parseTags(htmlString, tags) {
|
|
|
689
768
|
};
|
|
690
769
|
}
|
|
691
770
|
|
|
692
|
-
//
|
|
771
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/transport/sse.js
|
|
693
772
|
import { JSONRPCMessageSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
694
773
|
|
|
695
|
-
//
|
|
774
|
+
// __mcpc__core_latest/node_modules/@jsr/std__http/server_sent_event_stream.js
|
|
696
775
|
var NEWLINE_REGEXP = /\r\n|\r|\n/;
|
|
697
776
|
var encoder = new TextEncoder();
|
|
698
777
|
function assertHasNoNewline(value, varName, errPrefix) {
|
|
@@ -730,13 +809,13 @@ var ServerSentEventStream = class extends TransformStream {
|
|
|
730
809
|
}
|
|
731
810
|
};
|
|
732
811
|
|
|
733
|
-
//
|
|
812
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/mcp.js
|
|
734
813
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
735
814
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
736
815
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
737
816
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
738
817
|
|
|
739
|
-
//
|
|
818
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/registory.js
|
|
740
819
|
function connectToSmitheryServer(smitheryConfig) {
|
|
741
820
|
const serverUrl = new URL(smitheryConfig.deploymentUrl);
|
|
742
821
|
serverUrl.searchParams.set("config", btoa(JSON.stringify(smitheryConfig.config)));
|
|
@@ -761,9 +840,10 @@ function smitheryToolNameCompatibale(name, scope) {
|
|
|
761
840
|
};
|
|
762
841
|
}
|
|
763
842
|
|
|
764
|
-
//
|
|
843
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/mcp.js
|
|
844
|
+
init_provider();
|
|
765
845
|
import { cwd } from "node:process";
|
|
766
|
-
import
|
|
846
|
+
import process3 from "node:process";
|
|
767
847
|
import { createHash } from "node:crypto";
|
|
768
848
|
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
769
849
|
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
@@ -809,7 +889,7 @@ async function getOrCreateMcpClient(defKey, def) {
|
|
|
809
889
|
command: def.command,
|
|
810
890
|
args: def.args,
|
|
811
891
|
env: {
|
|
812
|
-
...
|
|
892
|
+
...process3.env,
|
|
813
893
|
...def.env ?? {}
|
|
814
894
|
},
|
|
815
895
|
cwd: cwd()
|
|
@@ -863,11 +943,11 @@ var cleanupAllPooledClients = async () => {
|
|
|
863
943
|
}
|
|
864
944
|
}));
|
|
865
945
|
};
|
|
866
|
-
|
|
946
|
+
process3.once?.("exit", () => {
|
|
867
947
|
cleanupAllPooledClients();
|
|
868
948
|
});
|
|
869
|
-
|
|
870
|
-
cleanupAllPooledClients().finally(() =>
|
|
949
|
+
process3.once?.("SIGINT", () => {
|
|
950
|
+
cleanupAllPooledClients().finally(() => process3.exit(0));
|
|
871
951
|
});
|
|
872
952
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
873
953
|
const allTools = {};
|
|
@@ -885,7 +965,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
885
965
|
const { tools } = await client.listTools();
|
|
886
966
|
tools.forEach((tool) => {
|
|
887
967
|
const { toolNameWithScope, toolName: internalToolName } = smitheryToolNameCompatibale(tool.name, name);
|
|
888
|
-
const
|
|
968
|
+
const rawToolId = `${serverId}_${internalToolName}`;
|
|
969
|
+
const toolId = sanitizePropertyKey(rawToolId);
|
|
889
970
|
if (filterIn && !filterIn({
|
|
890
971
|
action: internalToolName,
|
|
891
972
|
tool,
|
|
@@ -904,7 +985,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
904
985
|
});
|
|
905
986
|
allTools[toolId] = {
|
|
906
987
|
...tool,
|
|
907
|
-
execute
|
|
988
|
+
execute,
|
|
989
|
+
_originalName: toolNameWithScope
|
|
908
990
|
};
|
|
909
991
|
});
|
|
910
992
|
} catch (error) {
|
|
@@ -924,74 +1006,11 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
924
1006
|
};
|
|
925
1007
|
}
|
|
926
1008
|
|
|
927
|
-
//
|
|
1009
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-tool-registrar.js
|
|
928
1010
|
init_schema();
|
|
1011
|
+
init_provider();
|
|
929
1012
|
|
|
930
|
-
//
|
|
931
|
-
import process3 from "node:process";
|
|
932
|
-
var GEMINI_PREFERRED_FORMAT = process3.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
|
|
933
|
-
|
|
934
|
-
// ../__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/json.js
|
|
935
|
-
import { jsonrepair as jsonrepair2 } from "jsonrepair";
|
|
936
|
-
import { inspect } from "node:util";
|
|
937
|
-
function parseJSON2(text, throwError) {
|
|
938
|
-
try {
|
|
939
|
-
return JSON.parse(text);
|
|
940
|
-
} catch (_error) {
|
|
941
|
-
try {
|
|
942
|
-
const repairedText = jsonrepair2(text);
|
|
943
|
-
console.warn(`Failed to parse JSON, attempting to repair, result: ${text}`);
|
|
944
|
-
if (throwError) {
|
|
945
|
-
throw _error;
|
|
946
|
-
}
|
|
947
|
-
return JSON.parse(repairedText);
|
|
948
|
-
} catch {
|
|
949
|
-
if (throwError) {
|
|
950
|
-
throw new Error("Failed to parse repaired JSON");
|
|
951
|
-
}
|
|
952
|
-
return null;
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
function truncateJSON(obj) {
|
|
957
|
-
return inspect(obj, {
|
|
958
|
-
depth: 3,
|
|
959
|
-
colors: false,
|
|
960
|
-
maxStringLength: 120
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
function optionalObject(obj, condition) {
|
|
964
|
-
if (condition) {
|
|
965
|
-
return obj;
|
|
966
|
-
}
|
|
967
|
-
return {};
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
// ../__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/provider.js
|
|
971
|
-
var createGoogleCompatibleJSONSchema = (schema) => {
|
|
972
|
-
if (!GEMINI_PREFERRED_FORMAT) {
|
|
973
|
-
return schema;
|
|
974
|
-
}
|
|
975
|
-
const { oneOf: _oneOf, allOf: _allOf, anyOf: _anyOf, ...cleanSchema } = schema;
|
|
976
|
-
const removeAdditionalProperties = (obj) => {
|
|
977
|
-
if (Array.isArray(obj)) {
|
|
978
|
-
return obj.map(removeAdditionalProperties);
|
|
979
|
-
}
|
|
980
|
-
if (obj && typeof obj === "object") {
|
|
981
|
-
const result = {};
|
|
982
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
983
|
-
if (key !== "additionalProperties") {
|
|
984
|
-
result[key] = removeAdditionalProperties(value);
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
return result;
|
|
988
|
-
}
|
|
989
|
-
return obj;
|
|
990
|
-
};
|
|
991
|
-
return removeAdditionalProperties(cleanSchema);
|
|
992
|
-
};
|
|
993
|
-
|
|
994
|
-
// ../__mcpc__core_latest/node_modules/@mcpc/core/src/prompts/index.js
|
|
1013
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/prompts/index.js
|
|
995
1014
|
var SystemPrompts = {
|
|
996
1015
|
/**
|
|
997
1016
|
* Base system prompt for autonomous MCP execution
|
|
@@ -1333,13 +1352,13 @@ ${JSON.stringify(steps, null, 2)}`;
|
|
|
1333
1352
|
}
|
|
1334
1353
|
};
|
|
1335
1354
|
|
|
1336
|
-
//
|
|
1355
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-executor.js
|
|
1337
1356
|
import { Ajv } from "ajv";
|
|
1338
1357
|
import { AggregateAjvError } from "@segment/ajv-human-errors";
|
|
1339
1358
|
import addFormats from "ajv-formats";
|
|
1340
1359
|
init_logger();
|
|
1341
1360
|
|
|
1342
|
-
//
|
|
1361
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/tracing.js
|
|
1343
1362
|
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
1344
1363
|
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
1345
1364
|
import { BatchSpanProcessor, ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
@@ -1406,7 +1425,7 @@ function endSpan(span, error) {
|
|
|
1406
1425
|
span.end();
|
|
1407
1426
|
}
|
|
1408
1427
|
|
|
1409
|
-
//
|
|
1428
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-executor.js
|
|
1410
1429
|
import process4 from "node:process";
|
|
1411
1430
|
var ajv = new Ajv({
|
|
1412
1431
|
allErrors: true,
|
|
@@ -1661,7 +1680,7 @@ var AgenticExecutor = class {
|
|
|
1661
1680
|
}
|
|
1662
1681
|
};
|
|
1663
1682
|
|
|
1664
|
-
//
|
|
1683
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partial.js
|
|
1665
1684
|
function partial(func, ...partialArgs) {
|
|
1666
1685
|
return partialImpl(func, placeholderSymbol, ...partialArgs);
|
|
1667
1686
|
}
|
|
@@ -1680,7 +1699,7 @@ function partialImpl(func, placeholder, ...partialArgs) {
|
|
|
1680
1699
|
var placeholderSymbol = Symbol("partial.placeholder");
|
|
1681
1700
|
partial.placeholder = placeholderSymbol;
|
|
1682
1701
|
|
|
1683
|
-
//
|
|
1702
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partialRight.js
|
|
1684
1703
|
function partialRight(func, ...partialArgs) {
|
|
1685
1704
|
return partialRightImpl(func, placeholderSymbol2, ...partialArgs);
|
|
1686
1705
|
}
|
|
@@ -1701,10 +1720,10 @@ function partialRightImpl(func, placeholder, ...partialArgs) {
|
|
|
1701
1720
|
var placeholderSymbol2 = Symbol("partialRight.placeholder");
|
|
1702
1721
|
partialRight.placeholder = placeholderSymbol2;
|
|
1703
1722
|
|
|
1704
|
-
//
|
|
1723
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/retry.js
|
|
1705
1724
|
var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
|
|
1706
1725
|
|
|
1707
|
-
//
|
|
1726
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/object/pick.js
|
|
1708
1727
|
function pick(obj, keys) {
|
|
1709
1728
|
const result = {};
|
|
1710
1729
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -1716,7 +1735,7 @@ function pick(obj, keys) {
|
|
|
1716
1735
|
return result;
|
|
1717
1736
|
}
|
|
1718
1737
|
|
|
1719
|
-
//
|
|
1738
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/string/deburr.js
|
|
1720
1739
|
var deburrMap = new Map(
|
|
1721
1740
|
// eslint-disable-next-line no-restricted-syntax
|
|
1722
1741
|
Object.entries({
|
|
@@ -1752,7 +1771,7 @@ var deburrMap = new Map(
|
|
|
1752
1771
|
})
|
|
1753
1772
|
);
|
|
1754
1773
|
|
|
1755
|
-
//
|
|
1774
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/factories/args-def-factory.js
|
|
1756
1775
|
var DECISION_OPTIONS = {
|
|
1757
1776
|
RETRY: "retry",
|
|
1758
1777
|
PROCEED: "proceed",
|
|
@@ -1983,7 +2002,7 @@ NOTE: The \`steps\` has been predefined` : `**You MUST execute this tool with fo
|
|
|
1983
2002
|
};
|
|
1984
2003
|
}
|
|
1985
2004
|
|
|
1986
|
-
//
|
|
2005
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/base-sampling-executor.js
|
|
1987
2006
|
import { Ajv as Ajv2 } from "ajv";
|
|
1988
2007
|
import { AggregateAjvError as AggregateAjvError2 } from "@segment/ajv-human-errors";
|
|
1989
2008
|
import addFormats2 from "ajv-formats";
|
|
@@ -2351,7 +2370,7 @@ VALID: {"key":"value"}` }) {
|
|
|
2351
2370
|
}
|
|
2352
2371
|
};
|
|
2353
2372
|
|
|
2354
|
-
//
|
|
2373
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/agentic-sampling-executor.js
|
|
2355
2374
|
var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
2356
2375
|
agenticExecutor;
|
|
2357
2376
|
constructor(name, description, allToolNames, toolNameToDetailList, server, config) {
|
|
@@ -2457,7 +2476,7 @@ When the task is complete, I should use "action": "complete".`;
|
|
|
2457
2476
|
}
|
|
2458
2477
|
};
|
|
2459
2478
|
|
|
2460
|
-
//
|
|
2479
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-tool-registrar.js
|
|
2461
2480
|
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, sampling = false }) {
|
|
2462
2481
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
|
|
2463
2482
|
const isSamplingMode = sampling === true || typeof sampling === "object";
|
|
@@ -2487,10 +2506,10 @@ function registerAgenticTool(server, { description, name, allToolNames, depGroup
|
|
|
2487
2506
|
});
|
|
2488
2507
|
}
|
|
2489
2508
|
|
|
2490
|
-
//
|
|
2509
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
2491
2510
|
init_schema();
|
|
2492
2511
|
|
|
2493
|
-
//
|
|
2512
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/state.js
|
|
2494
2513
|
var WorkflowState = class {
|
|
2495
2514
|
currentStepIndex = -1;
|
|
2496
2515
|
steps = [];
|
|
@@ -2659,7 +2678,10 @@ var WorkflowState = class {
|
|
|
2659
2678
|
}
|
|
2660
2679
|
};
|
|
2661
2680
|
|
|
2662
|
-
//
|
|
2681
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
2682
|
+
init_provider();
|
|
2683
|
+
|
|
2684
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-executor.js
|
|
2663
2685
|
import { Ajv as Ajv3 } from "ajv";
|
|
2664
2686
|
import { AggregateAjvError as AggregateAjvError3 } from "@segment/ajv-human-errors";
|
|
2665
2687
|
import addFormats3 from "ajv-formats";
|
|
@@ -2986,7 +3008,7 @@ ${this.formatProgress(state)}`
|
|
|
2986
3008
|
}
|
|
2987
3009
|
};
|
|
2988
3010
|
|
|
2989
|
-
//
|
|
3011
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/workflow-sampling-executor.js
|
|
2990
3012
|
var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
|
|
2991
3013
|
createArgsDef;
|
|
2992
3014
|
predefinedSteps;
|
|
@@ -3060,7 +3082,7 @@ Current Task: <user_request>${args.userRequest}</user_request>${contextInfo}`;
|
|
|
3060
3082
|
}
|
|
3061
3083
|
};
|
|
3062
3084
|
|
|
3063
|
-
//
|
|
3085
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
3064
3086
|
function registerAgenticWorkflowTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, sampling = false, ensureStepActions, toolNameToIdMapping }) {
|
|
3065
3087
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, predefinedSteps, ensureStepActions);
|
|
3066
3088
|
const isSamplingMode = sampling === true || typeof sampling === "object";
|
|
@@ -3102,7 +3124,7 @@ function registerAgenticWorkflowTool(server, { description, name, allToolNames,
|
|
|
3102
3124
|
});
|
|
3103
3125
|
}
|
|
3104
3126
|
|
|
3105
|
-
//
|
|
3127
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/tool-tag-processor.js
|
|
3106
3128
|
var ALL_TOOLS_PLACEHOLDER = "__ALL__";
|
|
3107
3129
|
function findToolId(toolName, tools, toolNameMapping) {
|
|
3108
3130
|
const mappedId = toolNameMapping?.get(toolName);
|
|
@@ -3130,18 +3152,20 @@ function processToolTags({ description, tagToResults, $, tools, toolOverrides, t
|
|
|
3130
3152
|
const toolId = findToolId(toolName, tools, toolNameMapping);
|
|
3131
3153
|
if (toolId) {
|
|
3132
3154
|
$(toolEl).replaceWith(`<action action="${toolId}"/>`);
|
|
3155
|
+
} else {
|
|
3156
|
+
$(toolEl).remove();
|
|
3133
3157
|
}
|
|
3134
3158
|
}
|
|
3135
3159
|
});
|
|
3136
3160
|
return $.root().html() ?? description;
|
|
3137
3161
|
}
|
|
3138
3162
|
|
|
3139
|
-
//
|
|
3163
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
3140
3164
|
init_built_in();
|
|
3141
3165
|
init_logger();
|
|
3142
3166
|
init_plugin_utils();
|
|
3143
3167
|
|
|
3144
|
-
//
|
|
3168
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/plugin-manager.js
|
|
3145
3169
|
init_plugin_utils();
|
|
3146
3170
|
init_logger();
|
|
3147
3171
|
var PluginManager = class {
|
|
@@ -3309,7 +3333,7 @@ var PluginManager = class {
|
|
|
3309
3333
|
}
|
|
3310
3334
|
};
|
|
3311
3335
|
|
|
3312
|
-
//
|
|
3336
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/tool-manager.js
|
|
3313
3337
|
var ToolManager = class {
|
|
3314
3338
|
toolRegistry = /* @__PURE__ */ new Map();
|
|
3315
3339
|
toolConfigs = /* @__PURE__ */ new Map();
|
|
@@ -3496,7 +3520,7 @@ var ToolManager = class {
|
|
|
3496
3520
|
}
|
|
3497
3521
|
};
|
|
3498
3522
|
|
|
3499
|
-
//
|
|
3523
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
3500
3524
|
init_compose_helpers();
|
|
3501
3525
|
var ALL_TOOLS_PLACEHOLDER2 = "__ALL__";
|
|
3502
3526
|
var ComposableMCPServer = class extends Server {
|
|
@@ -3878,7 +3902,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
3878
3902
|
}
|
|
3879
3903
|
};
|
|
3880
3904
|
|
|
3881
|
-
//
|
|
3905
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/env.js
|
|
3882
3906
|
import process6 from "node:process";
|
|
3883
3907
|
var isProdEnv = () => process6.env.NODE_ENV === "production";
|
|
3884
3908
|
var isSCF = () => Boolean(process6.env.SCF_RUNTIME || process6.env.PROD_SCF);
|
|
@@ -3889,17 +3913,22 @@ if (isSCF()) {
|
|
|
3889
3913
|
});
|
|
3890
3914
|
}
|
|
3891
3915
|
|
|
3892
|
-
//
|
|
3916
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.ts
|
|
3917
|
+
init_json();
|
|
3918
|
+
|
|
3919
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.js
|
|
3920
|
+
init_json();
|
|
3893
3921
|
init_schema();
|
|
3894
3922
|
|
|
3895
|
-
//
|
|
3896
|
-
function convertToAISDKTools(server,
|
|
3923
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/ai-sdk-adapter.js
|
|
3924
|
+
function convertToAISDKTools(server, helpers) {
|
|
3925
|
+
const { tool, jsonSchema: jsonSchema2 } = helpers;
|
|
3897
3926
|
const mcpcTools = server.getPublicTools();
|
|
3898
3927
|
return Object.fromEntries(mcpcTools.map((mcpcTool) => [
|
|
3899
3928
|
mcpcTool.name,
|
|
3900
3929
|
tool({
|
|
3901
3930
|
description: mcpcTool.description || "No description",
|
|
3902
|
-
|
|
3931
|
+
inputSchema: jsonSchema2(mcpcTool.inputSchema),
|
|
3903
3932
|
execute: async (input) => {
|
|
3904
3933
|
return await server.callTool(mcpcTool.name, input);
|
|
3905
3934
|
}
|
|
@@ -3907,7 +3936,7 @@ function convertToAISDKTools(server, tool, jsonSchema2) {
|
|
|
3907
3936
|
]));
|
|
3908
3937
|
}
|
|
3909
3938
|
|
|
3910
|
-
//
|
|
3939
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/set-up-mcp-compose.js
|
|
3911
3940
|
function parseMcpcConfigs(conf) {
|
|
3912
3941
|
const mcpcConfigs = conf ?? [];
|
|
3913
3942
|
const newMcpcConfigs = [];
|
|
@@ -3948,7 +3977,7 @@ async function mcpc(serverConf, composeConf, setupCallback) {
|
|
|
3948
3977
|
return server;
|
|
3949
3978
|
}
|
|
3950
3979
|
|
|
3951
|
-
//
|
|
3980
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.ts
|
|
3952
3981
|
init_schema();
|
|
3953
3982
|
export {
|
|
3954
3983
|
ComposableMCPServer,
|
package/package.json
CHANGED
package/plugins/large-result.mjs
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/large-result.ts
|
|
6
6
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.js
|
|
11
11
|
import rg from "@mcpc-tech/ripgrep-napi";
|
|
12
12
|
import { tmpdir } from "node:os";
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/schema.js
|
|
15
15
|
var schemaSymbol = Symbol.for("mcpc.schema");
|
|
16
16
|
var validatorSymbol = Symbol.for("mcpc.validator");
|
|
17
17
|
function jsonSchema(schema, options = {}) {
|
|
@@ -30,7 +30,7 @@ function isWrappedSchema(value) {
|
|
|
30
30
|
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.js
|
|
34
34
|
import { resolve } from "node:path";
|
|
35
35
|
import { relative } from "node:path";
|
|
36
36
|
function createSearchPlugin(options = {}) {
|
|
@@ -255,7 +255,7 @@ var defaultSearchPlugin = createSearchPlugin({
|
|
|
255
255
|
timeoutMs: 3e4
|
|
256
256
|
});
|
|
257
257
|
|
|
258
|
-
//
|
|
258
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/large-result.ts
|
|
259
259
|
function createLargeResultPlugin(options = {}) {
|
|
260
260
|
const maxSize = options.maxSize || 8e3;
|
|
261
261
|
const previewSize = options.previewSize || 4e3;
|
package/plugins/search.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.ts
|
|
6
6
|
import rg from "@mcpc-tech/ripgrep-napi";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/schema.js
|
|
10
10
|
var schemaSymbol = Symbol.for("mcpc.schema");
|
|
11
11
|
var validatorSymbol = Symbol.for("mcpc.validator");
|
|
12
12
|
function jsonSchema(schema, options = {}) {
|
|
@@ -25,7 +25,7 @@ function isWrappedSchema(value) {
|
|
|
25
25
|
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.ts
|
|
29
29
|
import { resolve } from "node:path";
|
|
30
30
|
import { relative } from "node:path";
|
|
31
31
|
function createSearchPlugin(options = {}) {
|
package/plugins.mjs
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.js
|
|
6
6
|
import rg from "@mcpc-tech/ripgrep-napi";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/schema.js
|
|
10
10
|
var schemaSymbol = Symbol.for("mcpc.schema");
|
|
11
11
|
var validatorSymbol = Symbol.for("mcpc.validator");
|
|
12
12
|
function jsonSchema(schema, options = {}) {
|
|
@@ -25,7 +25,7 @@ function isWrappedSchema(value) {
|
|
|
25
25
|
return typeof value === "object" && value !== null && schemaSymbol in value && value[schemaSymbol] === true;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/search-tool.js
|
|
29
29
|
import { resolve } from "node:path";
|
|
30
30
|
import { relative } from "node:path";
|
|
31
31
|
function createSearchPlugin(options = {}) {
|
|
@@ -251,7 +251,7 @@ var defaultSearchPlugin = createSearchPlugin({
|
|
|
251
251
|
});
|
|
252
252
|
var search_tool_default = defaultSearchPlugin;
|
|
253
253
|
|
|
254
|
-
//
|
|
254
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/large-result.js
|
|
255
255
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
256
256
|
import { join } from "node:path";
|
|
257
257
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
/**
|
|
10
10
|
* Converts MCPC server tools to AI SDK compatible tools format.
|
|
11
11
|
*
|
|
12
|
-
* This function takes a MCPC server instance and
|
|
13
|
-
* tool names to AI SDK tool definitions.
|
|
14
|
-
* used with AI SDK's `generateText` or `streamText` functions.
|
|
12
|
+
* This function takes a MCPC server instance and AI SDK helpers, returning
|
|
13
|
+
* an object mapping tool names to AI SDK tool definitions.
|
|
15
14
|
*
|
|
16
15
|
* @param server - The MCPC server instance
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
16
|
+
* @param helpers - Object containing AI SDK helper functions
|
|
17
|
+
* @param helpers.tool - The AI SDK tool() helper function from "ai" package
|
|
18
|
+
* @param helpers.jsonSchema - The AI SDK jsonSchema() helper function from "ai" package
|
|
19
19
|
* @returns Object mapping tool names to AI SDK compatible tools
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* ```typescript
|
|
23
|
-
* import { tool, jsonSchema } from "ai";
|
|
23
|
+
* import { tool, jsonSchema, generateText } from "ai";
|
|
24
24
|
* import { mcpc } from "@mcpc/core";
|
|
25
25
|
* import { convertToAISDKTools } from "@mcpc/core/ai-sdk-adapter";
|
|
26
26
|
*
|
|
27
27
|
* const server = await mcpc([...], [...]);
|
|
28
|
-
* const tools = convertToAISDKTools(server, tool, jsonSchema);
|
|
28
|
+
* const tools = convertToAISDKTools(server, { tool, jsonSchema });
|
|
29
29
|
*
|
|
30
30
|
* const result = await generateText({
|
|
31
31
|
* model: openai("gpt-4"),
|
|
@@ -33,21 +33,15 @@
|
|
|
33
33
|
* prompt: "Your prompt here"
|
|
34
34
|
* });
|
|
35
35
|
* ```
|
|
36
|
-
*/ export declare function convertToAISDKTools(server: ComposableMCPServer,
|
|
36
|
+
*/ export declare function convertToAISDKTools(server: ComposableMCPServer, helpers: {
|
|
37
|
+
tool: ToolHelper;
|
|
38
|
+
jsonSchema: JsonSchemaHelper;
|
|
39
|
+
}): Record<string, any>;
|
|
37
40
|
/**
|
|
38
41
|
* Type definition for AI SDK's tool() helper function.
|
|
39
|
-
*
|
|
40
|
-
*/ export
|
|
41
|
-
(options: {
|
|
42
|
-
description: string;
|
|
43
|
-
parameters: any;
|
|
44
|
-
execute: (input: any) => Promise<any>;
|
|
45
|
-
}) : unknown;
|
|
46
|
-
}
|
|
42
|
+
* Using a generic function type to accept any compatible tool helper.
|
|
43
|
+
*/ export type ToolHelper = (...args: any[]) => any;
|
|
47
44
|
/**
|
|
48
45
|
* Type definition for AI SDK's jsonSchema() helper function.
|
|
49
|
-
|
|
50
|
-
*/ export interface JsonSchemaHelper {
|
|
51
|
-
(schema: any) : unknown;
|
|
52
|
-
}
|
|
46
|
+
*/ export type JsonSchemaHelper = (...args: any[]) => any;
|
|
53
47
|
//# sourceMappingURL=ai-sdk-adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-sdk-adapter.d.ts","sources":["../../src/ai-sdk-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;CAOC,GAED,cAAc,mBAAmB,uBAAuB;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,OAAO,iBAAS,oBACd,QAAQ,mBAAmB,EAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"ai-sdk-adapter.d.ts","sources":["../../src/ai-sdk-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;CAOC,GAED,cAAc,mBAAmB,uBAAuB;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GACD,OAAO,iBAAS,oBACd,QAAQ,mBAAmB,EAC3B;EACE,MAAM;EACN,YAAY;CACb,GACA,OAAO,MAAM,EAAE,GAAG;AAkBrB;;;CAGC,GACD,YAAY,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG;AAEhD;;CAEC,GACD,YAAY,oBAAoB,GAAG,MAAM,GAAG,OAAO,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sources":["../../../../src/utils/common/mcp.ts"],"names":[],"mappings":"AAIA,cACE,iBAAiB,iCAEa;AAChC,YAAY,aAAyB;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sources":["../../../../src/utils/common/mcp.ts"],"names":[],"mappings":"AAIA,cACE,iBAAiB,iCAEa;AAChC,YAAY,aAAyB;AA4IrC,OAAO,iBAAe,mBACpB,WACI,EAAE,aAAa,qBACf,EAAE,aAAa,kBAAkB,EACrC,YAAY;EACV,QAAQ,MAAM;EACd,MAAM,GAAG;EACT,SAAS,MAAM;EACf,mBAAmB,MAAM;EACzB,kBAAkB,MAAM;EACxB,QAAQ,MAAM;MACV,OAAO,GACZ,QAAQ,OAAO,MAAM,EAAE,GAAG"}
|