@mastra/mcp 0.11.4-alpha.0 → 0.12.0-alpha.0
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/CHANGELOG.md +29 -0
- package/dist/index.cjs +6 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -58
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts +5 -5
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/types.d.ts +1 -62
- package/dist/server/types.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
2
2
|
import { MastraBase } from '@mastra/core/base';
|
|
3
3
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
4
|
-
import { createTool
|
|
4
|
+
import { createTool } from '@mastra/core/tools';
|
|
5
5
|
import { makeCoreTool, isZodType } from '@mastra/core/utils';
|
|
6
6
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
7
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
@@ -1077,7 +1077,7 @@ var MCPConfiguration = class extends MCPClient {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
};
|
|
1079
1079
|
|
|
1080
|
-
// ../../node_modules/.pnpm/hono@4.
|
|
1080
|
+
// ../../node_modules/.pnpm/hono@4.9.6/node_modules/hono/dist/utils/stream.js
|
|
1081
1081
|
var StreamingApi = class {
|
|
1082
1082
|
writer;
|
|
1083
1083
|
encoder;
|
|
@@ -1144,7 +1144,7 @@ var StreamingApi = class {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
};
|
|
1146
1146
|
|
|
1147
|
-
// ../../node_modules/.pnpm/hono@4.
|
|
1147
|
+
// ../../node_modules/.pnpm/hono@4.9.6/node_modules/hono/dist/helper/streaming/utils.js
|
|
1148
1148
|
var isOldBunVersion = () => {
|
|
1149
1149
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
1150
1150
|
if (version === void 0) {
|
|
@@ -1155,7 +1155,7 @@ var isOldBunVersion = () => {
|
|
|
1155
1155
|
return result;
|
|
1156
1156
|
};
|
|
1157
1157
|
|
|
1158
|
-
// ../../node_modules/.pnpm/hono@4.
|
|
1158
|
+
// ../../node_modules/.pnpm/hono@4.9.6/node_modules/hono/dist/utils/html.js
|
|
1159
1159
|
var HtmlEscapedCallbackPhase = {
|
|
1160
1160
|
Stringify: 1};
|
|
1161
1161
|
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
@@ -1186,7 +1186,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
1186
1186
|
}
|
|
1187
1187
|
};
|
|
1188
1188
|
|
|
1189
|
-
// ../../node_modules/.pnpm/hono@4.
|
|
1189
|
+
// ../../node_modules/.pnpm/hono@4.9.6/node_modules/hono/dist/helper/streaming/sse.js
|
|
1190
1190
|
var SSEStreamingApi = class extends StreamingApi {
|
|
1191
1191
|
constructor(writable, readable) {
|
|
1192
1192
|
super(writable, readable);
|
|
@@ -2017,7 +2017,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
|
|
|
2017
2017
|
/**
|
|
2018
2018
|
* Convert and validate all provided tools, logging registration status.
|
|
2019
2019
|
* Also converts agents and workflows into tools.
|
|
2020
|
-
* @param tools Tool definitions
|
|
2020
|
+
* @param tools Tool definitions
|
|
2021
2021
|
* @param agentsConfig Agent definitions to be converted to tools, expected from MCPServerConfig
|
|
2022
2022
|
* @param workflowsConfig Workflow definitions to be converted to tools, expected from MCPServerConfig
|
|
2023
2023
|
* @returns Converted tools registry
|
|
@@ -2050,7 +2050,7 @@ Provided arguments: ${JSON.stringify(request.params.arguments, null, 2)}`
|
|
|
2050
2050
|
outputSchema: coreTool.outputSchema,
|
|
2051
2051
|
execute: coreTool.execute
|
|
2052
2052
|
};
|
|
2053
|
-
this.logger.info(`Registered tool: '${toolName}'`);
|
|
2053
|
+
this.logger.info(`Registered explicit tool: '${toolName}'`);
|
|
2054
2054
|
}
|
|
2055
2055
|
this.logger.info(`Total defined tools registered: ${Object.keys(definedConvertedTools).length}`);
|
|
2056
2056
|
let agentDerivedTools = {};
|
|
@@ -2643,57 +2643,7 @@ Provided arguments: ${JSON.stringify(args, null, 2)}`,
|
|
|
2643
2643
|
}
|
|
2644
2644
|
}
|
|
2645
2645
|
};
|
|
2646
|
-
function createMCPTool(opts) {
|
|
2647
|
-
let parameters;
|
|
2648
|
-
let outputSchema;
|
|
2649
|
-
if (opts.inputSchema) {
|
|
2650
|
-
parameters = {
|
|
2651
|
-
jsonSchema: opts.inputSchema,
|
|
2652
|
-
validate: (value) => {
|
|
2653
|
-
try {
|
|
2654
|
-
const result = opts.inputSchema.safeParse(value);
|
|
2655
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
2656
|
-
} catch (e) {
|
|
2657
|
-
return { success: false, error: e };
|
|
2658
|
-
}
|
|
2659
|
-
}
|
|
2660
|
-
};
|
|
2661
|
-
} else {
|
|
2662
|
-
parameters = void 0;
|
|
2663
|
-
}
|
|
2664
|
-
if (opts.outputSchema) {
|
|
2665
|
-
outputSchema = {
|
|
2666
|
-
jsonSchema: opts.outputSchema,
|
|
2667
|
-
validate: (value) => {
|
|
2668
|
-
try {
|
|
2669
|
-
const result = opts.outputSchema.safeParse(value);
|
|
2670
|
-
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
2671
|
-
} catch (e) {
|
|
2672
|
-
return { success: false, error: e };
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
}
|
|
2677
|
-
return {
|
|
2678
|
-
id: opts.id,
|
|
2679
|
-
description: opts.description,
|
|
2680
|
-
parameters,
|
|
2681
|
-
outputSchema,
|
|
2682
|
-
execute: async (params, options) => {
|
|
2683
|
-
const mcpOptions = {
|
|
2684
|
-
context: params,
|
|
2685
|
-
elicitation: options.elicitation,
|
|
2686
|
-
extra: options.extra
|
|
2687
|
-
};
|
|
2688
|
-
const { data, error } = validateToolInput(opts.inputSchema, params, opts.id);
|
|
2689
|
-
if (error) {
|
|
2690
|
-
return error;
|
|
2691
|
-
}
|
|
2692
|
-
return opts.execute(data, mcpOptions);
|
|
2693
|
-
}
|
|
2694
|
-
};
|
|
2695
|
-
}
|
|
2696
2646
|
|
|
2697
|
-
export { MCPClient, MCPConfiguration, MCPServer, MastraMCPClient
|
|
2647
|
+
export { MCPClient, MCPConfiguration, MCPServer, MastraMCPClient };
|
|
2698
2648
|
//# sourceMappingURL=index.js.map
|
|
2699
2649
|
//# sourceMappingURL=index.js.map
|