@mastra/mcp 1.5.1-alpha.0 → 1.5.1
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 +20 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +6 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -31
- package/dist/index.js.map +1 -1
- package/package.json +11 -12
package/dist/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
|
-
import $RefParser from '@apidevtools/json-schema-ref-parser';
|
|
3
2
|
import { MastraBase } from '@mastra/core/base';
|
|
4
|
-
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
5
3
|
import { createTool, isValidationError } from '@mastra/core/tools';
|
|
6
4
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
7
5
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
@@ -10,6 +8,7 @@ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/
|
|
|
10
8
|
import { DEFAULT_REQUEST_TIMEOUT_MSEC } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
11
9
|
import { LoggingMessageNotificationSchema, ListRootsRequestSchema, ListResourcesResultSchema, ReadResourceResultSchema, EmptyResultSchema, ListResourceTemplatesResultSchema, ListPromptsResultSchema, GetPromptResultSchema, PromptListChangedNotificationSchema, ResourceUpdatedNotificationSchema, ResourceListChangedNotificationSchema, ElicitRequestSchema, ProgressNotificationSchema, ListToolsRequestSchema, CallToolRequestSchema, SetLevelRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListResourceTemplatesRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ListPromptsRequestSchema, PromptSchema, GetPromptRequestSchema, CallToolResultSchema, ErrorCode, JSONRPCMessageSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
12
10
|
import { asyncExitHook, gracefulExit } from 'exit-hook';
|
|
11
|
+
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
13
12
|
import equal from 'fast-deep-equal';
|
|
14
13
|
import { v5 } from 'uuid';
|
|
15
14
|
import { randomUUID } from 'crypto';
|
|
@@ -893,31 +892,7 @@ var InternalMastraMCPClient = class extends MastraBase {
|
|
|
893
892
|
});
|
|
894
893
|
}
|
|
895
894
|
async convertInputSchema(inputSchema) {
|
|
896
|
-
|
|
897
|
-
await $RefParser.dereference(inputSchema);
|
|
898
|
-
return "jsonSchema" in inputSchema ? inputSchema.jsonSchema : inputSchema;
|
|
899
|
-
} catch (error) {
|
|
900
|
-
let errorDetails;
|
|
901
|
-
if (error instanceof Error) {
|
|
902
|
-
errorDetails = error.stack;
|
|
903
|
-
} else {
|
|
904
|
-
try {
|
|
905
|
-
errorDetails = JSON.stringify(error);
|
|
906
|
-
} catch {
|
|
907
|
-
errorDetails = String(error);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
this.log("error", "Failed to dereference JSON schema", {
|
|
911
|
-
error: errorDetails,
|
|
912
|
-
originalJsonSchema: inputSchema
|
|
913
|
-
});
|
|
914
|
-
throw new MastraError({
|
|
915
|
-
id: "MCP_TOOL_INPUT_SCHEMA_CONVERSION_FAILED",
|
|
916
|
-
domain: ErrorDomain.MCP,
|
|
917
|
-
category: ErrorCategory.USER,
|
|
918
|
-
details: { error: errorDetails ?? "Unknown error" }
|
|
919
|
-
});
|
|
920
|
-
}
|
|
895
|
+
return "jsonSchema" in inputSchema ? inputSchema.jsonSchema : inputSchema;
|
|
921
896
|
}
|
|
922
897
|
async tools() {
|
|
923
898
|
this.log("debug", `Requesting tools from MCP server`);
|
|
@@ -2088,7 +2063,7 @@ function createSimpleTokenProvider(accessToken, options) {
|
|
|
2088
2063
|
});
|
|
2089
2064
|
}
|
|
2090
2065
|
|
|
2091
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
2066
|
+
// ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/stream.js
|
|
2092
2067
|
var StreamingApi = class {
|
|
2093
2068
|
writer;
|
|
2094
2069
|
encoder;
|
|
@@ -2165,7 +2140,7 @@ var StreamingApi = class {
|
|
|
2165
2140
|
}
|
|
2166
2141
|
};
|
|
2167
2142
|
|
|
2168
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
2143
|
+
// ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/helper/streaming/utils.js
|
|
2169
2144
|
var isOldBunVersion = () => {
|
|
2170
2145
|
const version = typeof Bun !== "undefined" ? Bun.version : void 0;
|
|
2171
2146
|
if (version === void 0) {
|
|
@@ -2176,7 +2151,7 @@ var isOldBunVersion = () => {
|
|
|
2176
2151
|
return result;
|
|
2177
2152
|
};
|
|
2178
2153
|
|
|
2179
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
2154
|
+
// ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/utils/html.js
|
|
2180
2155
|
var HtmlEscapedCallbackPhase = {
|
|
2181
2156
|
Stringify: 1};
|
|
2182
2157
|
var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
|
|
@@ -2207,7 +2182,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
2207
2182
|
}
|
|
2208
2183
|
};
|
|
2209
2184
|
|
|
2210
|
-
// ../../node_modules/.pnpm/hono@4.12.
|
|
2185
|
+
// ../../node_modules/.pnpm/hono@4.12.14/node_modules/hono/dist/helper/streaming/sse.js
|
|
2211
2186
|
var SSEStreamingApi = class extends StreamingApi {
|
|
2212
2187
|
constructor(writable, readable) {
|
|
2213
2188
|
super(writable, readable);
|