@mastra/mcp 0.10.8 → 0.10.9
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 +2 -21
- package/CHANGELOG.md +25 -0
- package/dist/__fixtures__/fire-crawl-complex-schema.d.ts +5 -0
- package/dist/__fixtures__/fire-crawl-complex-schema.d.ts.map +1 -0
- package/dist/__fixtures__/server-weather.d.ts +2 -0
- package/dist/__fixtures__/server-weather.d.ts.map +1 -0
- package/dist/__fixtures__/stock-price.d.ts +26 -0
- package/dist/__fixtures__/stock-price.d.ts.map +1 -0
- package/dist/__fixtures__/tools.d.ts +15 -0
- package/dist/__fixtures__/tools.d.ts.map +1 -0
- package/dist/__fixtures__/weather.d.ts +4 -0
- package/dist/__fixtures__/weather.d.ts.map +1 -0
- package/dist/client/client.d.ts +225 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/configuration.d.ts +190 -0
- package/dist/client/configuration.d.ts.map +1 -0
- package/dist/client/elicitationActions.d.ts +19 -0
- package/dist/client/elicitationActions.d.ts.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/promptActions.d.ts +39 -0
- package/dist/client/promptActions.d.ts.map +1 -0
- package/dist/client/resourceActions.d.ts +92 -0
- package/dist/client/resourceActions.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -21
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/promptActions.d.ts +20 -0
- package/dist/server/promptActions.d.ts.map +1 -0
- package/dist/server/resourceActions.d.ts +31 -0
- package/dist/server/resourceActions.d.ts.map +1 -0
- package/dist/server/server.d.ts +196 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/types.d.ts +41 -0
- package/dist/server/types.d.ts.map +1 -0
- package/package.json +5 -5
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +22 -0
- package/dist/_tsup-dts-rollup.d.cts +0 -987
- package/dist/_tsup-dts-rollup.d.ts +0 -987
- package/dist/index.d.cts +0 -21
|
@@ -1,987 +0,0 @@
|
|
|
1
|
-
import type { Agent } from '@mastra/core/agent';
|
|
2
|
-
import type { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
-
import type { ConvertedTool } from '@mastra/core/mcp';
|
|
4
|
-
import type { ElicitRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import type { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type * as http from 'node:http';
|
|
8
|
-
import type { IMastraLogger } from '@mastra/core/logger';
|
|
9
|
-
import type { InternalCoreTool } from '@mastra/core';
|
|
10
|
-
import type { ListPromptsResult } from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
-
import { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
12
|
-
import { MastraBase } from '@mastra/core/base';
|
|
13
|
-
import { MCPServerBase } from '@mastra/core/mcp';
|
|
14
|
-
import type { MCPServerConfig } from '@mastra/core/mcp';
|
|
15
|
-
import type { MCPServerHonoSSEOptions } from '@mastra/core/mcp';
|
|
16
|
-
import type { MCPServerSSEOptions } from '@mastra/core/mcp';
|
|
17
|
-
import type { MCPToolType } from '@mastra/core/mcp';
|
|
18
|
-
import { objectInputType } from 'zod';
|
|
19
|
-
import { objectOutputType } from 'zod';
|
|
20
|
-
import { objectUtil } from 'zod';
|
|
21
|
-
import type { Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
22
|
-
import type { PromptMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
23
|
-
import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
24
|
-
import type { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
25
|
-
import type { ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
|
26
|
-
import { ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
27
|
-
import type { RuntimeContext } from '@mastra/core/di';
|
|
28
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
29
|
-
import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
30
|
-
import type { ServerInfo } from '@mastra/core/mcp';
|
|
31
|
-
import type { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
32
|
-
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
33
|
-
import type { SSEStreamingApi } from 'hono/streaming';
|
|
34
|
-
import { SSETransport } from 'hono-mcp-server-sse-transport';
|
|
35
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
36
|
-
import type { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
37
|
-
import type { StreamableHTTPServerTransportOptions } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
38
|
-
import { Tool } from '@mastra/core/tools';
|
|
39
|
-
import { ToolExecutionContext } from '@mastra/core';
|
|
40
|
-
import type { ToolsInput } from '@mastra/core/agent';
|
|
41
|
-
import type { Workflow } from '@mastra/core/workflows';
|
|
42
|
-
import { z } from 'zod';
|
|
43
|
-
import { ZodArray } from 'zod';
|
|
44
|
-
import { ZodObject } from 'zod';
|
|
45
|
-
import { ZodOptional } from 'zod';
|
|
46
|
-
import { ZodString } from 'zod';
|
|
47
|
-
import { ZodTypeAny } from 'zod';
|
|
48
|
-
import { ZodUnion } from 'zod';
|
|
49
|
-
|
|
50
|
-
export declare const allTools: ToolsInput;
|
|
51
|
-
|
|
52
|
-
declare type BaseServerOptions = {
|
|
53
|
-
logger?: LogHandler;
|
|
54
|
-
timeout?: number;
|
|
55
|
-
capabilities?: ClientCapabilities;
|
|
56
|
-
enableServerLogs?: boolean;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
declare type ElicitationActions = {
|
|
60
|
-
sendRequest: (request: ElicitRequest['params']) => Promise<ElicitResult>;
|
|
61
|
-
};
|
|
62
|
-
export { ElicitationActions }
|
|
63
|
-
export { ElicitationActions as ElicitationActions_alias_1 }
|
|
64
|
-
export { ElicitationActions as ElicitationActions_alias_2 }
|
|
65
|
-
|
|
66
|
-
export declare class ElicitationClientActions {
|
|
67
|
-
private readonly client;
|
|
68
|
-
private readonly logger;
|
|
69
|
-
constructor({ client, logger }: ElicitationClientActionsConfig);
|
|
70
|
-
/**
|
|
71
|
-
* Set a handler for elicitation requests.
|
|
72
|
-
* @param handler The callback function to handle the elicitation request.
|
|
73
|
-
*/
|
|
74
|
-
onRequest(handler: (request: ElicitRequest['params']) => Promise<ElicitResult>): void;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
declare interface ElicitationClientActionsConfig {
|
|
78
|
-
client: InternalMastraMCPClient;
|
|
79
|
-
logger: IMastraLogger;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
declare type ElicitationHandler = (request: ElicitRequest['params']) => Promise<ElicitResult>;
|
|
83
|
-
export { ElicitationHandler }
|
|
84
|
-
export { ElicitationHandler as ElicitationHandler_alias_1 }
|
|
85
|
-
export { ElicitationHandler as ElicitationHandler_alias_2 }
|
|
86
|
-
|
|
87
|
-
declare type HttpServerDefinition = BaseServerOptions & {
|
|
88
|
-
url: URL;
|
|
89
|
-
command?: never;
|
|
90
|
-
args?: never;
|
|
91
|
-
env?: never;
|
|
92
|
-
requestInit?: StreamableHTTPClientTransportOptions['requestInit'];
|
|
93
|
-
eventSourceInit?: SSEClientTransportOptions['eventSourceInit'];
|
|
94
|
-
reconnectionOptions?: StreamableHTTPClientTransportOptions['reconnectionOptions'];
|
|
95
|
-
sessionId?: StreamableHTTPClientTransportOptions['sessionId'];
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export declare class InternalMastraMCPClient extends MastraBase {
|
|
99
|
-
name: string;
|
|
100
|
-
private client;
|
|
101
|
-
private readonly timeout;
|
|
102
|
-
private logHandler?;
|
|
103
|
-
private enableServerLogs?;
|
|
104
|
-
private serverConfig;
|
|
105
|
-
private transport?;
|
|
106
|
-
private currentOperationContext;
|
|
107
|
-
readonly resources: ResourceClientActions;
|
|
108
|
-
readonly prompts: PromptClientActions;
|
|
109
|
-
readonly elicitation: ElicitationClientActions;
|
|
110
|
-
constructor({ name, version, server, capabilities, timeout, }: InternalMastraMCPClientOptions);
|
|
111
|
-
/**
|
|
112
|
-
* Log a message at the specified level
|
|
113
|
-
* @param level Log level
|
|
114
|
-
* @param message Log message
|
|
115
|
-
* @param details Optional additional details
|
|
116
|
-
*/
|
|
117
|
-
private log;
|
|
118
|
-
private setupLogging;
|
|
119
|
-
private connectStdio;
|
|
120
|
-
private connectHttp;
|
|
121
|
-
private isConnected;
|
|
122
|
-
connect(): Promise<boolean>;
|
|
123
|
-
/**
|
|
124
|
-
* Get the current session ID if using the Streamable HTTP transport.
|
|
125
|
-
* Returns undefined if not connected or not using Streamable HTTP.
|
|
126
|
-
*/
|
|
127
|
-
get sessionId(): string | undefined;
|
|
128
|
-
disconnect(): Promise<void>;
|
|
129
|
-
listResources(): Promise<z.objectOutputType<{
|
|
130
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
131
|
-
} & {
|
|
132
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
133
|
-
} & {
|
|
134
|
-
resources: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
135
|
-
name: z.ZodString;
|
|
136
|
-
title: z.ZodOptional<z.ZodString>;
|
|
137
|
-
}, {
|
|
138
|
-
uri: z.ZodString;
|
|
139
|
-
description: z.ZodOptional<z.ZodString>;
|
|
140
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
141
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
142
|
-
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
143
|
-
name: z.ZodString;
|
|
144
|
-
title: z.ZodOptional<z.ZodString>;
|
|
145
|
-
}, {
|
|
146
|
-
uri: z.ZodString;
|
|
147
|
-
description: z.ZodOptional<z.ZodString>;
|
|
148
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
149
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
150
|
-
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
151
|
-
name: z.ZodString;
|
|
152
|
-
title: z.ZodOptional<z.ZodString>;
|
|
153
|
-
}, {
|
|
154
|
-
uri: z.ZodString;
|
|
155
|
-
description: z.ZodOptional<z.ZodString>;
|
|
156
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
157
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
158
|
-
}>, z.ZodTypeAny, "passthrough">>, "many">;
|
|
159
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
160
|
-
readResource(uri: string): Promise<z.objectOutputType<{
|
|
161
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
162
|
-
} & {
|
|
163
|
-
contents: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
164
|
-
uri: z.ZodString;
|
|
165
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
166
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
167
|
-
}, {
|
|
168
|
-
text: z.ZodString;
|
|
169
|
-
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
170
|
-
uri: z.ZodString;
|
|
171
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
172
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
173
|
-
}, {
|
|
174
|
-
text: z.ZodString;
|
|
175
|
-
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
176
|
-
uri: z.ZodString;
|
|
177
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
178
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
179
|
-
}, {
|
|
180
|
-
text: z.ZodString;
|
|
181
|
-
}>, z.ZodTypeAny, "passthrough">>, z.ZodObject<z.objectUtil.extendShape<{
|
|
182
|
-
uri: z.ZodString;
|
|
183
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
184
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
185
|
-
}, {
|
|
186
|
-
blob: z.ZodString;
|
|
187
|
-
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
188
|
-
uri: z.ZodString;
|
|
189
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
190
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
191
|
-
}, {
|
|
192
|
-
blob: z.ZodString;
|
|
193
|
-
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
194
|
-
uri: z.ZodString;
|
|
195
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
196
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
197
|
-
}, {
|
|
198
|
-
blob: z.ZodString;
|
|
199
|
-
}>, z.ZodTypeAny, "passthrough">>]>, "many">;
|
|
200
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
201
|
-
subscribeResource(uri: string): Promise<{}>;
|
|
202
|
-
unsubscribeResource(uri: string): Promise<{}>;
|
|
203
|
-
listResourceTemplates(): Promise<z.objectOutputType<{
|
|
204
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
205
|
-
} & {
|
|
206
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
207
|
-
} & {
|
|
208
|
-
resourceTemplates: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
|
|
209
|
-
name: z.ZodString;
|
|
210
|
-
title: z.ZodOptional<z.ZodString>;
|
|
211
|
-
}, {
|
|
212
|
-
uriTemplate: z.ZodString;
|
|
213
|
-
description: z.ZodOptional<z.ZodString>;
|
|
214
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
215
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
216
|
-
}>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
|
|
217
|
-
name: z.ZodString;
|
|
218
|
-
title: z.ZodOptional<z.ZodString>;
|
|
219
|
-
}, {
|
|
220
|
-
uriTemplate: z.ZodString;
|
|
221
|
-
description: z.ZodOptional<z.ZodString>;
|
|
222
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
223
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
224
|
-
}>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
|
|
225
|
-
name: z.ZodString;
|
|
226
|
-
title: z.ZodOptional<z.ZodString>;
|
|
227
|
-
}, {
|
|
228
|
-
uriTemplate: z.ZodString;
|
|
229
|
-
description: z.ZodOptional<z.ZodString>;
|
|
230
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
231
|
-
_meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
232
|
-
}>, z.ZodTypeAny, "passthrough">>, "many">;
|
|
233
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
234
|
-
/**
|
|
235
|
-
* Fetch the list of available prompts from the MCP server.
|
|
236
|
-
*/
|
|
237
|
-
listPrompts(): Promise<ListPromptsResult>;
|
|
238
|
-
/**
|
|
239
|
-
* Get a prompt and its dynamic messages from the server.
|
|
240
|
-
* @param name The prompt name
|
|
241
|
-
* @param args Arguments for the prompt
|
|
242
|
-
* @param version (optional) The prompt version to retrieve
|
|
243
|
-
*/
|
|
244
|
-
getPrompt({ name, args, version, }: {
|
|
245
|
-
name: string;
|
|
246
|
-
args?: Record<string, any>;
|
|
247
|
-
version?: string;
|
|
248
|
-
}): Promise<GetPromptResult>;
|
|
249
|
-
/**
|
|
250
|
-
* Register a handler to be called when the prompt list changes on the server.
|
|
251
|
-
* Use this to refresh cached prompt lists in the client/UI if needed.
|
|
252
|
-
*/
|
|
253
|
-
setPromptListChangedNotificationHandler(handler: () => void): void;
|
|
254
|
-
setResourceUpdatedNotificationHandler(handler: (params: z.infer<typeof ResourceUpdatedNotificationSchema>['params']) => void): void;
|
|
255
|
-
setResourceListChangedNotificationHandler(handler: () => void): void;
|
|
256
|
-
setElicitationRequestHandler(handler: ElicitationHandler): void;
|
|
257
|
-
private convertInputSchema;
|
|
258
|
-
private convertOutputSchema;
|
|
259
|
-
tools(): Promise<Record<string, any>>;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export declare type InternalMastraMCPClientOptions = {
|
|
263
|
-
name: string;
|
|
264
|
-
server: MastraMCPServerDefinition;
|
|
265
|
-
capabilities?: ClientCapabilities;
|
|
266
|
-
version?: string;
|
|
267
|
-
timeout?: number;
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
export { LoggingLevel }
|
|
271
|
-
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
272
|
-
export { LoggingLevel as LoggingLevel_alias_2 }
|
|
273
|
-
|
|
274
|
-
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
275
|
-
export { LogHandler }
|
|
276
|
-
export { LogHandler as LogHandler_alias_1 }
|
|
277
|
-
export { LogHandler as LogHandler_alias_2 }
|
|
278
|
-
|
|
279
|
-
declare interface LogMessage {
|
|
280
|
-
level: LoggingLevel;
|
|
281
|
-
message: string;
|
|
282
|
-
timestamp: Date;
|
|
283
|
-
serverName: string;
|
|
284
|
-
details?: Record<string, any>;
|
|
285
|
-
runtimeContext?: RuntimeContext | null;
|
|
286
|
-
}
|
|
287
|
-
export { LogMessage }
|
|
288
|
-
export { LogMessage as LogMessage_alias_1 }
|
|
289
|
-
export { LogMessage as LogMessage_alias_2 }
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* @deprecated MastraMCPClient is deprecated and will be removed in a future release. Please use MCPClient instead.
|
|
293
|
-
*/
|
|
294
|
-
declare class MastraMCPClient extends InternalMastraMCPClient {
|
|
295
|
-
constructor(args: InternalMastraMCPClientOptions);
|
|
296
|
-
}
|
|
297
|
-
export { MastraMCPClient }
|
|
298
|
-
export { MastraMCPClient as MastraMCPClient_alias_1 }
|
|
299
|
-
export { MastraMCPClient as MastraMCPClient_alias_2 }
|
|
300
|
-
|
|
301
|
-
declare type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefinition;
|
|
302
|
-
export { MastraMCPServerDefinition }
|
|
303
|
-
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_1 }
|
|
304
|
-
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_2 }
|
|
305
|
-
|
|
306
|
-
declare class MCPClient extends MastraBase {
|
|
307
|
-
private serverConfigs;
|
|
308
|
-
private id;
|
|
309
|
-
private defaultTimeout;
|
|
310
|
-
private mcpClientsById;
|
|
311
|
-
private disconnectPromise;
|
|
312
|
-
constructor(args: MCPClientOptions);
|
|
313
|
-
get elicitation(): {
|
|
314
|
-
onRequest: (serverName: string, handler: (request: ElicitRequest["params"]) => Promise<ElicitResult>) => Promise<void>;
|
|
315
|
-
};
|
|
316
|
-
get resources(): {
|
|
317
|
-
list: () => Promise<Record<string, Resource[]>>;
|
|
318
|
-
templates: () => Promise<Record<string, ResourceTemplate[]>>;
|
|
319
|
-
read: (serverName: string, uri: string) => Promise<objectOutputType< {
|
|
320
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
321
|
-
} & {
|
|
322
|
-
contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
|
|
323
|
-
uri: ZodString;
|
|
324
|
-
mimeType: ZodOptional<ZodString>;
|
|
325
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
326
|
-
}, {
|
|
327
|
-
text: ZodString;
|
|
328
|
-
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
329
|
-
uri: ZodString;
|
|
330
|
-
mimeType: ZodOptional<ZodString>;
|
|
331
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
332
|
-
}, {
|
|
333
|
-
text: ZodString;
|
|
334
|
-
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
335
|
-
uri: ZodString;
|
|
336
|
-
mimeType: ZodOptional<ZodString>;
|
|
337
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
338
|
-
}, {
|
|
339
|
-
text: ZodString;
|
|
340
|
-
}>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
|
|
341
|
-
uri: ZodString;
|
|
342
|
-
mimeType: ZodOptional<ZodString>;
|
|
343
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
344
|
-
}, {
|
|
345
|
-
blob: ZodString;
|
|
346
|
-
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
347
|
-
uri: ZodString;
|
|
348
|
-
mimeType: ZodOptional<ZodString>;
|
|
349
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
350
|
-
}, {
|
|
351
|
-
blob: ZodString;
|
|
352
|
-
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
353
|
-
uri: ZodString;
|
|
354
|
-
mimeType: ZodOptional<ZodString>;
|
|
355
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
356
|
-
}, {
|
|
357
|
-
blob: ZodString;
|
|
358
|
-
}>, ZodTypeAny, "passthrough">>]>, "many">;
|
|
359
|
-
}, ZodTypeAny, "passthrough">>;
|
|
360
|
-
subscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
361
|
-
unsubscribe: (serverName: string, uri: string) => Promise<{}>;
|
|
362
|
-
onUpdated: (serverName: string, handler: (params: {
|
|
363
|
-
uri: string;
|
|
364
|
-
}) => void) => Promise<void>;
|
|
365
|
-
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
366
|
-
};
|
|
367
|
-
get prompts(): {
|
|
368
|
-
list: () => Promise<Record<string, Prompt[]>>;
|
|
369
|
-
get: ({ serverName, name, args, version }: {
|
|
370
|
-
serverName: string;
|
|
371
|
-
name: string;
|
|
372
|
-
args?: Record<string, any>;
|
|
373
|
-
version?: string;
|
|
374
|
-
}) => Promise<{
|
|
375
|
-
[x: string]: unknown;
|
|
376
|
-
messages: {
|
|
377
|
-
[x: string]: unknown;
|
|
378
|
-
content: {
|
|
379
|
-
[x: string]: unknown;
|
|
380
|
-
type: "text";
|
|
381
|
-
text: string;
|
|
382
|
-
_meta?: {
|
|
383
|
-
[x: string]: unknown;
|
|
384
|
-
} | undefined;
|
|
385
|
-
} | {
|
|
386
|
-
[x: string]: unknown;
|
|
387
|
-
type: "image";
|
|
388
|
-
data: string;
|
|
389
|
-
mimeType: string;
|
|
390
|
-
_meta?: {
|
|
391
|
-
[x: string]: unknown;
|
|
392
|
-
} | undefined;
|
|
393
|
-
} | {
|
|
394
|
-
[x: string]: unknown;
|
|
395
|
-
type: "audio";
|
|
396
|
-
data: string;
|
|
397
|
-
mimeType: string;
|
|
398
|
-
_meta?: {
|
|
399
|
-
[x: string]: unknown;
|
|
400
|
-
} | undefined;
|
|
401
|
-
} | {
|
|
402
|
-
[x: string]: unknown;
|
|
403
|
-
type: "resource_link";
|
|
404
|
-
name: string;
|
|
405
|
-
uri: string;
|
|
406
|
-
_meta?: {
|
|
407
|
-
[x: string]: unknown;
|
|
408
|
-
} | undefined;
|
|
409
|
-
title?: string | undefined;
|
|
410
|
-
description?: string | undefined;
|
|
411
|
-
mimeType?: string | undefined;
|
|
412
|
-
} | {
|
|
413
|
-
[x: string]: unknown;
|
|
414
|
-
type: "resource";
|
|
415
|
-
resource: {
|
|
416
|
-
[x: string]: unknown;
|
|
417
|
-
text: string;
|
|
418
|
-
uri: string;
|
|
419
|
-
_meta?: {
|
|
420
|
-
[x: string]: unknown;
|
|
421
|
-
} | undefined;
|
|
422
|
-
mimeType?: string | undefined;
|
|
423
|
-
} | {
|
|
424
|
-
[x: string]: unknown;
|
|
425
|
-
uri: string;
|
|
426
|
-
blob: string;
|
|
427
|
-
_meta?: {
|
|
428
|
-
[x: string]: unknown;
|
|
429
|
-
} | undefined;
|
|
430
|
-
mimeType?: string | undefined;
|
|
431
|
-
};
|
|
432
|
-
_meta?: {
|
|
433
|
-
[x: string]: unknown;
|
|
434
|
-
} | undefined;
|
|
435
|
-
};
|
|
436
|
-
role: "user" | "assistant";
|
|
437
|
-
}[];
|
|
438
|
-
_meta?: {
|
|
439
|
-
[x: string]: unknown;
|
|
440
|
-
} | undefined;
|
|
441
|
-
description?: string | undefined;
|
|
442
|
-
}>;
|
|
443
|
-
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
444
|
-
};
|
|
445
|
-
private addToInstanceCache;
|
|
446
|
-
private makeId;
|
|
447
|
-
disconnect(): Promise<void>;
|
|
448
|
-
getTools(): Promise<Record<string, any>>;
|
|
449
|
-
getToolsets(): Promise<Record<string, Record<string, any>>>;
|
|
450
|
-
/**
|
|
451
|
-
* @deprecated all resource actions have been moved to the this.resources object. Use this.resources.list() instead.
|
|
452
|
-
*/
|
|
453
|
-
getResources(): Promise<Record<string, {
|
|
454
|
-
[x: string]: unknown;
|
|
455
|
-
name: string;
|
|
456
|
-
uri: string;
|
|
457
|
-
_meta?: {
|
|
458
|
-
[x: string]: unknown;
|
|
459
|
-
} | undefined;
|
|
460
|
-
title?: string | undefined;
|
|
461
|
-
description?: string | undefined;
|
|
462
|
-
mimeType?: string | undefined;
|
|
463
|
-
}[]>>;
|
|
464
|
-
/**
|
|
465
|
-
* Get the current session IDs for all connected MCP clients using the Streamable HTTP transport.
|
|
466
|
-
* Returns an object mapping server names to their session IDs.
|
|
467
|
-
*/
|
|
468
|
-
get sessionIds(): Record<string, string>;
|
|
469
|
-
private getConnectedClient;
|
|
470
|
-
private getConnectedClientForServer;
|
|
471
|
-
private eachClientTools;
|
|
472
|
-
}
|
|
473
|
-
export { MCPClient }
|
|
474
|
-
export { MCPClient as MCPClient_alias_1 }
|
|
475
|
-
export { MCPClient as MCPClient_alias_2 }
|
|
476
|
-
|
|
477
|
-
declare interface MCPClientOptions {
|
|
478
|
-
id?: string;
|
|
479
|
-
servers: Record<string, MastraMCPServerDefinition>;
|
|
480
|
-
timeout?: number;
|
|
481
|
-
}
|
|
482
|
-
export { MCPClientOptions }
|
|
483
|
-
export { MCPClientOptions as MCPClientOptions_alias_1 }
|
|
484
|
-
export { MCPClientOptions as MCPClientOptions_alias_2 }
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* @deprecated MCPConfiguration is deprecated and will be removed in a future release. Use MCPClient instead.
|
|
488
|
-
*/
|
|
489
|
-
declare class MCPConfiguration extends MCPClient {
|
|
490
|
-
constructor(args: MCPClientOptions);
|
|
491
|
-
}
|
|
492
|
-
export { MCPConfiguration }
|
|
493
|
-
export { MCPConfiguration as MCPConfiguration_alias_1 }
|
|
494
|
-
export { MCPConfiguration as MCPConfiguration_alias_2 }
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* @deprecated MCPConfigurationOptions is deprecated and will be removed in a future release. Use MCPClientOptions instead.
|
|
498
|
-
*/
|
|
499
|
-
declare interface MCPConfigurationOptions {
|
|
500
|
-
id?: string;
|
|
501
|
-
servers: Record<string, MastraMCPServerDefinition>;
|
|
502
|
-
timeout?: number;
|
|
503
|
-
}
|
|
504
|
-
export { MCPConfigurationOptions }
|
|
505
|
-
export { MCPConfigurationOptions as MCPConfigurationOptions_alias_1 }
|
|
506
|
-
export { MCPConfigurationOptions as MCPConfigurationOptions_alias_2 }
|
|
507
|
-
|
|
508
|
-
declare type MCPRequestHandlerExtra = RequestHandlerExtra<any, any>;
|
|
509
|
-
export { MCPRequestHandlerExtra }
|
|
510
|
-
export { MCPRequestHandlerExtra as MCPRequestHandlerExtra_alias_1 }
|
|
511
|
-
export { MCPRequestHandlerExtra as MCPRequestHandlerExtra_alias_2 }
|
|
512
|
-
|
|
513
|
-
declare class MCPServer extends MCPServerBase {
|
|
514
|
-
private server;
|
|
515
|
-
private stdioTransport?;
|
|
516
|
-
private sseTransport?;
|
|
517
|
-
private sseHonoTransports;
|
|
518
|
-
private streamableHTTPTransports;
|
|
519
|
-
private httpServerInstances;
|
|
520
|
-
private definedResources?;
|
|
521
|
-
private definedResourceTemplates?;
|
|
522
|
-
private resourceOptions?;
|
|
523
|
-
private definedPrompts?;
|
|
524
|
-
private promptOptions?;
|
|
525
|
-
private subscriptions;
|
|
526
|
-
readonly resources: ServerResourceActions;
|
|
527
|
-
readonly prompts: ServerPromptActions;
|
|
528
|
-
readonly elicitation: ElicitationActions;
|
|
529
|
-
/**
|
|
530
|
-
* Get the current stdio transport.
|
|
531
|
-
*/
|
|
532
|
-
getStdioTransport(): StdioServerTransport | undefined;
|
|
533
|
-
/**
|
|
534
|
-
* Get the current SSE transport.
|
|
535
|
-
*/
|
|
536
|
-
getSseTransport(): SSEServerTransport | undefined;
|
|
537
|
-
/**
|
|
538
|
-
* Get the current SSE Hono transport.
|
|
539
|
-
*/
|
|
540
|
-
getSseHonoTransport(sessionId: string): SSETransport | undefined;
|
|
541
|
-
/**
|
|
542
|
-
* Get the current server instance.
|
|
543
|
-
*/
|
|
544
|
-
getServer(): Server;
|
|
545
|
-
/**
|
|
546
|
-
* Construct a new MCPServer instance.
|
|
547
|
-
* @param opts - Configuration options for the server, including registry metadata.
|
|
548
|
-
*/
|
|
549
|
-
constructor(opts: MCPServerConfig & {
|
|
550
|
-
resources?: MCPServerResources;
|
|
551
|
-
prompts?: MCPServerPrompts;
|
|
552
|
-
});
|
|
553
|
-
/**
|
|
554
|
-
* Handle an elicitation request by sending it to the connected client.
|
|
555
|
-
* This method sends an elicitation/create request to the client and waits for the response.
|
|
556
|
-
*
|
|
557
|
-
* @param request - The elicitation request containing message and schema
|
|
558
|
-
* @param serverInstance - Optional server instance to use; defaults to main server for backward compatibility
|
|
559
|
-
* @returns Promise that resolves to the client's response
|
|
560
|
-
*/
|
|
561
|
-
private handleElicitationRequest;
|
|
562
|
-
/**
|
|
563
|
-
* Creates a new Server instance configured with all handlers for HTTP sessions.
|
|
564
|
-
* Each HTTP client connection gets its own Server instance to avoid routing conflicts.
|
|
565
|
-
*/
|
|
566
|
-
private createServerInstance;
|
|
567
|
-
/**
|
|
568
|
-
* Registers all MCP handlers on a given server instance.
|
|
569
|
-
* This allows us to create multiple server instances with identical functionality.
|
|
570
|
-
*/
|
|
571
|
-
private registerHandlersOnServer;
|
|
572
|
-
/**
|
|
573
|
-
* Registers resource-related handlers on a server instance.
|
|
574
|
-
*/
|
|
575
|
-
private registerResourceHandlersOnServer;
|
|
576
|
-
/**
|
|
577
|
-
* Registers prompt-related handlers on a server instance.
|
|
578
|
-
*/
|
|
579
|
-
private registerPromptHandlersOnServer;
|
|
580
|
-
private convertAgentsToTools;
|
|
581
|
-
private convertWorkflowsToTools;
|
|
582
|
-
/**
|
|
583
|
-
* Convert and validate all provided tools, logging registration status.
|
|
584
|
-
* Also converts agents and workflows into tools.
|
|
585
|
-
* @param tools Tool definitions
|
|
586
|
-
* @param agentsConfig Agent definitions to be converted to tools, expected from MCPServerConfig
|
|
587
|
-
* @param workflowsConfig Workflow definitions to be converted to tools, expected from MCPServerConfig
|
|
588
|
-
* @returns Converted tools registry
|
|
589
|
-
*/
|
|
590
|
-
convertTools(tools: ToolsInput, agentsConfig?: Record<string, Agent>, workflowsConfig?: Record<string, Workflow>): Record<string, ConvertedTool>;
|
|
591
|
-
/**
|
|
592
|
-
* Start the MCP server using stdio transport (for Windsurf integration).
|
|
593
|
-
*/
|
|
594
|
-
startStdio(): Promise<void>;
|
|
595
|
-
/**
|
|
596
|
-
* Handles MCP-over-SSE protocol for user-provided HTTP servers.
|
|
597
|
-
* Call this from your HTTP server for both the SSE and message endpoints.
|
|
598
|
-
*
|
|
599
|
-
* @param url Parsed URL of the incoming request
|
|
600
|
-
* @param ssePath Path for establishing the SSE connection (e.g. '/sse')
|
|
601
|
-
* @param messagePath Path for POSTing client messages (e.g. '/message')
|
|
602
|
-
* @param req Incoming HTTP request
|
|
603
|
-
* @param res HTTP response (must support .write/.end)
|
|
604
|
-
*/
|
|
605
|
-
startSSE({ url, ssePath, messagePath, req, res }: MCPServerSSEOptions): Promise<void>;
|
|
606
|
-
/**
|
|
607
|
-
* Handles MCP-over-SSE protocol for user-provided HTTP servers.
|
|
608
|
-
* Call this from your HTTP server for both the SSE and message endpoints.
|
|
609
|
-
*
|
|
610
|
-
* @param url Parsed URL of the incoming request
|
|
611
|
-
* @param ssePath Path for establishing the SSE connection (e.g. '/sse')
|
|
612
|
-
* @param messagePath Path for POSTing client messages (e.g. '/message')
|
|
613
|
-
* @param context Incoming Hono context
|
|
614
|
-
*/
|
|
615
|
-
startHonoSSE({ url, ssePath, messagePath, context }: MCPServerHonoSSEOptions): Promise<Response>;
|
|
616
|
-
/**
|
|
617
|
-
* Handles MCP-over-StreamableHTTP protocol for user-provided HTTP servers.
|
|
618
|
-
* Call this from your HTTP server for the streamable HTTP endpoint.
|
|
619
|
-
*
|
|
620
|
-
* @param url Parsed URL of the incoming request
|
|
621
|
-
* @param httpPath Path for establishing the streamable HTTP connection (e.g. '/mcp')
|
|
622
|
-
* @param req Incoming HTTP request
|
|
623
|
-
* @param res HTTP response (must support .write/.end)
|
|
624
|
-
* @param options Optional options to pass to the transport (e.g. sessionIdGenerator)
|
|
625
|
-
*/
|
|
626
|
-
startHTTP({ url, httpPath, req, res, options, }: {
|
|
627
|
-
url: URL;
|
|
628
|
-
httpPath: string;
|
|
629
|
-
req: http.IncomingMessage;
|
|
630
|
-
res: http.ServerResponse<http.IncomingMessage>;
|
|
631
|
-
options?: StreamableHTTPServerTransportOptions;
|
|
632
|
-
}): Promise<void>;
|
|
633
|
-
connectSSE({ messagePath, res, }: {
|
|
634
|
-
messagePath: string;
|
|
635
|
-
res: http.ServerResponse<http.IncomingMessage>;
|
|
636
|
-
}): Promise<void>;
|
|
637
|
-
connectHonoSSE({ messagePath, stream }: {
|
|
638
|
-
messagePath: string;
|
|
639
|
-
stream: SSEStreamingApi;
|
|
640
|
-
}): Promise<void>;
|
|
641
|
-
/**
|
|
642
|
-
* Close the MCP server and all its connections
|
|
643
|
-
*/
|
|
644
|
-
close(): Promise<void>;
|
|
645
|
-
/**
|
|
646
|
-
* Gets the basic information about the server, conforming to the Server schema.
|
|
647
|
-
* @returns ServerInfo object.
|
|
648
|
-
*/
|
|
649
|
-
getServerInfo(): ServerInfo;
|
|
650
|
-
/**
|
|
651
|
-
* Gets detailed information about the server, conforming to the ServerDetail schema.
|
|
652
|
-
* @returns ServerDetailInfo object.
|
|
653
|
-
*/
|
|
654
|
-
getServerDetail(): ServerDetailInfo;
|
|
655
|
-
/**
|
|
656
|
-
* Gets a list of tools provided by this MCP server, including their schemas.
|
|
657
|
-
* This leverages the same tool information used by the internal ListTools MCP request.
|
|
658
|
-
* @returns An object containing an array of tool information.
|
|
659
|
-
*/
|
|
660
|
-
getToolListInfo(): {
|
|
661
|
-
tools: Array<{
|
|
662
|
-
name: string;
|
|
663
|
-
description?: string;
|
|
664
|
-
inputSchema: any;
|
|
665
|
-
outputSchema?: any;
|
|
666
|
-
toolType?: MCPToolType;
|
|
667
|
-
}>;
|
|
668
|
-
};
|
|
669
|
-
/**
|
|
670
|
-
* Gets information for a specific tool provided by this MCP server.
|
|
671
|
-
* @param toolId The ID/name of the tool to retrieve.
|
|
672
|
-
* @returns Tool information (name, description, inputSchema) or undefined if not found.
|
|
673
|
-
*/
|
|
674
|
-
getToolInfo(toolId: string): {
|
|
675
|
-
name: string;
|
|
676
|
-
description?: string;
|
|
677
|
-
inputSchema: any;
|
|
678
|
-
outputSchema?: any;
|
|
679
|
-
toolType?: MCPToolType;
|
|
680
|
-
} | undefined;
|
|
681
|
-
/**
|
|
682
|
-
* Executes a specific tool provided by this MCP server.
|
|
683
|
-
* @param toolId The ID/name of the tool to execute.
|
|
684
|
-
* @param args The arguments to pass to the tool's execute function.
|
|
685
|
-
* @param executionContext Optional context for the tool execution.
|
|
686
|
-
* @returns A promise that resolves to the result of the tool execution.
|
|
687
|
-
* @throws Error if the tool is not found, validation fails, or execution fails.
|
|
688
|
-
*/
|
|
689
|
-
executeTool(toolId: string, args: any, executionContext?: {
|
|
690
|
-
messages?: any[];
|
|
691
|
-
toolCallId?: string;
|
|
692
|
-
}): Promise<any>;
|
|
693
|
-
}
|
|
694
|
-
export { MCPServer }
|
|
695
|
-
export { MCPServer as MCPServer_alias_1 }
|
|
696
|
-
export { MCPServer as MCPServer_alias_2 }
|
|
697
|
-
|
|
698
|
-
export declare const mcpServerName = "firecrawl-mcp-fixture";
|
|
699
|
-
|
|
700
|
-
declare type MCPServerPromptMessagesCallback = ({ name, version, args, }: {
|
|
701
|
-
name: string;
|
|
702
|
-
version?: string;
|
|
703
|
-
args?: any;
|
|
704
|
-
}) => Promise<PromptMessage[]>;
|
|
705
|
-
export { MCPServerPromptMessagesCallback }
|
|
706
|
-
export { MCPServerPromptMessagesCallback as MCPServerPromptMessagesCallback_alias_1 }
|
|
707
|
-
export { MCPServerPromptMessagesCallback as MCPServerPromptMessagesCallback_alias_2 }
|
|
708
|
-
|
|
709
|
-
declare type MCPServerPrompts = {
|
|
710
|
-
listPrompts: () => Promise<Prompt[]>;
|
|
711
|
-
getPromptMessages?: MCPServerPromptMessagesCallback;
|
|
712
|
-
};
|
|
713
|
-
export { MCPServerPrompts }
|
|
714
|
-
export { MCPServerPrompts as MCPServerPrompts_alias_1 }
|
|
715
|
-
export { MCPServerPrompts as MCPServerPrompts_alias_2 }
|
|
716
|
-
|
|
717
|
-
declare type MCPServerResourceContent = {
|
|
718
|
-
text?: string;
|
|
719
|
-
} | {
|
|
720
|
-
blob?: string;
|
|
721
|
-
};
|
|
722
|
-
export { MCPServerResourceContent }
|
|
723
|
-
export { MCPServerResourceContent as MCPServerResourceContent_alias_1 }
|
|
724
|
-
export { MCPServerResourceContent as MCPServerResourceContent_alias_2 }
|
|
725
|
-
|
|
726
|
-
declare type MCPServerResourceContentCallback = ({ uri, }: {
|
|
727
|
-
uri: string;
|
|
728
|
-
}) => Promise<MCPServerResourceContent | MCPServerResourceContent[]>;
|
|
729
|
-
export { MCPServerResourceContentCallback }
|
|
730
|
-
export { MCPServerResourceContentCallback as MCPServerResourceContentCallback_alias_1 }
|
|
731
|
-
export { MCPServerResourceContentCallback as MCPServerResourceContentCallback_alias_2 }
|
|
732
|
-
|
|
733
|
-
declare type MCPServerResources = {
|
|
734
|
-
listResources: () => Promise<Resource[]>;
|
|
735
|
-
getResourceContent: MCPServerResourceContentCallback;
|
|
736
|
-
resourceTemplates?: () => Promise<ResourceTemplate[]>;
|
|
737
|
-
};
|
|
738
|
-
export { MCPServerResources }
|
|
739
|
-
export { MCPServerResources as MCPServerResources_alias_1 }
|
|
740
|
-
export { MCPServerResources as MCPServerResources_alias_2 }
|
|
741
|
-
|
|
742
|
-
declare type MCPTool = {
|
|
743
|
-
id?: InternalCoreTool['id'];
|
|
744
|
-
description?: InternalCoreTool['description'];
|
|
745
|
-
parameters: InternalCoreTool['parameters'];
|
|
746
|
-
outputSchema?: InternalCoreTool['outputSchema'];
|
|
747
|
-
execute: (params: any, options: Parameters<NonNullable<InternalCoreTool['execute']>>[1] & {
|
|
748
|
-
elicitation: ElicitationActions;
|
|
749
|
-
extra: MCPRequestHandlerExtra;
|
|
750
|
-
}) => Promise<any>;
|
|
751
|
-
};
|
|
752
|
-
export { MCPTool }
|
|
753
|
-
export { MCPTool as MCPTool_alias_1 }
|
|
754
|
-
export { MCPTool as MCPTool_alias_2 }
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* Client-side prompt actions for listing, getting, and subscribing to prompt changes.
|
|
758
|
-
*/
|
|
759
|
-
export declare class PromptClientActions {
|
|
760
|
-
private readonly client;
|
|
761
|
-
private readonly logger;
|
|
762
|
-
constructor({ client, logger }: PromptClientActionsConfig);
|
|
763
|
-
/**
|
|
764
|
-
* Get all prompts from the connected MCP server.
|
|
765
|
-
* @returns A list of prompts with their versions.
|
|
766
|
-
*/
|
|
767
|
-
list(): Promise<Prompt[]>;
|
|
768
|
-
/**
|
|
769
|
-
* Get a specific prompt.
|
|
770
|
-
* @param name The name of the prompt to get.
|
|
771
|
-
* @param args Optional arguments for the prompt.
|
|
772
|
-
* @param version Optional version of the prompt to get.
|
|
773
|
-
* @returns The prompt content.
|
|
774
|
-
*/
|
|
775
|
-
get({ name, args, version }: {
|
|
776
|
-
name: string;
|
|
777
|
-
args?: Record<string, any>;
|
|
778
|
-
version?: string;
|
|
779
|
-
}): Promise<GetPromptResult>;
|
|
780
|
-
/**
|
|
781
|
-
* Set a notification handler for when the list of available prompts changes.
|
|
782
|
-
* @param handler The callback function to handle the notification.
|
|
783
|
-
*/
|
|
784
|
-
onListChanged(handler: () => void): Promise<void>;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
declare interface PromptClientActionsConfig {
|
|
788
|
-
client: InternalMastraMCPClient;
|
|
789
|
-
logger: IMastraLogger;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
export { Resource }
|
|
793
|
-
export { Resource as Resource_alias_1 }
|
|
794
|
-
export { Resource as Resource_alias_2 }
|
|
795
|
-
|
|
796
|
-
export declare class ResourceClientActions {
|
|
797
|
-
private readonly client;
|
|
798
|
-
private readonly logger;
|
|
799
|
-
constructor({ client, logger }: ResourceClientActionsConfig);
|
|
800
|
-
/**
|
|
801
|
-
* Get all resources from the connected MCP server.
|
|
802
|
-
* @returns A list of resources.
|
|
803
|
-
*/
|
|
804
|
-
list(): Promise<Resource[]>;
|
|
805
|
-
/**
|
|
806
|
-
* Get all resource templates from the connected MCP server.
|
|
807
|
-
* @returns A list of resource templates.
|
|
808
|
-
*/
|
|
809
|
-
templates(): Promise<ResourceTemplate[]>;
|
|
810
|
-
/**
|
|
811
|
-
* Read a specific resource.
|
|
812
|
-
* @param uri The URI of the resource to read.
|
|
813
|
-
* @returns The resource content.
|
|
814
|
-
*/
|
|
815
|
-
read(uri: string): Promise<objectOutputType< {
|
|
816
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
817
|
-
} & {
|
|
818
|
-
contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
|
|
819
|
-
uri: ZodString;
|
|
820
|
-
mimeType: ZodOptional<ZodString>;
|
|
821
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
822
|
-
}, {
|
|
823
|
-
text: ZodString;
|
|
824
|
-
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
825
|
-
uri: ZodString;
|
|
826
|
-
mimeType: ZodOptional<ZodString>;
|
|
827
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
828
|
-
}, {
|
|
829
|
-
text: ZodString;
|
|
830
|
-
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
831
|
-
uri: ZodString;
|
|
832
|
-
mimeType: ZodOptional<ZodString>;
|
|
833
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
834
|
-
}, {
|
|
835
|
-
text: ZodString;
|
|
836
|
-
}>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
|
|
837
|
-
uri: ZodString;
|
|
838
|
-
mimeType: ZodOptional<ZodString>;
|
|
839
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
840
|
-
}, {
|
|
841
|
-
blob: ZodString;
|
|
842
|
-
}>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
|
|
843
|
-
uri: ZodString;
|
|
844
|
-
mimeType: ZodOptional<ZodString>;
|
|
845
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
846
|
-
}, {
|
|
847
|
-
blob: ZodString;
|
|
848
|
-
}>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
|
|
849
|
-
uri: ZodString;
|
|
850
|
-
mimeType: ZodOptional<ZodString>;
|
|
851
|
-
_meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
|
|
852
|
-
}, {
|
|
853
|
-
blob: ZodString;
|
|
854
|
-
}>, ZodTypeAny, "passthrough">>]>, "many">;
|
|
855
|
-
}, ZodTypeAny, "passthrough">>;
|
|
856
|
-
/**
|
|
857
|
-
* Subscribe to a specific resource.
|
|
858
|
-
* @param uri The URI of the resource to subscribe to.
|
|
859
|
-
*/
|
|
860
|
-
subscribe(uri: string): Promise<{}>;
|
|
861
|
-
/**
|
|
862
|
-
* Unsubscribe from a specific resource.
|
|
863
|
-
* @param uri The URI of the resource to unsubscribe from.
|
|
864
|
-
*/
|
|
865
|
-
unsubscribe(uri: string): Promise<{}>;
|
|
866
|
-
/**
|
|
867
|
-
* Set a notification handler for when a specific resource is updated.
|
|
868
|
-
* @param handler The callback function to handle the notification.
|
|
869
|
-
*/
|
|
870
|
-
onUpdated(handler: (params: {
|
|
871
|
-
uri: string;
|
|
872
|
-
}) => void): Promise<void>;
|
|
873
|
-
/**
|
|
874
|
-
* Set a notification handler for when the list of available resources changes.
|
|
875
|
-
* @param handler The callback function to handle the notification.
|
|
876
|
-
*/
|
|
877
|
-
onListChanged(handler: () => void): Promise<void>;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
declare interface ResourceClientActionsConfig {
|
|
881
|
-
client: InternalMastraMCPClient;
|
|
882
|
-
logger: IMastraLogger;
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
export { ResourceTemplate }
|
|
886
|
-
export { ResourceTemplate as ResourceTemplate_alias_1 }
|
|
887
|
-
export { ResourceTemplate as ResourceTemplate_alias_2 }
|
|
888
|
-
|
|
889
|
-
export declare const server: Server<{
|
|
890
|
-
method: string;
|
|
891
|
-
params?: {
|
|
892
|
-
[x: string]: unknown;
|
|
893
|
-
_meta?: {
|
|
894
|
-
[x: string]: unknown;
|
|
895
|
-
progressToken?: string | number | undefined;
|
|
896
|
-
} | undefined;
|
|
897
|
-
} | undefined;
|
|
898
|
-
}, {
|
|
899
|
-
method: string;
|
|
900
|
-
params?: {
|
|
901
|
-
[x: string]: unknown;
|
|
902
|
-
_meta?: {
|
|
903
|
-
[x: string]: unknown;
|
|
904
|
-
} | undefined;
|
|
905
|
-
} | undefined;
|
|
906
|
-
}, {
|
|
907
|
-
[x: string]: unknown;
|
|
908
|
-
_meta?: {
|
|
909
|
-
[x: string]: unknown;
|
|
910
|
-
} | undefined;
|
|
911
|
-
}>;
|
|
912
|
-
|
|
913
|
-
export declare const server_alias_1: MCPServer;
|
|
914
|
-
|
|
915
|
-
export declare class ServerPromptActions {
|
|
916
|
-
private readonly getLogger;
|
|
917
|
-
private readonly getSdkServer;
|
|
918
|
-
private readonly clearDefinedPrompts;
|
|
919
|
-
constructor(dependencies: ServerPromptActionsDependencies);
|
|
920
|
-
/**
|
|
921
|
-
* Notifies the server that the overall list of available prompts has changed.
|
|
922
|
-
* This will clear the internal cache of defined prompts and send a list_changed notification to clients.
|
|
923
|
-
*/
|
|
924
|
-
notifyListChanged(): Promise<void>;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
declare interface ServerPromptActionsDependencies {
|
|
928
|
-
getLogger: () => IMastraLogger;
|
|
929
|
-
getSdkServer: () => Server;
|
|
930
|
-
clearDefinedPrompts: () => void;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
export declare class ServerResourceActions {
|
|
934
|
-
private readonly getSubscriptions;
|
|
935
|
-
private readonly getLogger;
|
|
936
|
-
private readonly getSdkServer;
|
|
937
|
-
private readonly clearDefinedResources;
|
|
938
|
-
private readonly clearDefinedResourceTemplates;
|
|
939
|
-
constructor(dependencies: ServerResourceActionsDependencies);
|
|
940
|
-
/**
|
|
941
|
-
* Checks if any resources have been updated.
|
|
942
|
-
* If the resource is subscribed to by clients, an update notification will be sent.
|
|
943
|
-
*/
|
|
944
|
-
notifyUpdated({ uri }: {
|
|
945
|
-
uri: string;
|
|
946
|
-
}): Promise<void>;
|
|
947
|
-
/**
|
|
948
|
-
* Notifies the server that the overall list of available resources has changed.
|
|
949
|
-
* This will clear the internal cache of defined resources and send a list_changed notification to clients.
|
|
950
|
-
*/
|
|
951
|
-
notifyListChanged(): Promise<void>;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
declare interface ServerResourceActionsDependencies {
|
|
955
|
-
getSubscriptions: () => Set<string>;
|
|
956
|
-
getLogger: () => IMastraLogger;
|
|
957
|
-
getSdkServer: () => Server;
|
|
958
|
-
clearDefinedResources: () => void;
|
|
959
|
-
clearDefinedResourceTemplates: () => void;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
declare type StdioServerDefinition = BaseServerOptions & {
|
|
963
|
-
command: string;
|
|
964
|
-
args?: string[];
|
|
965
|
-
env?: Record<string, string>;
|
|
966
|
-
url?: never;
|
|
967
|
-
requestInit?: never;
|
|
968
|
-
eventSourceInit?: never;
|
|
969
|
-
reconnectionOptions?: never;
|
|
970
|
-
sessionId?: never;
|
|
971
|
-
};
|
|
972
|
-
|
|
973
|
-
export declare const weatherTool: Tool<z.ZodObject<{
|
|
974
|
-
location: z.ZodString;
|
|
975
|
-
}, "strip", z.ZodTypeAny, {
|
|
976
|
-
location: string;
|
|
977
|
-
}, {
|
|
978
|
-
location: string;
|
|
979
|
-
}>, undefined, ToolExecutionContext<z.ZodObject<{
|
|
980
|
-
location: z.ZodString;
|
|
981
|
-
}, "strip", z.ZodTypeAny, {
|
|
982
|
-
location: string;
|
|
983
|
-
}, {
|
|
984
|
-
location: string;
|
|
985
|
-
}>>>;
|
|
986
|
-
|
|
987
|
-
export { }
|