@mastra/mcp 0.6.0-alpha.1 → 0.10.1-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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +45 -0
- package/dist/_tsup-dts-rollup.d.cts +332 -40
- package/dist/_tsup-dts-rollup.d.ts +332 -40
- package/dist/index.cjs +599 -45
- package/dist/index.d.cts +14 -9
- package/dist/index.d.ts +14 -9
- package/dist/index.js +604 -50
- package/integration-tests/package.json +1 -1
- package/package.json +5 -4
- package/src/__fixtures__/fire-crawl-complex-schema.ts +1 -1
- package/src/__fixtures__/server-weather.ts +1 -1
- package/src/__fixtures__/weather.ts +122 -190
- package/src/{client.test.ts → client/client.test.ts} +27 -0
- package/src/{client.ts → client/client.ts} +58 -5
- package/src/{configuration.test.ts → client/configuration.test.ts} +133 -21
- package/src/{configuration.ts → client/configuration.ts} +64 -48
- package/src/client/resourceActions.ts +121 -0
- package/src/index.ts +4 -4
- package/src/server/resourceActions.ts +62 -0
- package/src/{server-logging.test.ts → server/server-logging.test.ts} +9 -7
- package/src/server/server.test.ts +1126 -0
- package/src/{server.ts → server/server.ts} +444 -16
- package/src/server.test.ts +0 -467
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.
|
|
2
|
+
> @mastra/mcp@0.10.1-alpha.0 build /home/runner/work/mastra/mastra/packages/mcp
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 18112ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
|
+
[34mCLI[39m Cleaning output folder
|
|
13
|
+
[34mESM[39m Build start
|
|
14
|
+
[34mCJS[39m Build start
|
|
12
15
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
16
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
17
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
18
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in 1226ms
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[32m36.64 KB[39m
|
|
23
|
-
[32mESM[39m ⚡️ Build success in 1226ms
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 19611ms
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m58.38 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 20895ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m58.17 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 20903ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.10.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ab89d6a: Adds support for the full resources spec for MCP in the MCPClient and MCPServer classes. Includes resources/list, resources/read, resources/templates/list, resources/subscribe, resources/unsubscribe, notifications/resources/list_changed, and notifications/resources/updated APIs.
|
|
8
|
+
- bf5f17b: Adds ability to pass workflows into MCPServer to generate tools from the workflows. Each workflow will become a tool that can start the workflow run.
|
|
9
|
+
- 38aee50: Adds ability to pass an agents into an MCPServer instance to automatically generate tools from them.
|
|
10
|
+
- Updated dependencies [200d0da]
|
|
11
|
+
- Updated dependencies [bf5f17b]
|
|
12
|
+
- Updated dependencies [5343f93]
|
|
13
|
+
- Updated dependencies [38aee50]
|
|
14
|
+
- Updated dependencies [5c41100]
|
|
15
|
+
- Updated dependencies [d6a759b]
|
|
16
|
+
- @mastra/core@0.10.1-alpha.1
|
|
17
|
+
|
|
18
|
+
## 0.10.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 83da932: Move @mastra/core to peerdeps
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 0a3ae6d: Fixed a bug where tool input schema properties that were optional became required
|
|
27
|
+
- 23f258c: Add new list and get routes for mcp servers. Changed route make-up for more consistency with existing API routes. Lastly, added in a lot of extra detail that can be optionally passed to the mcp server per the mcp spec.
|
|
28
|
+
- 2672a05: Add MCP servers and tool call execution to playground
|
|
29
|
+
- Updated dependencies [b3a3d63]
|
|
30
|
+
- Updated dependencies [344f453]
|
|
31
|
+
- Updated dependencies [0a3ae6d]
|
|
32
|
+
- Updated dependencies [95911be]
|
|
33
|
+
- Updated dependencies [f53a6ac]
|
|
34
|
+
- Updated dependencies [5eb5a99]
|
|
35
|
+
- Updated dependencies [7e632c5]
|
|
36
|
+
- Updated dependencies [1e9fbfa]
|
|
37
|
+
- Updated dependencies [eabdcd9]
|
|
38
|
+
- Updated dependencies [90be034]
|
|
39
|
+
- Updated dependencies [99f050a]
|
|
40
|
+
- Updated dependencies [d0ee3c6]
|
|
41
|
+
- Updated dependencies [b2ae5aa]
|
|
42
|
+
- Updated dependencies [23f258c]
|
|
43
|
+
- Updated dependencies [a7292b0]
|
|
44
|
+
- Updated dependencies [0dcb9f0]
|
|
45
|
+
- Updated dependencies [2672a05]
|
|
46
|
+
- @mastra/core@0.10.0
|
|
47
|
+
|
|
3
48
|
## 0.6.0-alpha.1
|
|
4
49
|
|
|
5
50
|
### Minor Changes
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { Agent } from '@mastra/core/agent';
|
|
1
2
|
import type { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
import type { ConvertedTool } from '@mastra/core/mcp';
|
|
3
4
|
import type * as http from 'node:http';
|
|
5
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
4
6
|
import { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
5
7
|
import { MastraBase } from '@mastra/core/base';
|
|
6
8
|
import { MCPServerBase } from '@mastra/core/mcp';
|
|
7
9
|
import type { MCPServerConfig } from '@mastra/core/mcp';
|
|
8
10
|
import type { MCPServerHonoSSEOptions } from '@mastra/core/mcp';
|
|
9
11
|
import type { MCPServerSSEOptions } from '@mastra/core/mcp';
|
|
10
|
-
import
|
|
12
|
+
import { objectInputType } from 'zod';
|
|
13
|
+
import { objectOutputType } from 'zod';
|
|
14
|
+
import { objectUtil } from 'zod';
|
|
15
|
+
import type { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
16
|
+
import type { ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
|
17
|
+
import { ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
11
18
|
import type { RuntimeContext } from '@mastra/core/di';
|
|
12
19
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
13
20
|
import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
@@ -23,7 +30,14 @@ import type { StreamableHTTPServerTransportOptions } from '@modelcontextprotocol
|
|
|
23
30
|
import { Tool } from '@mastra/core/tools';
|
|
24
31
|
import { ToolExecutionContext } from '@mastra/core';
|
|
25
32
|
import type { ToolsInput } from '@mastra/core/agent';
|
|
33
|
+
import type { Workflow } from '@mastra/core/workflows';
|
|
26
34
|
import { z } from 'zod';
|
|
35
|
+
import { ZodArray } from 'zod';
|
|
36
|
+
import { ZodObject } from 'zod';
|
|
37
|
+
import { ZodOptional } from 'zod';
|
|
38
|
+
import { ZodString } from 'zod';
|
|
39
|
+
import { ZodTypeAny } from 'zod';
|
|
40
|
+
import { ZodUnion } from 'zod';
|
|
27
41
|
|
|
28
42
|
export declare const allTools: ToolsInput;
|
|
29
43
|
|
|
@@ -56,6 +70,7 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
56
70
|
private serverConfig;
|
|
57
71
|
private transport?;
|
|
58
72
|
private currentOperationContext;
|
|
73
|
+
readonly resources: ResourceClientActions;
|
|
59
74
|
constructor({ name, version, server, capabilities, timeout, }: InternalMastraMCPClientOptions);
|
|
60
75
|
/**
|
|
61
76
|
* Log a message at the specified level
|
|
@@ -75,7 +90,89 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
75
90
|
*/
|
|
76
91
|
get sessionId(): string | undefined;
|
|
77
92
|
disconnect(): Promise<void>;
|
|
78
|
-
|
|
93
|
+
listResources(): Promise<z.objectOutputType<{
|
|
94
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
95
|
+
} & {
|
|
96
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
97
|
+
} & {
|
|
98
|
+
resources: z.ZodArray<z.ZodObject<{
|
|
99
|
+
uri: z.ZodString;
|
|
100
|
+
name: z.ZodString;
|
|
101
|
+
description: z.ZodOptional<z.ZodString>;
|
|
102
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
104
|
+
uri: z.ZodString;
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
description: z.ZodOptional<z.ZodString>;
|
|
107
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
109
|
+
uri: z.ZodString;
|
|
110
|
+
name: z.ZodString;
|
|
111
|
+
description: z.ZodOptional<z.ZodString>;
|
|
112
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
114
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
115
|
+
readResource(uri: string): Promise<z.objectOutputType<{
|
|
116
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
117
|
+
} & {
|
|
118
|
+
contents: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
119
|
+
uri: z.ZodString;
|
|
120
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, {
|
|
122
|
+
text: z.ZodString;
|
|
123
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
124
|
+
uri: z.ZodString;
|
|
125
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, {
|
|
127
|
+
text: z.ZodString;
|
|
128
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
129
|
+
uri: z.ZodString;
|
|
130
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, {
|
|
132
|
+
text: z.ZodString;
|
|
133
|
+
}>, z.ZodTypeAny, "passthrough">>, z.ZodObject<z.objectUtil.extendShape<{
|
|
134
|
+
uri: z.ZodString;
|
|
135
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, {
|
|
137
|
+
blob: z.ZodString;
|
|
138
|
+
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
139
|
+
uri: z.ZodString;
|
|
140
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
141
|
+
}, {
|
|
142
|
+
blob: z.ZodString;
|
|
143
|
+
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
144
|
+
uri: z.ZodString;
|
|
145
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, {
|
|
147
|
+
blob: z.ZodString;
|
|
148
|
+
}>, z.ZodTypeAny, "passthrough">>]>, "many">;
|
|
149
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
150
|
+
subscribeResource(uri: string): Promise<{}>;
|
|
151
|
+
unsubscribeResource(uri: string): Promise<{}>;
|
|
152
|
+
listResourceTemplates(): Promise<z.objectOutputType<{
|
|
153
|
+
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
154
|
+
} & {
|
|
155
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
156
|
+
} & {
|
|
157
|
+
resourceTemplates: z.ZodArray<z.ZodObject<{
|
|
158
|
+
uriTemplate: z.ZodString;
|
|
159
|
+
name: z.ZodString;
|
|
160
|
+
description: z.ZodOptional<z.ZodString>;
|
|
161
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
163
|
+
uriTemplate: z.ZodString;
|
|
164
|
+
name: z.ZodString;
|
|
165
|
+
description: z.ZodOptional<z.ZodString>;
|
|
166
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
168
|
+
uriTemplate: z.ZodString;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
description: z.ZodOptional<z.ZodString>;
|
|
171
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
173
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
174
|
+
setResourceUpdatedNotificationHandler(handler: (params: z.infer<typeof ResourceUpdatedNotificationSchema>['params']) => void): void;
|
|
175
|
+
setResourceListChangedNotificationHandler(handler: () => void): void;
|
|
79
176
|
private convertInputSchema;
|
|
80
177
|
tools(): Promise<Record<string, any>>;
|
|
81
178
|
}
|
|
@@ -135,21 +232,65 @@ declare class MCPClient extends MastraBase {
|
|
|
135
232
|
private mcpClientsById;
|
|
136
233
|
private disconnectPromise;
|
|
137
234
|
constructor(args: MCPClientOptions);
|
|
235
|
+
get resources(): {
|
|
236
|
+
list: () => Promise<Record<string, Resource[]>>;
|
|
237
|
+
templates: () => Promise<Record<string, ResourceTemplate[]>>;
|
|
238
|
+
read: (serverName: string, uri: string) => Promise<objectOutputType< {
|
|
239
|
+
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
240
|
+
} & {
|
|
241
|
+
contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
|
|
242
|
+
uri: ZodString;
|
|
243
|
+
mimeType: ZodOptional<ZodString>;
|
|
244
|
+
}, {
|
|
245
|
+
text: ZodString;
|
|
246
|
+
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
247
|
+
uri: ZodString;
|
|
248
|
+
mimeType: ZodOptional<ZodString>;
|
|
249
|
+
}, {
|
|
250
|
+
text: ZodString;
|
|
251
|
+
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
252
|
+
uri: ZodString;
|
|
253
|
+
mimeType: ZodOptional<ZodString>;
|
|
254
|
+
}, {
|
|
255
|
+
text: ZodString;
|
|
256
|
+
}>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
|
|
257
|
+
uri: ZodString;
|
|
258
|
+
mimeType: ZodOptional<ZodString>;
|
|
259
|
+
}, {
|
|
260
|
+
blob: ZodString;
|
|
261
|
+
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
262
|
+
uri: ZodString;
|
|
263
|
+
mimeType: ZodOptional<ZodString>;
|
|
264
|
+
}, {
|
|
265
|
+
blob: ZodString;
|
|
266
|
+
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
267
|
+
uri: ZodString;
|
|
268
|
+
mimeType: ZodOptional<ZodString>;
|
|
269
|
+
}, {
|
|
270
|
+
blob: ZodString;
|
|
271
|
+
}>, ZodTypeAny, "passthrough">>]>, "many">;
|
|
272
|
+
}, ZodTypeAny, "passthrough">>;
|
|
273
|
+
subscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
274
|
+
unsubscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
275
|
+
onUpdated: (serverName: string, handler: (params: {
|
|
276
|
+
uri: string;
|
|
277
|
+
}) => void) => Promise<void>;
|
|
278
|
+
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
279
|
+
};
|
|
138
280
|
private addToInstanceCache;
|
|
139
281
|
private makeId;
|
|
140
282
|
disconnect(): Promise<void>;
|
|
141
283
|
getTools(): Promise<Record<string, any>>;
|
|
142
284
|
getToolsets(): Promise<Record<string, Record<string, any>>>;
|
|
143
285
|
/**
|
|
144
|
-
*
|
|
145
|
-
* @returns A record of server names to their resources
|
|
286
|
+
* @deprecated all resource actions have been moved to the this.resources object. Use this.resources.list() instead.
|
|
146
287
|
*/
|
|
147
288
|
getResources(): Promise<Record<string, {
|
|
148
289
|
[x: string]: unknown;
|
|
149
|
-
name: string;
|
|
150
290
|
uri: string;
|
|
151
|
-
|
|
291
|
+
name: string;
|
|
152
292
|
description?: string | undefined;
|
|
293
|
+
mimeType?: string | undefined;
|
|
153
294
|
}[]>>;
|
|
154
295
|
/**
|
|
155
296
|
* Get the current session IDs for all connected MCP clients using the Streamable HTTP transport.
|
|
@@ -157,12 +298,8 @@ declare class MCPClient extends MastraBase {
|
|
|
157
298
|
*/
|
|
158
299
|
get sessionIds(): Record<string, string>;
|
|
159
300
|
private getConnectedClient;
|
|
301
|
+
private getConnectedClientForServer;
|
|
160
302
|
private eachClientTools;
|
|
161
|
-
/**
|
|
162
|
-
* Helper method to iterate through each connected MCP client and retrieve resources
|
|
163
|
-
* @param cb Callback function to process resources from each server
|
|
164
|
-
*/
|
|
165
|
-
private eachClientResources;
|
|
166
303
|
}
|
|
167
304
|
export { MCPClient }
|
|
168
305
|
export { MCPClient as MCPClient_alias_1 }
|
|
@@ -203,6 +340,16 @@ declare class MCPServer extends MCPServerBase {
|
|
|
203
340
|
private streamableHTTPTransport?;
|
|
204
341
|
private listToolsHandlerIsRegistered;
|
|
205
342
|
private callToolHandlerIsRegistered;
|
|
343
|
+
private listResourcesHandlerIsRegistered;
|
|
344
|
+
private readResourceHandlerIsRegistered;
|
|
345
|
+
private listResourceTemplatesHandlerIsRegistered;
|
|
346
|
+
private subscribeResourceHandlerIsRegistered;
|
|
347
|
+
private unsubscribeResourceHandlerIsRegistered;
|
|
348
|
+
private definedResources?;
|
|
349
|
+
private definedResourceTemplates?;
|
|
350
|
+
private resourceOptions?;
|
|
351
|
+
private subscriptions;
|
|
352
|
+
readonly resources: ServerResourceActions;
|
|
206
353
|
/**
|
|
207
354
|
* Get the current stdio transport.
|
|
208
355
|
*/
|
|
@@ -223,13 +370,20 @@ declare class MCPServer extends MCPServerBase {
|
|
|
223
370
|
* Construct a new MCPServer instance.
|
|
224
371
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
225
372
|
*/
|
|
226
|
-
constructor(opts: MCPServerConfig
|
|
373
|
+
constructor(opts: MCPServerConfig & {
|
|
374
|
+
resources?: MCPServerResources;
|
|
375
|
+
});
|
|
376
|
+
private convertAgentsToTools;
|
|
377
|
+
private convertWorkflowsToTools;
|
|
227
378
|
/**
|
|
228
379
|
* Convert and validate all provided tools, logging registration status.
|
|
380
|
+
* Also converts agents and workflows into tools.
|
|
229
381
|
* @param tools Tool definitions
|
|
382
|
+
* @param agentsConfig Agent definitions to be converted to tools, expected from MCPServerConfig
|
|
383
|
+
* @param workflowsConfig Workflow definitions to be converted to tools, expected from MCPServerConfig
|
|
230
384
|
* @returns Converted tools registry
|
|
231
385
|
*/
|
|
232
|
-
convertTools(tools: ToolsInput): Record<string, ConvertedTool>;
|
|
386
|
+
convertTools(tools: ToolsInput, agentsConfig?: Record<string, Agent>, workflowsConfig?: Record<string, Workflow>): Record<string, ConvertedTool>;
|
|
233
387
|
/**
|
|
234
388
|
* Register the ListTools handler for listing all available tools.
|
|
235
389
|
*/
|
|
@@ -238,6 +392,26 @@ declare class MCPServer extends MCPServerBase {
|
|
|
238
392
|
* Register the CallTool handler for executing a tool by name.
|
|
239
393
|
*/
|
|
240
394
|
private registerCallToolHandler;
|
|
395
|
+
/**
|
|
396
|
+
* Register the ListResources handler for listing all available resources.
|
|
397
|
+
*/
|
|
398
|
+
private registerListResourcesHandler;
|
|
399
|
+
/**
|
|
400
|
+
* Register the ReadResource handler for reading a resource by URI.
|
|
401
|
+
*/
|
|
402
|
+
private registerReadResourceHandler;
|
|
403
|
+
/**
|
|
404
|
+
* Register the ListResourceTemplates handler.
|
|
405
|
+
*/
|
|
406
|
+
private registerListResourceTemplatesHandler;
|
|
407
|
+
/**
|
|
408
|
+
* Register the SubscribeResource handler.
|
|
409
|
+
*/
|
|
410
|
+
private registerSubscribeResourceHandler;
|
|
411
|
+
/**
|
|
412
|
+
* Register the UnsubscribeResource handler.
|
|
413
|
+
*/
|
|
414
|
+
private registerUnsubscribeResourceHandler;
|
|
241
415
|
/**
|
|
242
416
|
* Start the MCP server using stdio transport (for Windsurf integration).
|
|
243
417
|
*/
|
|
@@ -342,6 +516,117 @@ export { MCPServer as MCPServer_alias_1 }
|
|
|
342
516
|
|
|
343
517
|
export declare const mcpServerName = "firecrawl-mcp-fixture";
|
|
344
518
|
|
|
519
|
+
declare type MCPServerResourceContent = {
|
|
520
|
+
text?: string;
|
|
521
|
+
} | {
|
|
522
|
+
blob?: string;
|
|
523
|
+
};
|
|
524
|
+
export { MCPServerResourceContent }
|
|
525
|
+
export { MCPServerResourceContent as MCPServerResourceContent_alias_1 }
|
|
526
|
+
|
|
527
|
+
declare type MCPServerResourceContentCallback = ({ uri, }: {
|
|
528
|
+
uri: string;
|
|
529
|
+
}) => Promise<MCPServerResourceContent | MCPServerResourceContent[]>;
|
|
530
|
+
export { MCPServerResourceContentCallback }
|
|
531
|
+
export { MCPServerResourceContentCallback as MCPServerResourceContentCallback_alias_1 }
|
|
532
|
+
|
|
533
|
+
declare type MCPServerResources = {
|
|
534
|
+
listResources: () => Promise<Resource[]>;
|
|
535
|
+
getResourceContent: MCPServerResourceContentCallback;
|
|
536
|
+
resourceTemplates?: () => Promise<ResourceTemplate[]>;
|
|
537
|
+
};
|
|
538
|
+
export { MCPServerResources }
|
|
539
|
+
export { MCPServerResources as MCPServerResources_alias_1 }
|
|
540
|
+
|
|
541
|
+
export { Resource }
|
|
542
|
+
export { Resource as Resource_alias_1 }
|
|
543
|
+
|
|
544
|
+
export declare class ResourceClientActions {
|
|
545
|
+
private readonly client;
|
|
546
|
+
private readonly logger;
|
|
547
|
+
constructor({ client, logger }: ResourceClientActionsConfig);
|
|
548
|
+
/**
|
|
549
|
+
* Get all resources from the connected MCP server.
|
|
550
|
+
* @returns A list of resources.
|
|
551
|
+
*/
|
|
552
|
+
list(): Promise<Resource[]>;
|
|
553
|
+
/**
|
|
554
|
+
* Get all resource templates from the connected MCP server.
|
|
555
|
+
* @returns A list of resource templates.
|
|
556
|
+
*/
|
|
557
|
+
templates(): Promise<ResourceTemplate[]>;
|
|
558
|
+
/**
|
|
559
|
+
* Read a specific resource.
|
|
560
|
+
* @param uri The URI of the resource to read.
|
|
561
|
+
* @returns The resource content.
|
|
562
|
+
*/
|
|
563
|
+
read(uri: string): Promise<objectOutputType< {
|
|
564
|
+
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
565
|
+
} & {
|
|
566
|
+
contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
|
|
567
|
+
uri: ZodString;
|
|
568
|
+
mimeType: ZodOptional<ZodString>;
|
|
569
|
+
}, {
|
|
570
|
+
text: ZodString;
|
|
571
|
+
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
572
|
+
uri: ZodString;
|
|
573
|
+
mimeType: ZodOptional<ZodString>;
|
|
574
|
+
}, {
|
|
575
|
+
text: ZodString;
|
|
576
|
+
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
577
|
+
uri: ZodString;
|
|
578
|
+
mimeType: ZodOptional<ZodString>;
|
|
579
|
+
}, {
|
|
580
|
+
text: ZodString;
|
|
581
|
+
}>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
|
|
582
|
+
uri: ZodString;
|
|
583
|
+
mimeType: ZodOptional<ZodString>;
|
|
584
|
+
}, {
|
|
585
|
+
blob: ZodString;
|
|
586
|
+
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
587
|
+
uri: ZodString;
|
|
588
|
+
mimeType: ZodOptional<ZodString>;
|
|
589
|
+
}, {
|
|
590
|
+
blob: ZodString;
|
|
591
|
+
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
592
|
+
uri: ZodString;
|
|
593
|
+
mimeType: ZodOptional<ZodString>;
|
|
594
|
+
}, {
|
|
595
|
+
blob: ZodString;
|
|
596
|
+
}>, ZodTypeAny, "passthrough">>]>, "many">;
|
|
597
|
+
}, ZodTypeAny, "passthrough">>;
|
|
598
|
+
/**
|
|
599
|
+
* Subscribe to a specific resource.
|
|
600
|
+
* @param uri The URI of the resource to subscribe to.
|
|
601
|
+
*/
|
|
602
|
+
subscribe(uri: string): Promise<{}>;
|
|
603
|
+
/**
|
|
604
|
+
* Unsubscribe from a specific resource.
|
|
605
|
+
* @param uri The URI of the resource to unsubscribe from.
|
|
606
|
+
*/
|
|
607
|
+
unsubscribe(uri: string): Promise<{}>;
|
|
608
|
+
/**
|
|
609
|
+
* Set a notification handler for when a specific resource is updated.
|
|
610
|
+
* @param handler The callback function to handle the notification.
|
|
611
|
+
*/
|
|
612
|
+
onUpdated(handler: (params: {
|
|
613
|
+
uri: string;
|
|
614
|
+
}) => void): Promise<void>;
|
|
615
|
+
/**
|
|
616
|
+
* Set a notification handler for when the list of available resources changes.
|
|
617
|
+
* @param handler The callback function to handle the notification.
|
|
618
|
+
*/
|
|
619
|
+
onListChanged(handler: () => void): Promise<void>;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
declare interface ResourceClientActionsConfig {
|
|
623
|
+
client: InternalMastraMCPClient;
|
|
624
|
+
logger: IMastraLogger;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export { ResourceTemplate }
|
|
628
|
+
export { ResourceTemplate as ResourceTemplate_alias_1 }
|
|
629
|
+
|
|
345
630
|
export declare const server: Server<{
|
|
346
631
|
method: string;
|
|
347
632
|
params?: {
|
|
@@ -366,29 +651,36 @@ export declare const server: Server<{
|
|
|
366
651
|
} | undefined;
|
|
367
652
|
}>;
|
|
368
653
|
|
|
369
|
-
export declare const server_alias_1:
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
654
|
+
export declare const server_alias_1: MCPServer;
|
|
655
|
+
|
|
656
|
+
export declare class ServerResourceActions {
|
|
657
|
+
private readonly getSubscriptions;
|
|
658
|
+
private readonly getLogger;
|
|
659
|
+
private readonly getSdkServer;
|
|
660
|
+
private readonly clearDefinedResources;
|
|
661
|
+
private readonly clearDefinedResourceTemplates;
|
|
662
|
+
constructor(dependencies: ServerResourceActionsDependencies);
|
|
663
|
+
/**
|
|
664
|
+
* Checks if any resources have been updated.
|
|
665
|
+
* If the resource is subscribed to by clients, an update notification will be sent.
|
|
666
|
+
*/
|
|
667
|
+
notifyUpdated({ uri }: {
|
|
668
|
+
uri: string;
|
|
669
|
+
}): Promise<void>;
|
|
670
|
+
/**
|
|
671
|
+
* Notifies the server that the overall list of available resources has changed.
|
|
672
|
+
* This will clear the internal cache of defined resources and send a list_changed notification to clients.
|
|
673
|
+
*/
|
|
674
|
+
notifyListChanged(): Promise<void>;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
declare interface ServerResourceActionsDependencies {
|
|
678
|
+
getSubscriptions: () => Set<string>;
|
|
679
|
+
getLogger: () => IMastraLogger;
|
|
680
|
+
getSdkServer: () => Server;
|
|
681
|
+
clearDefinedResources: () => void;
|
|
682
|
+
clearDefinedResourceTemplates: () => void;
|
|
683
|
+
}
|
|
392
684
|
|
|
393
685
|
declare type StdioServerDefinition = BaseServerOptions & {
|
|
394
686
|
command: string;
|
|
@@ -416,16 +708,16 @@ windGust: z.ZodNumber;
|
|
|
416
708
|
conditions: z.ZodString;
|
|
417
709
|
location: z.ZodString;
|
|
418
710
|
}, "strip", z.ZodTypeAny, {
|
|
419
|
-
location: string;
|
|
420
711
|
temperature: number;
|
|
712
|
+
location: string;
|
|
421
713
|
feelsLike: number;
|
|
422
714
|
humidity: number;
|
|
423
715
|
windSpeed: number;
|
|
424
716
|
windGust: number;
|
|
425
717
|
conditions: string;
|
|
426
718
|
}, {
|
|
427
|
-
location: string;
|
|
428
719
|
temperature: number;
|
|
720
|
+
location: string;
|
|
429
721
|
feelsLike: number;
|
|
430
722
|
humidity: number;
|
|
431
723
|
windSpeed: number;
|
|
@@ -454,16 +746,16 @@ location: string;
|
|
|
454
746
|
conditions: z.ZodString;
|
|
455
747
|
location: z.ZodString;
|
|
456
748
|
}, "strip", z.ZodTypeAny, {
|
|
457
|
-
location: string;
|
|
458
749
|
temperature: number;
|
|
750
|
+
location: string;
|
|
459
751
|
feelsLike: number;
|
|
460
752
|
humidity: number;
|
|
461
753
|
windSpeed: number;
|
|
462
754
|
windGust: number;
|
|
463
755
|
conditions: string;
|
|
464
756
|
}, {
|
|
465
|
-
location: string;
|
|
466
757
|
temperature: number;
|
|
758
|
+
location: string;
|
|
467
759
|
feelsLike: number;
|
|
468
760
|
humidity: number;
|
|
469
761
|
windSpeed: number;
|