@mcpc-tech/core 0.2.2 → 0.2.4
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 +166 -0
- package/index.mjs +173 -136
- 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/set-up-mcp-compose.d.ts +63 -1
- package/types/src/set-up-mcp-compose.d.ts.map +1 -1
- package/types/src/utils/common/mcp.d.ts.map +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# @mcpc/core
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@mcpc-tech/core)
|
|
4
|
+
[](https://jsr.io/@mcpc/core)
|
|
5
|
+
|
|
6
|
+
**Build agentic MCP servers by composing existing MCP tools.**
|
|
7
|
+
|
|
8
|
+
The core SDK for creating agentic Model Context Protocol (MCP) servers. Compose
|
|
9
|
+
existing MCP tools into powerful AI agents with simple descriptions and tool
|
|
10
|
+
references.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# npm (from npm registry)
|
|
16
|
+
npm install @mcpc-tech/core
|
|
17
|
+
|
|
18
|
+
# npm (from jsr)
|
|
19
|
+
npx jsr add @mcpc/core
|
|
20
|
+
|
|
21
|
+
# deno
|
|
22
|
+
deno add jsr:@mcpc/core
|
|
23
|
+
|
|
24
|
+
# pnpm (from npm registry)
|
|
25
|
+
pnpm add @mcpc-tech/core
|
|
26
|
+
|
|
27
|
+
# pnpm (from jsr)
|
|
28
|
+
pnpm add jsr:@mcpc/core
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { mcpc } from "@mcpc/core";
|
|
35
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
36
|
+
|
|
37
|
+
// Create an agentic MCP server
|
|
38
|
+
const server = await mcpc(
|
|
39
|
+
[
|
|
40
|
+
{ name: "my-agent", version: "1.0.0" },
|
|
41
|
+
{ capabilities: { tools: {}, sampling: {} } },
|
|
42
|
+
],
|
|
43
|
+
[{
|
|
44
|
+
name: "my-agent",
|
|
45
|
+
description: `
|
|
46
|
+
I am a coding assistant that can read files and run terminal commands.
|
|
47
|
+
|
|
48
|
+
Available tools:
|
|
49
|
+
<tool name="desktop-commander.read_file"/>
|
|
50
|
+
<tool name="desktop-commander.execute_command"/>
|
|
51
|
+
`,
|
|
52
|
+
deps: {
|
|
53
|
+
mcpServers: {
|
|
54
|
+
"desktop-commander": {
|
|
55
|
+
command: "npx",
|
|
56
|
+
args: ["-y", "@wonderwhy-er/desktop-commander@latest"],
|
|
57
|
+
transportType: "stdio",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
options: { mode: "agentic" },
|
|
62
|
+
}],
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Connect to stdio transport
|
|
66
|
+
await server.connect(new StdioServerTransport());
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Key Concepts
|
|
70
|
+
|
|
71
|
+
### Tool References
|
|
72
|
+
|
|
73
|
+
Reference tools in your agent description using XML-like syntax:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
description: `
|
|
77
|
+
Available tools:
|
|
78
|
+
<tool name="server.tool"/> // Basic reference
|
|
79
|
+
<tool name="server.__ALL__"/> // All tools from server
|
|
80
|
+
<tool name="tool" maxResultLength="2000"/> // Limit result size
|
|
81
|
+
<tool name="tool" hide/> // Hide from public interface
|
|
82
|
+
<tool name="tool" global/> // Expose at global scope
|
|
83
|
+
`;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### MCP Server Dependencies
|
|
87
|
+
|
|
88
|
+
Support all MCP transport types:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
deps: {
|
|
92
|
+
mcpServers: {
|
|
93
|
+
"stdio-server": {
|
|
94
|
+
command: "npx",
|
|
95
|
+
args: ["-y", "some-mcp-server"],
|
|
96
|
+
transportType: "stdio"
|
|
97
|
+
},
|
|
98
|
+
"http-server": {
|
|
99
|
+
transportType: "streamable-http",
|
|
100
|
+
url: "https://api.example.com/mcp/",
|
|
101
|
+
headers: { "Authorization": "Bearer ${TOKEN}" }
|
|
102
|
+
},
|
|
103
|
+
"sse-server": {
|
|
104
|
+
transportType: "sse",
|
|
105
|
+
url: "https://api.example.com/sse/"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Execution Modes
|
|
112
|
+
|
|
113
|
+
- **`agentic`** (default): Fully autonomous agent without structured workflow
|
|
114
|
+
- **`agentic_workflow`**: Structured workflow with predefined or
|
|
115
|
+
runtime-generated steps
|
|
116
|
+
|
|
117
|
+
### Plugins
|
|
118
|
+
|
|
119
|
+
Extend functionality with plugins:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { createLargeResultPlugin } from "@mcpc/core/plugins";
|
|
123
|
+
|
|
124
|
+
{
|
|
125
|
+
plugins: [
|
|
126
|
+
createLargeResultPlugin({ maxSize: 8000 }),
|
|
127
|
+
"./plugins/custom.ts?param=value",
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## API Reference
|
|
133
|
+
|
|
134
|
+
### `mcpc(serverConf, composeConf?, setupCallback?)`
|
|
135
|
+
|
|
136
|
+
Main entry point for creating agentic MCP servers.
|
|
137
|
+
|
|
138
|
+
**Parameters:**
|
|
139
|
+
|
|
140
|
+
- `serverConf` - Server metadata and capabilities
|
|
141
|
+
- `composeConf` - Array of agent composition definitions (optional)
|
|
142
|
+
- `setupCallback` - Callback for custom setup before composition (optional)
|
|
143
|
+
|
|
144
|
+
**Returns:** `Promise<ComposableMCPServer>`
|
|
145
|
+
|
|
146
|
+
See [full documentation](../../docs/README.md) for detailed usage.
|
|
147
|
+
|
|
148
|
+
## Examples
|
|
149
|
+
|
|
150
|
+
Find complete examples in the [`examples/`](./examples/) directory:
|
|
151
|
+
|
|
152
|
+
- `01-basic-composition.ts` - Basic agent composition
|
|
153
|
+
- `02-plugin-usage.ts` - Using plugins
|
|
154
|
+
- `03-agentic-workflow.ts` - Workflow mode with steps
|
|
155
|
+
- `04-sampling-mode.ts` - Autonomous execution with sampling
|
|
156
|
+
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
- [Full Documentation](../../docs/README.md)
|
|
160
|
+
- [Plugin System Guide](../../docs/plugins.md)
|
|
161
|
+
- [Creating Your First Agentic MCP](../../docs/quickstart/create-your-first-agentic-mcp.md)
|
|
162
|
+
- [FAQ](../../docs/faq.md)
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
MIT
|
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,
|
|
@@ -135,10 +218,10 @@ var init_logger = __esm({
|
|
|
135
218
|
}
|
|
136
219
|
});
|
|
137
220
|
|
|
138
|
-
//
|
|
221
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/config-plugin.js
|
|
139
222
|
var createConfigPlugin, config_plugin_default;
|
|
140
223
|
var init_config_plugin = __esm({
|
|
141
|
-
"
|
|
224
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/config-plugin.js"() {
|
|
142
225
|
createConfigPlugin = () => ({
|
|
143
226
|
name: "built-in-config",
|
|
144
227
|
version: "1.0.0",
|
|
@@ -156,10 +239,10 @@ var init_config_plugin = __esm({
|
|
|
156
239
|
}
|
|
157
240
|
});
|
|
158
241
|
|
|
159
|
-
//
|
|
242
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/tool-name-mapping-plugin.js
|
|
160
243
|
var createToolNameMappingPlugin, tool_name_mapping_plugin_default;
|
|
161
244
|
var init_tool_name_mapping_plugin = __esm({
|
|
162
|
-
"
|
|
245
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/tool-name-mapping-plugin.js"() {
|
|
163
246
|
createToolNameMappingPlugin = () => ({
|
|
164
247
|
name: "built-in-tool-name-mapping",
|
|
165
248
|
version: "1.0.0",
|
|
@@ -167,15 +250,17 @@ var init_tool_name_mapping_plugin = __esm({
|
|
|
167
250
|
transformTool: (tool, context2) => {
|
|
168
251
|
const server = context2.server;
|
|
169
252
|
const toolName = context2.toolName;
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
253
|
+
const originalName = tool._originalName || toolName;
|
|
254
|
+
const dotNotation = originalName.replace(/_/g, ".");
|
|
255
|
+
const underscoreNotation = originalName.replace(/\./g, "_");
|
|
256
|
+
if (dotNotation !== originalName && server.toolNameMapping) {
|
|
173
257
|
server.toolNameMapping.set(dotNotation, toolName);
|
|
174
|
-
server.toolNameMapping.set(toolName, dotNotation);
|
|
175
258
|
}
|
|
176
|
-
if (underscoreNotation !==
|
|
259
|
+
if (underscoreNotation !== originalName && server.toolNameMapping) {
|
|
177
260
|
server.toolNameMapping.set(underscoreNotation, toolName);
|
|
178
|
-
|
|
261
|
+
}
|
|
262
|
+
if (originalName !== toolName && server.toolNameMapping) {
|
|
263
|
+
server.toolNameMapping.set(originalName, toolName);
|
|
179
264
|
}
|
|
180
265
|
return tool;
|
|
181
266
|
}
|
|
@@ -184,10 +269,10 @@ var init_tool_name_mapping_plugin = __esm({
|
|
|
184
269
|
}
|
|
185
270
|
});
|
|
186
271
|
|
|
187
|
-
//
|
|
272
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/logging-plugin.js
|
|
188
273
|
var createLoggingPlugin, logging_plugin_default;
|
|
189
274
|
var init_logging_plugin = __esm({
|
|
190
|
-
"
|
|
275
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/logging-plugin.js"() {
|
|
191
276
|
init_logger();
|
|
192
277
|
createLoggingPlugin = (options = {}) => {
|
|
193
278
|
const { enabled = true, verbose = false, compact: compact2 = true } = options;
|
|
@@ -226,7 +311,7 @@ var init_logging_plugin = __esm({
|
|
|
226
311
|
}
|
|
227
312
|
});
|
|
228
313
|
|
|
229
|
-
//
|
|
314
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/index.js
|
|
230
315
|
var built_in_exports = {};
|
|
231
316
|
__export(built_in_exports, {
|
|
232
317
|
createConfigPlugin: () => createConfigPlugin,
|
|
@@ -242,7 +327,7 @@ function getBuiltInPlugins() {
|
|
|
242
327
|
];
|
|
243
328
|
}
|
|
244
329
|
var init_built_in = __esm({
|
|
245
|
-
"
|
|
330
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugins/built-in/index.js"() {
|
|
246
331
|
init_config_plugin();
|
|
247
332
|
init_tool_name_mapping_plugin();
|
|
248
333
|
init_logging_plugin();
|
|
@@ -252,7 +337,7 @@ var init_built_in = __esm({
|
|
|
252
337
|
}
|
|
253
338
|
});
|
|
254
339
|
|
|
255
|
-
//
|
|
340
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/plugin-utils.js
|
|
256
341
|
var plugin_utils_exports = {};
|
|
257
342
|
__export(plugin_utils_exports, {
|
|
258
343
|
checkCircularDependencies: () => checkCircularDependencies,
|
|
@@ -459,12 +544,12 @@ function validatePlugins(plugins) {
|
|
|
459
544
|
}
|
|
460
545
|
var pluginCache;
|
|
461
546
|
var init_plugin_utils = __esm({
|
|
462
|
-
"
|
|
547
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/plugin-utils.js"() {
|
|
463
548
|
pluginCache = /* @__PURE__ */ new Map();
|
|
464
549
|
}
|
|
465
550
|
});
|
|
466
551
|
|
|
467
|
-
//
|
|
552
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/schema.js
|
|
468
553
|
import traverse from "json-schema-traverse";
|
|
469
554
|
function updateRefPaths(schema, wrapperPath) {
|
|
470
555
|
if (!schema || typeof schema !== "object") {
|
|
@@ -496,11 +581,11 @@ function updateRefPaths(schema, wrapperPath) {
|
|
|
496
581
|
return clonedSchema;
|
|
497
582
|
}
|
|
498
583
|
var init_schema2 = __esm({
|
|
499
|
-
"
|
|
584
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/schema.js"() {
|
|
500
585
|
}
|
|
501
586
|
});
|
|
502
587
|
|
|
503
|
-
//
|
|
588
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/compose-helpers.js
|
|
504
589
|
var compose_helpers_exports = {};
|
|
505
590
|
__export(compose_helpers_exports, {
|
|
506
591
|
buildDependencyGroups: () => buildDependencyGroups,
|
|
@@ -566,7 +651,8 @@ function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicTool
|
|
|
566
651
|
const baseProperties = baseSchema.type === "object" && baseSchema.properties ? baseSchema.properties : {};
|
|
567
652
|
const baseRequired = baseSchema.type === "object" && Array.isArray(baseSchema.required) ? baseSchema.required : [];
|
|
568
653
|
const updatedProperties = updateRefPaths(baseProperties, toolName);
|
|
569
|
-
|
|
654
|
+
const sanitizedKey = sanitizePropertyKey(toolName);
|
|
655
|
+
depGroups[sanitizedKey] = {
|
|
570
656
|
type: "object",
|
|
571
657
|
description: tool.description,
|
|
572
658
|
properties: updatedProperties,
|
|
@@ -588,18 +674,19 @@ function registerGlobalTools(globalToolNames, tools, server) {
|
|
|
588
674
|
});
|
|
589
675
|
}
|
|
590
676
|
var init_compose_helpers = __esm({
|
|
591
|
-
"
|
|
677
|
+
"__mcpc__core_latest/node_modules/@mcpc/core/src/utils/compose-helpers.js"() {
|
|
592
678
|
init_schema2();
|
|
593
679
|
init_schema();
|
|
680
|
+
init_provider();
|
|
594
681
|
}
|
|
595
682
|
});
|
|
596
683
|
|
|
597
|
-
//
|
|
684
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
598
685
|
init_schema();
|
|
599
686
|
import { CallToolRequestSchema, ListToolsRequestSchema, SetLevelRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
600
687
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
601
688
|
|
|
602
|
-
//
|
|
689
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/json.js
|
|
603
690
|
import { jsonrepair } from "jsonrepair";
|
|
604
691
|
function stripMarkdownAndText(text) {
|
|
605
692
|
text = text.trim();
|
|
@@ -634,7 +721,7 @@ function parseJSON(text, throwError) {
|
|
|
634
721
|
}
|
|
635
722
|
}
|
|
636
723
|
|
|
637
|
-
//
|
|
724
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/ai.js
|
|
638
725
|
var p = (template, options = {}) => {
|
|
639
726
|
const { missingVariableHandling = "warn" } = options;
|
|
640
727
|
const names = /* @__PURE__ */ new Set();
|
|
@@ -670,7 +757,7 @@ var p = (template, options = {}) => {
|
|
|
670
757
|
};
|
|
671
758
|
};
|
|
672
759
|
|
|
673
|
-
//
|
|
760
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/tool-tags.js
|
|
674
761
|
import { load } from "cheerio";
|
|
675
762
|
function parseTags(htmlString, tags) {
|
|
676
763
|
const $ = load(htmlString, {
|
|
@@ -689,10 +776,10 @@ function parseTags(htmlString, tags) {
|
|
|
689
776
|
};
|
|
690
777
|
}
|
|
691
778
|
|
|
692
|
-
//
|
|
779
|
+
// __mcpc__core_latest/node_modules/@jsr/mcpc__utils/src/transport/sse.js
|
|
693
780
|
import { JSONRPCMessageSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
694
781
|
|
|
695
|
-
//
|
|
782
|
+
// __mcpc__core_latest/node_modules/@jsr/std__http/server_sent_event_stream.js
|
|
696
783
|
var NEWLINE_REGEXP = /\r\n|\r|\n/;
|
|
697
784
|
var encoder = new TextEncoder();
|
|
698
785
|
function assertHasNoNewline(value, varName, errPrefix) {
|
|
@@ -730,13 +817,13 @@ var ServerSentEventStream = class extends TransformStream {
|
|
|
730
817
|
}
|
|
731
818
|
};
|
|
732
819
|
|
|
733
|
-
//
|
|
820
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/mcp.js
|
|
734
821
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
735
822
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
736
823
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
737
824
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
738
825
|
|
|
739
|
-
//
|
|
826
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/registory.js
|
|
740
827
|
function connectToSmitheryServer(smitheryConfig) {
|
|
741
828
|
const serverUrl = new URL(smitheryConfig.deploymentUrl);
|
|
742
829
|
serverUrl.searchParams.set("config", btoa(JSON.stringify(smitheryConfig.config)));
|
|
@@ -761,9 +848,10 @@ function smitheryToolNameCompatibale(name, scope) {
|
|
|
761
848
|
};
|
|
762
849
|
}
|
|
763
850
|
|
|
764
|
-
//
|
|
851
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/mcp.js
|
|
852
|
+
init_provider();
|
|
765
853
|
import { cwd } from "node:process";
|
|
766
|
-
import
|
|
854
|
+
import process3 from "node:process";
|
|
767
855
|
import { createHash } from "node:crypto";
|
|
768
856
|
var mcpClientPool = /* @__PURE__ */ new Map();
|
|
769
857
|
var mcpClientConnecting = /* @__PURE__ */ new Map();
|
|
@@ -809,7 +897,7 @@ async function getOrCreateMcpClient(defKey, def) {
|
|
|
809
897
|
command: def.command,
|
|
810
898
|
args: def.args,
|
|
811
899
|
env: {
|
|
812
|
-
...
|
|
900
|
+
...process3.env,
|
|
813
901
|
...def.env ?? {}
|
|
814
902
|
},
|
|
815
903
|
cwd: cwd()
|
|
@@ -863,11 +951,11 @@ var cleanupAllPooledClients = async () => {
|
|
|
863
951
|
}
|
|
864
952
|
}));
|
|
865
953
|
};
|
|
866
|
-
|
|
954
|
+
process3.once?.("exit", () => {
|
|
867
955
|
cleanupAllPooledClients();
|
|
868
956
|
});
|
|
869
|
-
|
|
870
|
-
cleanupAllPooledClients().finally(() =>
|
|
957
|
+
process3.once?.("SIGINT", () => {
|
|
958
|
+
cleanupAllPooledClients().finally(() => process3.exit(0));
|
|
871
959
|
});
|
|
872
960
|
async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
873
961
|
const allTools = {};
|
|
@@ -885,7 +973,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
885
973
|
const { tools } = await client.listTools();
|
|
886
974
|
tools.forEach((tool) => {
|
|
887
975
|
const { toolNameWithScope, toolName: internalToolName } = smitheryToolNameCompatibale(tool.name, name);
|
|
888
|
-
const
|
|
976
|
+
const rawToolId = `${serverId}_${internalToolName}`;
|
|
977
|
+
const toolId = sanitizePropertyKey(rawToolId);
|
|
889
978
|
if (filterIn && !filterIn({
|
|
890
979
|
action: internalToolName,
|
|
891
980
|
tool,
|
|
@@ -904,7 +993,8 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
904
993
|
});
|
|
905
994
|
allTools[toolId] = {
|
|
906
995
|
...tool,
|
|
907
|
-
execute
|
|
996
|
+
execute,
|
|
997
|
+
_originalName: toolNameWithScope
|
|
908
998
|
};
|
|
909
999
|
});
|
|
910
1000
|
} catch (error) {
|
|
@@ -924,74 +1014,11 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
924
1014
|
};
|
|
925
1015
|
}
|
|
926
1016
|
|
|
927
|
-
//
|
|
1017
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-tool-registrar.js
|
|
928
1018
|
init_schema();
|
|
1019
|
+
init_provider();
|
|
929
1020
|
|
|
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
|
|
1021
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/prompts/index.js
|
|
995
1022
|
var SystemPrompts = {
|
|
996
1023
|
/**
|
|
997
1024
|
* Base system prompt for autonomous MCP execution
|
|
@@ -1333,13 +1360,13 @@ ${JSON.stringify(steps, null, 2)}`;
|
|
|
1333
1360
|
}
|
|
1334
1361
|
};
|
|
1335
1362
|
|
|
1336
|
-
//
|
|
1363
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-executor.js
|
|
1337
1364
|
import { Ajv } from "ajv";
|
|
1338
1365
|
import { AggregateAjvError } from "@segment/ajv-human-errors";
|
|
1339
1366
|
import addFormats from "ajv-formats";
|
|
1340
1367
|
init_logger();
|
|
1341
1368
|
|
|
1342
|
-
//
|
|
1369
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/tracing.js
|
|
1343
1370
|
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
1344
1371
|
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
1345
1372
|
import { BatchSpanProcessor, ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
@@ -1406,7 +1433,7 @@ function endSpan(span, error) {
|
|
|
1406
1433
|
span.end();
|
|
1407
1434
|
}
|
|
1408
1435
|
|
|
1409
|
-
//
|
|
1436
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-executor.js
|
|
1410
1437
|
import process4 from "node:process";
|
|
1411
1438
|
var ajv = new Ajv({
|
|
1412
1439
|
allErrors: true,
|
|
@@ -1661,7 +1688,7 @@ var AgenticExecutor = class {
|
|
|
1661
1688
|
}
|
|
1662
1689
|
};
|
|
1663
1690
|
|
|
1664
|
-
//
|
|
1691
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partial.js
|
|
1665
1692
|
function partial(func, ...partialArgs) {
|
|
1666
1693
|
return partialImpl(func, placeholderSymbol, ...partialArgs);
|
|
1667
1694
|
}
|
|
@@ -1680,7 +1707,7 @@ function partialImpl(func, placeholder, ...partialArgs) {
|
|
|
1680
1707
|
var placeholderSymbol = Symbol("partial.placeholder");
|
|
1681
1708
|
partial.placeholder = placeholderSymbol;
|
|
1682
1709
|
|
|
1683
|
-
//
|
|
1710
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/partialRight.js
|
|
1684
1711
|
function partialRight(func, ...partialArgs) {
|
|
1685
1712
|
return partialRightImpl(func, placeholderSymbol2, ...partialArgs);
|
|
1686
1713
|
}
|
|
@@ -1701,10 +1728,10 @@ function partialRightImpl(func, placeholder, ...partialArgs) {
|
|
|
1701
1728
|
var placeholderSymbol2 = Symbol("partialRight.placeholder");
|
|
1702
1729
|
partialRight.placeholder = placeholderSymbol2;
|
|
1703
1730
|
|
|
1704
|
-
//
|
|
1731
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/function/retry.js
|
|
1705
1732
|
var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
|
|
1706
1733
|
|
|
1707
|
-
//
|
|
1734
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/object/pick.js
|
|
1708
1735
|
function pick(obj, keys) {
|
|
1709
1736
|
const result = {};
|
|
1710
1737
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -1716,7 +1743,7 @@ function pick(obj, keys) {
|
|
|
1716
1743
|
return result;
|
|
1717
1744
|
}
|
|
1718
1745
|
|
|
1719
|
-
//
|
|
1746
|
+
// __mcpc__core_latest/node_modules/@jsr/es-toolkit__es-toolkit/src/string/deburr.js
|
|
1720
1747
|
var deburrMap = new Map(
|
|
1721
1748
|
// eslint-disable-next-line no-restricted-syntax
|
|
1722
1749
|
Object.entries({
|
|
@@ -1752,7 +1779,7 @@ var deburrMap = new Map(
|
|
|
1752
1779
|
})
|
|
1753
1780
|
);
|
|
1754
1781
|
|
|
1755
|
-
//
|
|
1782
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/factories/args-def-factory.js
|
|
1756
1783
|
var DECISION_OPTIONS = {
|
|
1757
1784
|
RETRY: "retry",
|
|
1758
1785
|
PROCEED: "proceed",
|
|
@@ -1983,7 +2010,7 @@ NOTE: The \`steps\` has been predefined` : `**You MUST execute this tool with fo
|
|
|
1983
2010
|
};
|
|
1984
2011
|
}
|
|
1985
2012
|
|
|
1986
|
-
//
|
|
2013
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/base-sampling-executor.js
|
|
1987
2014
|
import { Ajv as Ajv2 } from "ajv";
|
|
1988
2015
|
import { AggregateAjvError as AggregateAjvError2 } from "@segment/ajv-human-errors";
|
|
1989
2016
|
import addFormats2 from "ajv-formats";
|
|
@@ -2351,7 +2378,7 @@ VALID: {"key":"value"}` }) {
|
|
|
2351
2378
|
}
|
|
2352
2379
|
};
|
|
2353
2380
|
|
|
2354
|
-
//
|
|
2381
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/agentic-sampling-executor.js
|
|
2355
2382
|
var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
2356
2383
|
agenticExecutor;
|
|
2357
2384
|
constructor(name, description, allToolNames, toolNameToDetailList, server, config) {
|
|
@@ -2457,7 +2484,7 @@ When the task is complete, I should use "action": "complete".`;
|
|
|
2457
2484
|
}
|
|
2458
2485
|
};
|
|
2459
2486
|
|
|
2460
|
-
//
|
|
2487
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/agentic/agentic-tool-registrar.js
|
|
2461
2488
|
function registerAgenticTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, sampling = false }) {
|
|
2462
2489
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, void 0, void 0);
|
|
2463
2490
|
const isSamplingMode = sampling === true || typeof sampling === "object";
|
|
@@ -2487,10 +2514,10 @@ function registerAgenticTool(server, { description, name, allToolNames, depGroup
|
|
|
2487
2514
|
});
|
|
2488
2515
|
}
|
|
2489
2516
|
|
|
2490
|
-
//
|
|
2517
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
2491
2518
|
init_schema();
|
|
2492
2519
|
|
|
2493
|
-
//
|
|
2520
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/state.js
|
|
2494
2521
|
var WorkflowState = class {
|
|
2495
2522
|
currentStepIndex = -1;
|
|
2496
2523
|
steps = [];
|
|
@@ -2659,7 +2686,10 @@ var WorkflowState = class {
|
|
|
2659
2686
|
}
|
|
2660
2687
|
};
|
|
2661
2688
|
|
|
2662
|
-
//
|
|
2689
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
2690
|
+
init_provider();
|
|
2691
|
+
|
|
2692
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-executor.js
|
|
2663
2693
|
import { Ajv as Ajv3 } from "ajv";
|
|
2664
2694
|
import { AggregateAjvError as AggregateAjvError3 } from "@segment/ajv-human-errors";
|
|
2665
2695
|
import addFormats3 from "ajv-formats";
|
|
@@ -2986,7 +3016,7 @@ ${this.formatProgress(state)}`
|
|
|
2986
3016
|
}
|
|
2987
3017
|
};
|
|
2988
3018
|
|
|
2989
|
-
//
|
|
3019
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/sampling/workflow-sampling-executor.js
|
|
2990
3020
|
var WorkflowSamplingExecutor = class extends BaseSamplingExecutor {
|
|
2991
3021
|
createArgsDef;
|
|
2992
3022
|
predefinedSteps;
|
|
@@ -3060,7 +3090,7 @@ Current Task: <user_request>${args.userRequest}</user_request>${contextInfo}`;
|
|
|
3060
3090
|
}
|
|
3061
3091
|
};
|
|
3062
3092
|
|
|
3063
|
-
//
|
|
3093
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/executors/workflow/workflow-tool-registrar.js
|
|
3064
3094
|
function registerAgenticWorkflowTool(server, { description, name, allToolNames, depGroups, toolNameToDetailList, predefinedSteps, sampling = false, ensureStepActions, toolNameToIdMapping }) {
|
|
3065
3095
|
const createArgsDef = createArgsDefFactory(name, allToolNames, depGroups, predefinedSteps, ensureStepActions);
|
|
3066
3096
|
const isSamplingMode = sampling === true || typeof sampling === "object";
|
|
@@ -3102,7 +3132,7 @@ function registerAgenticWorkflowTool(server, { description, name, allToolNames,
|
|
|
3102
3132
|
});
|
|
3103
3133
|
}
|
|
3104
3134
|
|
|
3105
|
-
//
|
|
3135
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/tool-tag-processor.js
|
|
3106
3136
|
var ALL_TOOLS_PLACEHOLDER = "__ALL__";
|
|
3107
3137
|
function findToolId(toolName, tools, toolNameMapping) {
|
|
3108
3138
|
const mappedId = toolNameMapping?.get(toolName);
|
|
@@ -3130,18 +3160,20 @@ function processToolTags({ description, tagToResults, $, tools, toolOverrides, t
|
|
|
3130
3160
|
const toolId = findToolId(toolName, tools, toolNameMapping);
|
|
3131
3161
|
if (toolId) {
|
|
3132
3162
|
$(toolEl).replaceWith(`<action action="${toolId}"/>`);
|
|
3163
|
+
} else {
|
|
3164
|
+
$(toolEl).remove();
|
|
3133
3165
|
}
|
|
3134
3166
|
}
|
|
3135
3167
|
});
|
|
3136
3168
|
return $.root().html() ?? description;
|
|
3137
3169
|
}
|
|
3138
3170
|
|
|
3139
|
-
//
|
|
3171
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
3140
3172
|
init_built_in();
|
|
3141
3173
|
init_logger();
|
|
3142
3174
|
init_plugin_utils();
|
|
3143
3175
|
|
|
3144
|
-
//
|
|
3176
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/plugin-manager.js
|
|
3145
3177
|
init_plugin_utils();
|
|
3146
3178
|
init_logger();
|
|
3147
3179
|
var PluginManager = class {
|
|
@@ -3309,7 +3341,7 @@ var PluginManager = class {
|
|
|
3309
3341
|
}
|
|
3310
3342
|
};
|
|
3311
3343
|
|
|
3312
|
-
//
|
|
3344
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/tool-manager.js
|
|
3313
3345
|
var ToolManager = class {
|
|
3314
3346
|
toolRegistry = /* @__PURE__ */ new Map();
|
|
3315
3347
|
toolConfigs = /* @__PURE__ */ new Map();
|
|
@@ -3496,7 +3528,7 @@ var ToolManager = class {
|
|
|
3496
3528
|
}
|
|
3497
3529
|
};
|
|
3498
3530
|
|
|
3499
|
-
//
|
|
3531
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/compose.js
|
|
3500
3532
|
init_compose_helpers();
|
|
3501
3533
|
var ALL_TOOLS_PLACEHOLDER2 = "__ALL__";
|
|
3502
3534
|
var ComposableMCPServer = class extends Server {
|
|
@@ -3878,7 +3910,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
3878
3910
|
}
|
|
3879
3911
|
};
|
|
3880
3912
|
|
|
3881
|
-
//
|
|
3913
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/utils/common/env.js
|
|
3882
3914
|
import process6 from "node:process";
|
|
3883
3915
|
var isProdEnv = () => process6.env.NODE_ENV === "production";
|
|
3884
3916
|
var isSCF = () => Boolean(process6.env.SCF_RUNTIME || process6.env.PROD_SCF);
|
|
@@ -3889,17 +3921,22 @@ if (isSCF()) {
|
|
|
3889
3921
|
});
|
|
3890
3922
|
}
|
|
3891
3923
|
|
|
3892
|
-
//
|
|
3924
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.ts
|
|
3925
|
+
init_json();
|
|
3926
|
+
|
|
3927
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.js
|
|
3928
|
+
init_json();
|
|
3893
3929
|
init_schema();
|
|
3894
3930
|
|
|
3895
|
-
//
|
|
3896
|
-
function convertToAISDKTools(server,
|
|
3931
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/ai-sdk-adapter.js
|
|
3932
|
+
function convertToAISDKTools(server, helpers) {
|
|
3933
|
+
const { tool, jsonSchema: jsonSchema2 } = helpers;
|
|
3897
3934
|
const mcpcTools = server.getPublicTools();
|
|
3898
3935
|
return Object.fromEntries(mcpcTools.map((mcpcTool) => [
|
|
3899
3936
|
mcpcTool.name,
|
|
3900
3937
|
tool({
|
|
3901
3938
|
description: mcpcTool.description || "No description",
|
|
3902
|
-
|
|
3939
|
+
inputSchema: jsonSchema2(mcpcTool.inputSchema),
|
|
3903
3940
|
execute: async (input) => {
|
|
3904
3941
|
return await server.callTool(mcpcTool.name, input);
|
|
3905
3942
|
}
|
|
@@ -3907,7 +3944,7 @@ function convertToAISDKTools(server, tool, jsonSchema2) {
|
|
|
3907
3944
|
]));
|
|
3908
3945
|
}
|
|
3909
3946
|
|
|
3910
|
-
//
|
|
3947
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/src/set-up-mcp-compose.js
|
|
3911
3948
|
function parseMcpcConfigs(conf) {
|
|
3912
3949
|
const mcpcConfigs = conf ?? [];
|
|
3913
3950
|
const newMcpcConfigs = [];
|
|
@@ -3948,7 +3985,7 @@ async function mcpc(serverConf, composeConf, setupCallback) {
|
|
|
3948
3985
|
return server;
|
|
3949
3986
|
}
|
|
3950
3987
|
|
|
3951
|
-
//
|
|
3988
|
+
// __mcpc__core_latest/node_modules/@mcpc/core/mod.ts
|
|
3952
3989
|
init_schema();
|
|
3953
3990
|
export {
|
|
3954
3991
|
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"}
|
|
@@ -64,5 +64,67 @@ export interface ComposibleMCPConfig {
|
|
|
64
64
|
[key: string]: ComposeDefinition[];
|
|
65
65
|
}
|
|
66
66
|
export declare function parseMcpcConfigs(conf?: ComposeDefinition[]): ComposeDefinition[];
|
|
67
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Create and configure an agentic MCP server with composed tools.
|
|
69
|
+
*
|
|
70
|
+
* This is the main entry point for building agentic MCP servers. It allows you to:
|
|
71
|
+
* - Reuse existing MCP tools from the community by selecting and composing them
|
|
72
|
+
* - Create powerful agentic tools by describing them in natural language with tool references
|
|
73
|
+
* - Fine-tune tool descriptions and parameters to fit your specific use cases
|
|
74
|
+
* - Build multi-agent systems where each agent is itself an MCP tool
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const server = await mcpc(
|
|
79
|
+
* [
|
|
80
|
+
* { name: "coding-agent", version: "1.0.0" },
|
|
81
|
+
* { capabilities: { tools: {}, sampling: {} } }
|
|
82
|
+
* ],
|
|
83
|
+
* [{
|
|
84
|
+
* name: "codex-fork",
|
|
85
|
+
* description: `A coding agent that can read files, search code, and create PRs.
|
|
86
|
+
* Available tools:
|
|
87
|
+
* <tool name="desktop-commander.read_file"/>
|
|
88
|
+
* <tool name="github.create_pull_request"/>`,
|
|
89
|
+
* deps: {
|
|
90
|
+
* mcpServers: {
|
|
91
|
+
* "desktop-commander": {
|
|
92
|
+
* command: "npx",
|
|
93
|
+
* args: ["-y", "@wonderwhy-er/desktop-commander@latest"],
|
|
94
|
+
* transportType: "stdio"
|
|
95
|
+
* },
|
|
96
|
+
* "github": {
|
|
97
|
+
* transportType: "streamable-http",
|
|
98
|
+
* url: "https://api.githubcopilot.com/mcp/",
|
|
99
|
+
* headers: { "Authorization": `Bearer ${process.env.GITHUB_TOKEN}` }
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* },
|
|
103
|
+
* plugins: [createLargeResultPlugin({ maxSize: 8000 })],
|
|
104
|
+
* options: { mode: "agentic", sampling: true }
|
|
105
|
+
* }]
|
|
106
|
+
* );
|
|
107
|
+
* await server.connect(new StdioServerTransport());
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @param serverConf - MCP server initialization parameters including name, version, and capabilities
|
|
111
|
+
* - First element: Server metadata (name, version)
|
|
112
|
+
* - Second element: Server capabilities (tools, sampling, etc.)
|
|
113
|
+
*
|
|
114
|
+
* @param composeConf - Array of agent composition definitions. Each definition includes:
|
|
115
|
+
* - name: Agent name (set to null for composition-only mode)
|
|
116
|
+
* - description: Agent purpose with XML-like tool references (e.g., `<tool name="server.tool"/>`)
|
|
117
|
+
* - deps: MCP server dependencies with transport configurations (stdio, sse, streamable-http)
|
|
118
|
+
* - plugins: Global plugins to transform/extend tool behavior (objects or file paths)
|
|
119
|
+
* - options: Execution mode settings (agentic, agentic_workflow, sampling)
|
|
120
|
+
*
|
|
121
|
+
* @param setupCallback - Optional callback to register custom tools or perform additional setup
|
|
122
|
+
* before composition. Useful for adding internal tools or custom configurations.
|
|
123
|
+
*
|
|
124
|
+
* @returns A configured MCP Server instance ready to connect to a transport
|
|
125
|
+
*
|
|
126
|
+
* @see {@link ComposeDefinition} for detailed composition configuration options
|
|
127
|
+
* @see {@link ToolPlugin} for plugin development guide
|
|
128
|
+
* @see https://github.com/mcpc-tech/mcpc/tree/main/docs for complete documentation
|
|
129
|
+
*/ export declare function mcpc(serverConf: ConstructorParameters<typeof ComposableMCPServer>, composeConf?: ComposeDefinition[], setupCallback?: (server: ComposableMCPServer) => void | Promise<void>): Promise<InstanceType<typeof ComposableMCPServer>>;
|
|
68
130
|
//# sourceMappingURL=set-up-mcp-compose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-up-mcp-compose.d.ts","sources":["../../src/set-up-mcp-compose.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAEhD,cAAc,QAAQ,2BAA2B;AACjD,cAAc,UAAU,6BAA6B;AACrD,cAAc,cAAc,qBAAqB;AACjD,cAAc,UAAU,4BAA4B;AACpD,cAAc,UAAU,qBAAqB;AAE7C,iBAAiB;EACf;;;GAGC,GACD,MAAM,MAAM,GAAG,IAAI;EACnB;;GAEC,GACD,cAAc,MAAM;EACpB,OAAO;EAEP;;;;;;;;;;;GAWC,GACD,WAAW,aAAa,MAAM;EAE9B;IACE;;;;;KAKC,GACD,OAAO,YAAY;IAEnB;;;;KAIC,GACD,WAAW,OAAO,GAAG;IAErB;;;;;KAKC,GACD,QAAQ;IAER;;;;;KAKC,GACD,oBAAoB,MAAM;IAE1B;;;;;KAKC,GACD;;;KAGC,GACD,OAAO,MAAM;;;AAMjB,iBAAiB;GACd,KAAK,MAAM,GAAG;;AAGjB,OAAO,iBAAS,iBACd,OAAO,mBAAmB,GACzB;AAuBH,OAAO,iBAAe,KACpB,YAAY,6BAA6B,oBAAoB,EAC7D,cAAc,mBAAmB,EACjC,iBAAiB,QAAQ,wBAAwB,IAAI,GAAG,QAAQ,IAAI,CAAC,GACpE,QAAQ,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"set-up-mcp-compose.d.ts","sources":["../../src/set-up-mcp-compose.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAmB,oBAAoB;AAEhD,cAAc,QAAQ,2BAA2B;AACjD,cAAc,UAAU,6BAA6B;AACrD,cAAc,cAAc,qBAAqB;AACjD,cAAc,UAAU,4BAA4B;AACpD,cAAc,UAAU,qBAAqB;AAE7C,iBAAiB;EACf;;;GAGC,GACD,MAAM,MAAM,GAAG,IAAI;EACnB;;GAEC,GACD,cAAc,MAAM;EACpB,OAAO;EAEP;;;;;;;;;;;GAWC,GACD,WAAW,aAAa,MAAM;EAE9B;IACE;;;;;KAKC,GACD,OAAO,YAAY;IAEnB;;;;KAIC,GACD,WAAW,OAAO,GAAG;IAErB;;;;;KAKC,GACD,QAAQ;IAER;;;;;KAKC,GACD,oBAAoB,MAAM;IAE1B;;;;;KAKC,GACD;;;KAGC,GACD,OAAO,MAAM;;;AAMjB,iBAAiB;GACd,KAAK,MAAM,GAAG;;AAGjB,OAAO,iBAAS,iBACd,OAAO,mBAAmB,GACzB;AAuBH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DC,GACD,OAAO,iBAAe,KACpB,YAAY,6BAA6B,oBAAoB,EAC7D,cAAc,mBAAmB,EACjC,iBAAiB,QAAQ,wBAAwB,IAAI,GAAG,QAAQ,IAAI,CAAC,GACpE,QAAQ,oBAAoB"}
|
|
@@ -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"}
|