@mastra/mcp 0.10.2-alpha.1 → 0.10.3-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 +8 -8
- package/CHANGELOG.md +36 -0
- package/README.md +32 -0
- package/dist/_tsup-dts-rollup.d.cts +179 -14
- package/dist/_tsup-dts-rollup.d.ts +179 -14
- package/dist/index.cjs +258 -3
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +260 -5
- package/integration-tests/node_modules/.bin/vitest +2 -2
- package/integration-tests/package.json +3 -3
- package/package.json +10 -10
- package/src/__fixtures__/weather.ts +62 -2
- package/src/client/client.test.ts +46 -0
- package/src/client/client.ts +43 -1
- package/src/client/configuration.test.ts +280 -168
- package/src/client/configuration.ts +27 -1
- package/src/client/index.ts +3 -0
- package/src/client/promptActions.ts +70 -0
- package/src/client/resourceActions.ts +0 -2
- package/src/index.ts +2 -4
- package/src/server/index.ts +2 -0
- package/src/server/promptActions.ts +37 -0
- package/src/server/server.test.ts +224 -1
- package/src/server/server.ts +147 -15
- package/src/server/types.ts +30 -0
- package/src/logger.ts +0 -104
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/mcp@0.10.
|
|
2
|
+
> @mastra/mcp@0.10.3-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
|
-
[34mCLI[39m tsup v8.
|
|
7
|
+
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 21509ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 23126ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
21
|
-
[32mCJS[39m ⚡️ Build success in
|
|
22
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
23
|
-
[32mESM[39m ⚡️ Build success in
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m67.33 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 1667ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m67.20 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 1667ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @mastra/mcp
|
|
2
2
|
|
|
3
|
+
## 0.10.3-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fc579cd: [MASTRA-3554] Support MCP prompts for MCPServer and MCPClient
|
|
8
|
+
- Updated dependencies [f6fd25f]
|
|
9
|
+
- Updated dependencies [dffb67b]
|
|
10
|
+
- Updated dependencies [f1309d3]
|
|
11
|
+
- Updated dependencies [f7f8293]
|
|
12
|
+
- @mastra/core@0.10.4-alpha.1
|
|
13
|
+
|
|
14
|
+
## 0.10.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 592a2db: Added different icons for agents and workflows in mcp tools list
|
|
19
|
+
- f0d559f: Fix peerdeps for alpha channel
|
|
20
|
+
- Updated dependencies [ee77e78]
|
|
21
|
+
- Updated dependencies [592a2db]
|
|
22
|
+
- Updated dependencies [e5dc18d]
|
|
23
|
+
- Updated dependencies [ab5adbe]
|
|
24
|
+
- Updated dependencies [1e8bb40]
|
|
25
|
+
- Updated dependencies [1b5fc55]
|
|
26
|
+
- Updated dependencies [195c428]
|
|
27
|
+
- Updated dependencies [f73e11b]
|
|
28
|
+
- Updated dependencies [37643b8]
|
|
29
|
+
- Updated dependencies [99fd6cf]
|
|
30
|
+
- Updated dependencies [c5bf1ce]
|
|
31
|
+
- Updated dependencies [add596e]
|
|
32
|
+
- Updated dependencies [8dc94d8]
|
|
33
|
+
- Updated dependencies [ecebbeb]
|
|
34
|
+
- Updated dependencies [79d5145]
|
|
35
|
+
- Updated dependencies [12b7002]
|
|
36
|
+
- Updated dependencies [2901125]
|
|
37
|
+
- @mastra/core@0.10.2
|
|
38
|
+
|
|
3
39
|
## 0.10.2-alpha.1
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -346,6 +346,38 @@ if (resources.weather) {
|
|
|
346
346
|
|
|
347
347
|
The `getResources()` method handles errors gracefully - if a server fails or doesn't support resources, it will be omitted from the results without causing the entire operation to fail.
|
|
348
348
|
|
|
349
|
+
## Prompts
|
|
350
|
+
|
|
351
|
+
MCP servers can also expose prompts, which represent structured message templates or conversational context for agents.
|
|
352
|
+
|
|
353
|
+
### Listing Prompts
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
const prompts = await mcp.prompts.list();
|
|
357
|
+
console.log(prompts.weather); // [ { name: 'current', ... }, ... ]
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Getting a Prompt and Messages
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
const { prompt, messages } = await mcp.prompts.get({ serverName: 'weather', name: 'current' });
|
|
364
|
+
console.log(prompt); // { name: 'current', version: 'v1', ... }
|
|
365
|
+
console.log(messages); // [ { role: 'assistant', content: { type: 'text', text: '...' } }, ... ]
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Handling Prompt List Change Notifications
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
mcp.prompts.onListChanged({
|
|
372
|
+
serverName: 'weather',
|
|
373
|
+
handler: () => {
|
|
374
|
+
// Refresh prompt list or update UI
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Prompt notifications are delivered via SSE or compatible transports. Register handlers before expecting notifications.
|
|
380
|
+
|
|
349
381
|
## SSE Authentication and Headers (Legacy Fallback)
|
|
350
382
|
|
|
351
383
|
When the client falls back to using the legacy SSE (Server-Sent Events) transport and you need to include authentication or custom headers, you need to configure headers in a specific way. The standard `requestInit` headers won't work alone because SSE connections using the browser's `EventSource` API don't support custom headers directly.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Agent } from '@mastra/core/agent';
|
|
2
2
|
import type { ClientCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
import type { ConvertedTool } from '@mastra/core/mcp';
|
|
4
|
+
import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
|
|
4
5
|
import type * as http from 'node:http';
|
|
5
6
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
7
|
+
import type { ListPromptsResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
8
|
import { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
7
9
|
import { MastraBase } from '@mastra/core/base';
|
|
8
10
|
import { MCPServerBase } from '@mastra/core/mcp';
|
|
@@ -13,6 +15,8 @@ import type { MCPToolType } from '@mastra/core/mcp';
|
|
|
13
15
|
import { objectInputType } from 'zod';
|
|
14
16
|
import { objectOutputType } from 'zod';
|
|
15
17
|
import { objectUtil } from 'zod';
|
|
18
|
+
import type { Prompt } from '@modelcontextprotocol/sdk/types.js';
|
|
19
|
+
import type { PromptMessage } from '@modelcontextprotocol/sdk/types.js';
|
|
16
20
|
import type { Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
17
21
|
import type { ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
|
18
22
|
import { ResourceUpdatedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -49,8 +53,6 @@ declare type BaseServerOptions = {
|
|
|
49
53
|
enableServerLogs?: boolean;
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
export declare function createLogger(server?: Server): Logger;
|
|
53
|
-
|
|
54
56
|
declare type HttpServerDefinition = BaseServerOptions & {
|
|
55
57
|
url: URL;
|
|
56
58
|
command?: never;
|
|
@@ -72,6 +74,7 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
72
74
|
private transport?;
|
|
73
75
|
private currentOperationContext;
|
|
74
76
|
readonly resources: ResourceClientActions;
|
|
77
|
+
readonly prompts: PromptClientActions;
|
|
75
78
|
constructor({ name, version, server, capabilities, timeout, }: InternalMastraMCPClientOptions);
|
|
76
79
|
/**
|
|
77
80
|
* Log a message at the specified level
|
|
@@ -172,6 +175,26 @@ export declare class InternalMastraMCPClient extends MastraBase {
|
|
|
172
175
|
mimeType: z.ZodOptional<z.ZodString>;
|
|
173
176
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
174
177
|
}, z.ZodTypeAny, "passthrough">>;
|
|
178
|
+
/**
|
|
179
|
+
* Fetch the list of available prompts from the MCP server.
|
|
180
|
+
*/
|
|
181
|
+
listPrompts(): Promise<ListPromptsResult>;
|
|
182
|
+
/**
|
|
183
|
+
* Get a prompt and its dynamic messages from the server.
|
|
184
|
+
* @param name The prompt name
|
|
185
|
+
* @param args Arguments for the prompt
|
|
186
|
+
* @param version (optional) The prompt version to retrieve
|
|
187
|
+
*/
|
|
188
|
+
getPrompt({ name, args, version }: {
|
|
189
|
+
name: string;
|
|
190
|
+
args?: Record<string, any>;
|
|
191
|
+
version?: string;
|
|
192
|
+
}): Promise<GetPromptResult>;
|
|
193
|
+
/**
|
|
194
|
+
* Register a handler to be called when the prompt list changes on the server.
|
|
195
|
+
* Use this to refresh cached prompt lists in the client/UI if needed.
|
|
196
|
+
*/
|
|
197
|
+
setPromptListChangedNotificationHandler(handler: () => void): void;
|
|
175
198
|
setResourceUpdatedNotificationHandler(handler: (params: z.infer<typeof ResourceUpdatedNotificationSchema>['params']) => void): void;
|
|
176
199
|
setResourceListChangedNotificationHandler(handler: () => void): void;
|
|
177
200
|
private convertInputSchema;
|
|
@@ -186,21 +209,14 @@ export declare type InternalMastraMCPClientOptions = {
|
|
|
186
209
|
timeout?: number;
|
|
187
210
|
};
|
|
188
211
|
|
|
189
|
-
export declare interface Logger {
|
|
190
|
-
info: (message: string, data?: any) => Promise<void>;
|
|
191
|
-
warning: (message: string, data?: any) => Promise<void>;
|
|
192
|
-
error: (message: string, error?: any) => Promise<void>;
|
|
193
|
-
debug: (message: string, data?: any) => Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export declare const logger: Logger;
|
|
197
|
-
|
|
198
212
|
export { LoggingLevel }
|
|
199
213
|
export { LoggingLevel as LoggingLevel_alias_1 }
|
|
214
|
+
export { LoggingLevel as LoggingLevel_alias_2 }
|
|
200
215
|
|
|
201
216
|
declare type LogHandler = (logMessage: LogMessage) => void;
|
|
202
217
|
export { LogHandler }
|
|
203
218
|
export { LogHandler as LogHandler_alias_1 }
|
|
219
|
+
export { LogHandler as LogHandler_alias_2 }
|
|
204
220
|
|
|
205
221
|
declare interface LogMessage {
|
|
206
222
|
level: LoggingLevel;
|
|
@@ -212,6 +228,7 @@ declare interface LogMessage {
|
|
|
212
228
|
}
|
|
213
229
|
export { LogMessage }
|
|
214
230
|
export { LogMessage as LogMessage_alias_1 }
|
|
231
|
+
export { LogMessage as LogMessage_alias_2 }
|
|
215
232
|
|
|
216
233
|
/**
|
|
217
234
|
* @deprecated MastraMCPClient is deprecated and will be removed in a future release. Please use MCPClient instead.
|
|
@@ -221,10 +238,12 @@ declare class MastraMCPClient extends InternalMastraMCPClient {
|
|
|
221
238
|
}
|
|
222
239
|
export { MastraMCPClient }
|
|
223
240
|
export { MastraMCPClient as MastraMCPClient_alias_1 }
|
|
241
|
+
export { MastraMCPClient as MastraMCPClient_alias_2 }
|
|
224
242
|
|
|
225
243
|
declare type MastraMCPServerDefinition = StdioServerDefinition | HttpServerDefinition;
|
|
226
244
|
export { MastraMCPServerDefinition }
|
|
227
245
|
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_1 }
|
|
246
|
+
export { MastraMCPServerDefinition as MastraMCPServerDefinition_alias_2 }
|
|
228
247
|
|
|
229
248
|
declare class MCPClient extends MastraBase {
|
|
230
249
|
private serverConfigs;
|
|
@@ -278,6 +297,55 @@ declare class MCPClient extends MastraBase {
|
|
|
278
297
|
}) => void) => Promise<void>;
|
|
279
298
|
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
280
299
|
};
|
|
300
|
+
get prompts(): {
|
|
301
|
+
list: () => Promise<Record<string, Prompt[]>>;
|
|
302
|
+
get: ({ serverName, name, args, version }: {
|
|
303
|
+
serverName: string;
|
|
304
|
+
name: string;
|
|
305
|
+
args?: Record<string, any>;
|
|
306
|
+
version?: string;
|
|
307
|
+
}) => Promise<{
|
|
308
|
+
[x: string]: unknown;
|
|
309
|
+
messages: {
|
|
310
|
+
[x: string]: unknown;
|
|
311
|
+
role: "user" | "assistant";
|
|
312
|
+
content: {
|
|
313
|
+
[x: string]: unknown;
|
|
314
|
+
type: "text";
|
|
315
|
+
text: string;
|
|
316
|
+
} | {
|
|
317
|
+
[x: string]: unknown;
|
|
318
|
+
type: "image";
|
|
319
|
+
data: string;
|
|
320
|
+
mimeType: string;
|
|
321
|
+
} | {
|
|
322
|
+
[x: string]: unknown;
|
|
323
|
+
type: "audio";
|
|
324
|
+
data: string;
|
|
325
|
+
mimeType: string;
|
|
326
|
+
} | {
|
|
327
|
+
[x: string]: unknown;
|
|
328
|
+
type: "resource";
|
|
329
|
+
resource: {
|
|
330
|
+
[x: string]: unknown;
|
|
331
|
+
text: string;
|
|
332
|
+
uri: string;
|
|
333
|
+
mimeType?: string | undefined;
|
|
334
|
+
} | {
|
|
335
|
+
[x: string]: unknown;
|
|
336
|
+
uri: string;
|
|
337
|
+
blob: string;
|
|
338
|
+
mimeType?: string | undefined;
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
}[];
|
|
342
|
+
description?: string | undefined;
|
|
343
|
+
_meta?: {
|
|
344
|
+
[x: string]: unknown;
|
|
345
|
+
} | undefined;
|
|
346
|
+
}>;
|
|
347
|
+
onListChanged: (serverName: string, handler: () => void) => Promise<void>;
|
|
348
|
+
};
|
|
281
349
|
private addToInstanceCache;
|
|
282
350
|
private makeId;
|
|
283
351
|
disconnect(): Promise<void>;
|
|
@@ -288,8 +356,8 @@ declare class MCPClient extends MastraBase {
|
|
|
288
356
|
*/
|
|
289
357
|
getResources(): Promise<Record<string, {
|
|
290
358
|
[x: string]: unknown;
|
|
291
|
-
uri: string;
|
|
292
359
|
name: string;
|
|
360
|
+
uri: string;
|
|
293
361
|
description?: string | undefined;
|
|
294
362
|
mimeType?: string | undefined;
|
|
295
363
|
}[]>>;
|
|
@@ -304,6 +372,7 @@ declare class MCPClient extends MastraBase {
|
|
|
304
372
|
}
|
|
305
373
|
export { MCPClient }
|
|
306
374
|
export { MCPClient as MCPClient_alias_1 }
|
|
375
|
+
export { MCPClient as MCPClient_alias_2 }
|
|
307
376
|
|
|
308
377
|
declare interface MCPClientOptions {
|
|
309
378
|
id?: string;
|
|
@@ -312,6 +381,7 @@ declare interface MCPClientOptions {
|
|
|
312
381
|
}
|
|
313
382
|
export { MCPClientOptions }
|
|
314
383
|
export { MCPClientOptions as MCPClientOptions_alias_1 }
|
|
384
|
+
export { MCPClientOptions as MCPClientOptions_alias_2 }
|
|
315
385
|
|
|
316
386
|
/**
|
|
317
387
|
* @deprecated MCPConfiguration is deprecated and will be removed in a future release. Use MCPClient instead.
|
|
@@ -321,6 +391,7 @@ declare class MCPConfiguration extends MCPClient {
|
|
|
321
391
|
}
|
|
322
392
|
export { MCPConfiguration }
|
|
323
393
|
export { MCPConfiguration as MCPConfiguration_alias_1 }
|
|
394
|
+
export { MCPConfiguration as MCPConfiguration_alias_2 }
|
|
324
395
|
|
|
325
396
|
/**
|
|
326
397
|
* @deprecated MCPConfigurationOptions is deprecated and will be removed in a future release. Use MCPClientOptions instead.
|
|
@@ -332,6 +403,7 @@ declare interface MCPConfigurationOptions {
|
|
|
332
403
|
}
|
|
333
404
|
export { MCPConfigurationOptions }
|
|
334
405
|
export { MCPConfigurationOptions as MCPConfigurationOptions_alias_1 }
|
|
406
|
+
export { MCPConfigurationOptions as MCPConfigurationOptions_alias_2 }
|
|
335
407
|
|
|
336
408
|
declare class MCPServer extends MCPServerBase {
|
|
337
409
|
private server;
|
|
@@ -346,11 +418,16 @@ declare class MCPServer extends MCPServerBase {
|
|
|
346
418
|
private listResourceTemplatesHandlerIsRegistered;
|
|
347
419
|
private subscribeResourceHandlerIsRegistered;
|
|
348
420
|
private unsubscribeResourceHandlerIsRegistered;
|
|
421
|
+
private listPromptsHandlerIsRegistered;
|
|
422
|
+
private getPromptHandlerIsRegistered;
|
|
349
423
|
private definedResources?;
|
|
350
424
|
private definedResourceTemplates?;
|
|
351
425
|
private resourceOptions?;
|
|
426
|
+
private definedPrompts?;
|
|
427
|
+
private promptOptions?;
|
|
352
428
|
private subscriptions;
|
|
353
429
|
readonly resources: ServerResourceActions;
|
|
430
|
+
readonly prompts: ServerPromptActions;
|
|
354
431
|
/**
|
|
355
432
|
* Get the current stdio transport.
|
|
356
433
|
*/
|
|
@@ -367,12 +444,17 @@ declare class MCPServer extends MCPServerBase {
|
|
|
367
444
|
* Get the current streamable HTTP transport.
|
|
368
445
|
*/
|
|
369
446
|
getStreamableHTTPTransport(): StreamableHTTPServerTransport | undefined;
|
|
447
|
+
/**
|
|
448
|
+
* Get the current server instance.
|
|
449
|
+
*/
|
|
450
|
+
getServer(): Server;
|
|
370
451
|
/**
|
|
371
452
|
* Construct a new MCPServer instance.
|
|
372
453
|
* @param opts - Configuration options for the server, including registry metadata.
|
|
373
454
|
*/
|
|
374
455
|
constructor(opts: MCPServerConfig & {
|
|
375
456
|
resources?: MCPServerResources;
|
|
457
|
+
prompts?: MCPServerPrompts;
|
|
376
458
|
});
|
|
377
459
|
private convertAgentsToTools;
|
|
378
460
|
private convertWorkflowsToTools;
|
|
@@ -413,6 +495,14 @@ declare class MCPServer extends MCPServerBase {
|
|
|
413
495
|
* Register the UnsubscribeResource handler.
|
|
414
496
|
*/
|
|
415
497
|
private registerUnsubscribeResourceHandler;
|
|
498
|
+
/**
|
|
499
|
+
* Register the ListPrompts handler.
|
|
500
|
+
*/
|
|
501
|
+
private registerListPromptsHandler;
|
|
502
|
+
/**
|
|
503
|
+
* Register the GetPrompt handler.
|
|
504
|
+
*/
|
|
505
|
+
private registerGetPromptHandler;
|
|
416
506
|
/**
|
|
417
507
|
* Start the MCP server using stdio transport (for Windsurf integration).
|
|
418
508
|
*/
|
|
@@ -516,9 +606,27 @@ declare class MCPServer extends MCPServerBase {
|
|
|
516
606
|
}
|
|
517
607
|
export { MCPServer }
|
|
518
608
|
export { MCPServer as MCPServer_alias_1 }
|
|
609
|
+
export { MCPServer as MCPServer_alias_2 }
|
|
519
610
|
|
|
520
611
|
export declare const mcpServerName = "firecrawl-mcp-fixture";
|
|
521
612
|
|
|
613
|
+
declare type MCPServerPromptMessagesCallback = ({ name, version, args, }: {
|
|
614
|
+
name: string;
|
|
615
|
+
version?: string;
|
|
616
|
+
args?: any;
|
|
617
|
+
}) => Promise<PromptMessage[]>;
|
|
618
|
+
export { MCPServerPromptMessagesCallback }
|
|
619
|
+
export { MCPServerPromptMessagesCallback as MCPServerPromptMessagesCallback_alias_1 }
|
|
620
|
+
export { MCPServerPromptMessagesCallback as MCPServerPromptMessagesCallback_alias_2 }
|
|
621
|
+
|
|
622
|
+
declare type MCPServerPrompts = {
|
|
623
|
+
listPrompts: () => Promise<Prompt[]>;
|
|
624
|
+
getPromptMessages?: MCPServerPromptMessagesCallback;
|
|
625
|
+
};
|
|
626
|
+
export { MCPServerPrompts }
|
|
627
|
+
export { MCPServerPrompts as MCPServerPrompts_alias_1 }
|
|
628
|
+
export { MCPServerPrompts as MCPServerPrompts_alias_2 }
|
|
629
|
+
|
|
522
630
|
declare type MCPServerResourceContent = {
|
|
523
631
|
text?: string;
|
|
524
632
|
} | {
|
|
@@ -526,12 +634,14 @@ declare type MCPServerResourceContent = {
|
|
|
526
634
|
};
|
|
527
635
|
export { MCPServerResourceContent }
|
|
528
636
|
export { MCPServerResourceContent as MCPServerResourceContent_alias_1 }
|
|
637
|
+
export { MCPServerResourceContent as MCPServerResourceContent_alias_2 }
|
|
529
638
|
|
|
530
639
|
declare type MCPServerResourceContentCallback = ({ uri, }: {
|
|
531
640
|
uri: string;
|
|
532
641
|
}) => Promise<MCPServerResourceContent | MCPServerResourceContent[]>;
|
|
533
642
|
export { MCPServerResourceContentCallback }
|
|
534
643
|
export { MCPServerResourceContentCallback as MCPServerResourceContentCallback_alias_1 }
|
|
644
|
+
export { MCPServerResourceContentCallback as MCPServerResourceContentCallback_alias_2 }
|
|
535
645
|
|
|
536
646
|
declare type MCPServerResources = {
|
|
537
647
|
listResources: () => Promise<Resource[]>;
|
|
@@ -540,9 +650,47 @@ declare type MCPServerResources = {
|
|
|
540
650
|
};
|
|
541
651
|
export { MCPServerResources }
|
|
542
652
|
export { MCPServerResources as MCPServerResources_alias_1 }
|
|
653
|
+
export { MCPServerResources as MCPServerResources_alias_2 }
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Client-side prompt actions for listing, getting, and subscribing to prompt changes.
|
|
657
|
+
*/
|
|
658
|
+
export declare class PromptClientActions {
|
|
659
|
+
private readonly client;
|
|
660
|
+
private readonly logger;
|
|
661
|
+
constructor({ client, logger }: PromptClientActionsConfig);
|
|
662
|
+
/**
|
|
663
|
+
* Get all prompts from the connected MCP server.
|
|
664
|
+
* @returns A list of prompts with their versions.
|
|
665
|
+
*/
|
|
666
|
+
list(): Promise<Prompt[]>;
|
|
667
|
+
/**
|
|
668
|
+
* Get a specific prompt.
|
|
669
|
+
* @param name The name of the prompt to get.
|
|
670
|
+
* @param args Optional arguments for the prompt.
|
|
671
|
+
* @param version Optional version of the prompt to get.
|
|
672
|
+
* @returns The prompt content.
|
|
673
|
+
*/
|
|
674
|
+
get({ name, args, version }: {
|
|
675
|
+
name: string;
|
|
676
|
+
args?: Record<string, any>;
|
|
677
|
+
version?: string;
|
|
678
|
+
}): Promise<GetPromptResult>;
|
|
679
|
+
/**
|
|
680
|
+
* Set a notification handler for when the list of available prompts changes.
|
|
681
|
+
* @param handler The callback function to handle the notification.
|
|
682
|
+
*/
|
|
683
|
+
onListChanged(handler: () => void): Promise<void>;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
declare interface PromptClientActionsConfig {
|
|
687
|
+
client: InternalMastraMCPClient;
|
|
688
|
+
logger: IMastraLogger;
|
|
689
|
+
}
|
|
543
690
|
|
|
544
691
|
export { Resource }
|
|
545
692
|
export { Resource as Resource_alias_1 }
|
|
693
|
+
export { Resource as Resource_alias_2 }
|
|
546
694
|
|
|
547
695
|
export declare class ResourceClientActions {
|
|
548
696
|
private readonly client;
|
|
@@ -629,6 +777,7 @@ declare interface ResourceClientActionsConfig {
|
|
|
629
777
|
|
|
630
778
|
export { ResourceTemplate }
|
|
631
779
|
export { ResourceTemplate as ResourceTemplate_alias_1 }
|
|
780
|
+
export { ResourceTemplate as ResourceTemplate_alias_2 }
|
|
632
781
|
|
|
633
782
|
export declare const server: Server<{
|
|
634
783
|
method: string;
|
|
@@ -656,6 +805,24 @@ export declare const server: Server<{
|
|
|
656
805
|
|
|
657
806
|
export declare const server_alias_1: MCPServer;
|
|
658
807
|
|
|
808
|
+
export declare class ServerPromptActions {
|
|
809
|
+
private readonly getLogger;
|
|
810
|
+
private readonly getSdkServer;
|
|
811
|
+
private readonly clearDefinedPrompts;
|
|
812
|
+
constructor(dependencies: ServerPromptActionsDependencies);
|
|
813
|
+
/**
|
|
814
|
+
* Notifies the server that the overall list of available prompts has changed.
|
|
815
|
+
* This will clear the internal cache of defined prompts and send a list_changed notification to clients.
|
|
816
|
+
*/
|
|
817
|
+
notifyListChanged(): Promise<void>;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
declare interface ServerPromptActionsDependencies {
|
|
821
|
+
getLogger: () => IMastraLogger;
|
|
822
|
+
getSdkServer: () => Server;
|
|
823
|
+
clearDefinedPrompts: () => void;
|
|
824
|
+
}
|
|
825
|
+
|
|
659
826
|
export declare class ServerResourceActions {
|
|
660
827
|
private readonly getSubscriptions;
|
|
661
828
|
private readonly getLogger;
|
|
@@ -774,6 +941,4 @@ location: string;
|
|
|
774
941
|
}>>) => Promise<any>;
|
|
775
942
|
};
|
|
776
943
|
|
|
777
|
-
export declare const writeErrorLog: (message: string, data?: any) => void;
|
|
778
|
-
|
|
779
944
|
export { }
|