@mastra/mcp 0.10.5-alpha.0 → 0.10.5-alpha.2

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/mcp@0.10.5-alpha.0 build /home/runner/work/mastra/mastra/packages/mcp
2
+ > @mastra/mcp@0.10.5-alpha.2 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
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 19065ms
9
+ TSC ⚡️ Build success in 25816ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/packages/mcp/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 19786ms
16
+ DTS ⚡️ Build success in 28816ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 80.87 KB
21
- ESM ⚡️ Build success in 1770ms
22
- CJS dist/index.cjs 81.49 KB
23
- CJS ⚡️ Build success in 1773ms
20
+ CJS dist/index.cjs 89.35 KB
21
+ CJS ⚡️ Build success in 2381ms
22
+ ESM dist/index.js 88.67 KB
23
+ ESM ⚡️ Build success in 2381ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @mastra/mcp
2
2
 
3
+ ## 0.10.5-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - dc93062: Add elicitation support to MCPServer and MCPClient. Also fixes connectivity issues between multiple MCPClient instances and an MCPServer.
8
+ - Updated dependencies [a8b194f]
9
+ - @mastra/core@0.10.7-alpha.4
10
+
11
+ ## 0.10.5-alpha.1
12
+
13
+ ### Patch Changes
14
+
15
+ - ee93d96: dependencies updates:
16
+ - Updated dependency [`@modelcontextprotocol/sdk@^1.12.3` ↗︎](https://www.npmjs.com/package/@modelcontextprotocol/sdk/v/1.12.3) (from `^1.12.1`, in `dependencies`)
17
+ - c00039d: dependencies updates:
18
+ - Updated dependency [`@modelcontextprotocol/sdk@^1.13.0` ↗︎](https://www.npmjs.com/package/@modelcontextprotocol/sdk/v/1.13.0) (from `^1.12.3`, in `dependencies`)
19
+ - 07d6d88: Bump MCP SDK version and add tool output schema support to MCPServer and MCPClient
20
+ - Updated dependencies [15e9d26]
21
+ - Updated dependencies [07d6d88]
22
+ - Updated dependencies [5d74aab]
23
+ - Updated dependencies [144eb0b]
24
+ - @mastra/core@0.10.7-alpha.2
25
+
3
26
  ## 0.10.5-alpha.0
4
27
 
5
28
  ### Patch Changes
@@ -1,9 +1,12 @@
1
1
  import type { 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 { ElicitRequest } from '@modelcontextprotocol/sdk/types.js';
5
+ import type { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
4
6
  import type { GetPromptResult } from '@modelcontextprotocol/sdk/types.js';
5
7
  import type * as http from 'node:http';
6
8
  import type { IMastraLogger } from '@mastra/core/logger';
9
+ import type { InternalCoreTool } from '@mastra/core';
7
10
  import type { ListPromptsResult } from '@modelcontextprotocol/sdk/types.js';
8
11
  import { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
9
12
  import { MastraBase } from '@mastra/core/base';
@@ -52,6 +55,34 @@ declare type BaseServerOptions = {
52
55
  enableServerLogs?: boolean;
53
56
  };
54
57
 
58
+ declare type ElicitationActions = {
59
+ sendRequest: (request: ElicitRequest['params']) => Promise<ElicitResult>;
60
+ };
61
+ export { ElicitationActions }
62
+ export { ElicitationActions as ElicitationActions_alias_1 }
63
+ export { ElicitationActions as ElicitationActions_alias_2 }
64
+
65
+ export declare class ElicitationClientActions {
66
+ private readonly client;
67
+ private readonly logger;
68
+ constructor({ client, logger }: ElicitationClientActionsConfig);
69
+ /**
70
+ * Set a handler for elicitation requests.
71
+ * @param handler The callback function to handle the elicitation request.
72
+ */
73
+ onRequest(handler: (request: ElicitRequest['params']) => Promise<ElicitResult>): void;
74
+ }
75
+
76
+ declare interface ElicitationClientActionsConfig {
77
+ client: InternalMastraMCPClient;
78
+ logger: IMastraLogger;
79
+ }
80
+
81
+ declare type ElicitationHandler = (request: ElicitRequest['params']) => Promise<ElicitResult>;
82
+ export { ElicitationHandler }
83
+ export { ElicitationHandler as ElicitationHandler_alias_1 }
84
+ export { ElicitationHandler as ElicitationHandler_alias_2 }
85
+
55
86
  declare type HttpServerDefinition = BaseServerOptions & {
56
87
  url: URL;
57
88
  command?: never;
@@ -74,6 +105,7 @@ export declare class InternalMastraMCPClient extends MastraBase {
74
105
  private currentOperationContext;
75
106
  readonly resources: ResourceClientActions;
76
107
  readonly prompts: PromptClientActions;
108
+ readonly elicitation: ElicitationClientActions;
77
109
  constructor({ name, version, server, capabilities, timeout, }: InternalMastraMCPClientOptions);
78
110
  /**
79
111
  * Log a message at the specified level
@@ -98,22 +130,31 @@ export declare class InternalMastraMCPClient extends MastraBase {
98
130
  } & {
99
131
  nextCursor: z.ZodOptional<z.ZodString>;
100
132
  } & {
101
- resources: z.ZodArray<z.ZodObject<{
102
- uri: z.ZodString;
133
+ resources: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
103
134
  name: z.ZodString;
135
+ title: z.ZodOptional<z.ZodString>;
136
+ }, {
137
+ uri: z.ZodString;
104
138
  description: z.ZodOptional<z.ZodString>;
105
139
  mimeType: z.ZodOptional<z.ZodString>;
106
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
107
- uri: z.ZodString;
140
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
141
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
108
142
  name: z.ZodString;
143
+ title: z.ZodOptional<z.ZodString>;
144
+ }, {
145
+ uri: z.ZodString;
109
146
  description: z.ZodOptional<z.ZodString>;
110
147
  mimeType: z.ZodOptional<z.ZodString>;
111
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
112
- uri: z.ZodString;
148
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
149
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
113
150
  name: z.ZodString;
151
+ title: z.ZodOptional<z.ZodString>;
152
+ }, {
153
+ uri: z.ZodString;
114
154
  description: z.ZodOptional<z.ZodString>;
115
155
  mimeType: z.ZodOptional<z.ZodString>;
116
- }, z.ZodTypeAny, "passthrough">>, "many">;
156
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
157
+ }>, z.ZodTypeAny, "passthrough">>, "many">;
117
158
  }, z.ZodTypeAny, "passthrough">>;
118
159
  readResource(uri: string): Promise<z.objectOutputType<{
119
160
  _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
@@ -121,31 +162,37 @@ export declare class InternalMastraMCPClient extends MastraBase {
121
162
  contents: z.ZodArray<z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
122
163
  uri: z.ZodString;
123
164
  mimeType: z.ZodOptional<z.ZodString>;
165
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
124
166
  }, {
125
167
  text: z.ZodString;
126
168
  }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
127
169
  uri: z.ZodString;
128
170
  mimeType: z.ZodOptional<z.ZodString>;
171
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
129
172
  }, {
130
173
  text: z.ZodString;
131
174
  }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
132
175
  uri: z.ZodString;
133
176
  mimeType: z.ZodOptional<z.ZodString>;
177
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
134
178
  }, {
135
179
  text: z.ZodString;
136
180
  }>, z.ZodTypeAny, "passthrough">>, z.ZodObject<z.objectUtil.extendShape<{
137
181
  uri: z.ZodString;
138
182
  mimeType: z.ZodOptional<z.ZodString>;
183
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
139
184
  }, {
140
185
  blob: z.ZodString;
141
186
  }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
142
187
  uri: z.ZodString;
143
188
  mimeType: z.ZodOptional<z.ZodString>;
189
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
144
190
  }, {
145
191
  blob: z.ZodString;
146
192
  }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
147
193
  uri: z.ZodString;
148
194
  mimeType: z.ZodOptional<z.ZodString>;
195
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
149
196
  }, {
150
197
  blob: z.ZodString;
151
198
  }>, z.ZodTypeAny, "passthrough">>]>, "many">;
@@ -157,22 +204,31 @@ export declare class InternalMastraMCPClient extends MastraBase {
157
204
  } & {
158
205
  nextCursor: z.ZodOptional<z.ZodString>;
159
206
  } & {
160
- resourceTemplates: z.ZodArray<z.ZodObject<{
161
- uriTemplate: z.ZodString;
207
+ resourceTemplates: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
162
208
  name: z.ZodString;
209
+ title: z.ZodOptional<z.ZodString>;
210
+ }, {
211
+ uriTemplate: z.ZodString;
163
212
  description: z.ZodOptional<z.ZodString>;
164
213
  mimeType: z.ZodOptional<z.ZodString>;
165
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
166
- uriTemplate: z.ZodString;
214
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
215
+ }>, "passthrough", z.ZodTypeAny, z.objectOutputType<z.objectUtil.extendShape<{
167
216
  name: z.ZodString;
217
+ title: z.ZodOptional<z.ZodString>;
218
+ }, {
219
+ uriTemplate: z.ZodString;
168
220
  description: z.ZodOptional<z.ZodString>;
169
221
  mimeType: z.ZodOptional<z.ZodString>;
170
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
171
- uriTemplate: z.ZodString;
222
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
223
+ }>, z.ZodTypeAny, "passthrough">, z.objectInputType<z.objectUtil.extendShape<{
172
224
  name: z.ZodString;
225
+ title: z.ZodOptional<z.ZodString>;
226
+ }, {
227
+ uriTemplate: z.ZodString;
173
228
  description: z.ZodOptional<z.ZodString>;
174
229
  mimeType: z.ZodOptional<z.ZodString>;
175
- }, z.ZodTypeAny, "passthrough">>, "many">;
230
+ _meta: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
231
+ }>, z.ZodTypeAny, "passthrough">>, "many">;
176
232
  }, z.ZodTypeAny, "passthrough">>;
177
233
  /**
178
234
  * Fetch the list of available prompts from the MCP server.
@@ -196,7 +252,9 @@ export declare class InternalMastraMCPClient extends MastraBase {
196
252
  setPromptListChangedNotificationHandler(handler: () => void): void;
197
253
  setResourceUpdatedNotificationHandler(handler: (params: z.infer<typeof ResourceUpdatedNotificationSchema>['params']) => void): void;
198
254
  setResourceListChangedNotificationHandler(handler: () => void): void;
255
+ setElicitationRequestHandler(handler: ElicitationHandler): void;
199
256
  private convertInputSchema;
257
+ private convertOutputSchema;
200
258
  tools(): Promise<Record<string, any>>;
201
259
  }
202
260
 
@@ -251,6 +309,9 @@ declare class MCPClient extends MastraBase {
251
309
  private mcpClientsById;
252
310
  private disconnectPromise;
253
311
  constructor(args: MCPClientOptions);
312
+ get elicitation(): {
313
+ onRequest: (serverName: string, handler: (request: ElicitRequest["params"]) => Promise<ElicitResult>) => Promise<void>;
314
+ };
254
315
  get resources(): {
255
316
  list: () => Promise<Record<string, Resource[]>>;
256
317
  templates: () => Promise<Record<string, ResourceTemplate[]>>;
@@ -260,31 +321,37 @@ declare class MCPClient extends MastraBase {
260
321
  contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
261
322
  uri: ZodString;
262
323
  mimeType: ZodOptional<ZodString>;
324
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
263
325
  }, {
264
326
  text: ZodString;
265
327
  }>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
266
328
  uri: ZodString;
267
329
  mimeType: ZodOptional<ZodString>;
330
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
268
331
  }, {
269
332
  text: ZodString;
270
333
  }>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
271
334
  uri: ZodString;
272
335
  mimeType: ZodOptional<ZodString>;
336
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
273
337
  }, {
274
338
  text: ZodString;
275
339
  }>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
276
340
  uri: ZodString;
277
341
  mimeType: ZodOptional<ZodString>;
342
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
278
343
  }, {
279
344
  blob: ZodString;
280
345
  }>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
281
346
  uri: ZodString;
282
347
  mimeType: ZodOptional<ZodString>;
348
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
283
349
  }, {
284
350
  blob: ZodString;
285
351
  }>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
286
352
  uri: ZodString;
287
353
  mimeType: ZodOptional<ZodString>;
354
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
288
355
  }, {
289
356
  blob: ZodString;
290
357
  }>, ZodTypeAny, "passthrough">>]>, "many">;
@@ -307,21 +374,40 @@ declare class MCPClient extends MastraBase {
307
374
  [x: string]: unknown;
308
375
  messages: {
309
376
  [x: string]: unknown;
310
- role: "user" | "assistant";
311
377
  content: {
312
378
  [x: string]: unknown;
313
379
  type: "text";
314
380
  text: string;
381
+ _meta?: {
382
+ [x: string]: unknown;
383
+ } | undefined;
315
384
  } | {
316
385
  [x: string]: unknown;
317
386
  type: "image";
318
387
  data: string;
319
388
  mimeType: string;
389
+ _meta?: {
390
+ [x: string]: unknown;
391
+ } | undefined;
320
392
  } | {
321
393
  [x: string]: unknown;
322
394
  type: "audio";
323
395
  data: string;
324
396
  mimeType: string;
397
+ _meta?: {
398
+ [x: string]: unknown;
399
+ } | undefined;
400
+ } | {
401
+ [x: string]: unknown;
402
+ type: "resource_link";
403
+ name: string;
404
+ uri: string;
405
+ _meta?: {
406
+ [x: string]: unknown;
407
+ } | undefined;
408
+ title?: string | undefined;
409
+ description?: string | undefined;
410
+ mimeType?: string | undefined;
325
411
  } | {
326
412
  [x: string]: unknown;
327
413
  type: "resource";
@@ -329,19 +415,29 @@ declare class MCPClient extends MastraBase {
329
415
  [x: string]: unknown;
330
416
  text: string;
331
417
  uri: string;
418
+ _meta?: {
419
+ [x: string]: unknown;
420
+ } | undefined;
332
421
  mimeType?: string | undefined;
333
422
  } | {
334
423
  [x: string]: unknown;
335
424
  uri: string;
336
425
  blob: string;
426
+ _meta?: {
427
+ [x: string]: unknown;
428
+ } | undefined;
337
429
  mimeType?: string | undefined;
338
430
  };
431
+ _meta?: {
432
+ [x: string]: unknown;
433
+ } | undefined;
339
434
  };
435
+ role: "user" | "assistant";
340
436
  }[];
341
- description?: string | undefined;
342
437
  _meta?: {
343
438
  [x: string]: unknown;
344
439
  } | undefined;
440
+ description?: string | undefined;
345
441
  }>;
346
442
  onListChanged: (serverName: string, handler: () => void) => Promise<void>;
347
443
  };
@@ -357,6 +453,10 @@ declare class MCPClient extends MastraBase {
357
453
  [x: string]: unknown;
358
454
  name: string;
359
455
  uri: string;
456
+ _meta?: {
457
+ [x: string]: unknown;
458
+ } | undefined;
459
+ title?: string | undefined;
360
460
  description?: string | undefined;
361
461
  mimeType?: string | undefined;
362
462
  }[]>>;
@@ -410,15 +510,7 @@ declare class MCPServer extends MCPServerBase {
410
510
  private sseTransport?;
411
511
  private sseHonoTransports;
412
512
  private streamableHTTPTransports;
413
- private listToolsHandlerIsRegistered;
414
- private callToolHandlerIsRegistered;
415
- private listResourcesHandlerIsRegistered;
416
- private readResourceHandlerIsRegistered;
417
- private listResourceTemplatesHandlerIsRegistered;
418
- private subscribeResourceHandlerIsRegistered;
419
- private unsubscribeResourceHandlerIsRegistered;
420
- private listPromptsHandlerIsRegistered;
421
- private getPromptHandlerIsRegistered;
513
+ private httpServerInstances;
422
514
  private definedResources?;
423
515
  private definedResourceTemplates?;
424
516
  private resourceOptions?;
@@ -427,6 +519,7 @@ declare class MCPServer extends MCPServerBase {
427
519
  private subscriptions;
428
520
  readonly resources: ServerResourceActions;
429
521
  readonly prompts: ServerPromptActions;
522
+ readonly elicitation: ElicitationActions;
430
523
  /**
431
524
  * Get the current stdio transport.
432
525
  */
@@ -451,53 +544,44 @@ declare class MCPServer extends MCPServerBase {
451
544
  resources?: MCPServerResources;
452
545
  prompts?: MCPServerPrompts;
453
546
  });
454
- private convertAgentsToTools;
455
- private convertWorkflowsToTools;
456
547
  /**
457
- * Convert and validate all provided tools, logging registration status.
458
- * Also converts agents and workflows into tools.
459
- * @param tools Tool definitions
460
- * @param agentsConfig Agent definitions to be converted to tools, expected from MCPServerConfig
461
- * @param workflowsConfig Workflow definitions to be converted to tools, expected from MCPServerConfig
462
- * @returns Converted tools registry
463
- */
464
- convertTools(tools: ToolsInput, agentsConfig?: Record<string, Agent>, workflowsConfig?: Record<string, Workflow>): Record<string, ConvertedTool>;
465
- /**
466
- * Register the ListTools handler for listing all available tools.
467
- */
468
- private registerListToolsHandler;
469
- /**
470
- * Register the CallTool handler for executing a tool by name.
471
- */
472
- private registerCallToolHandler;
473
- /**
474
- * Register the ListResources handler for listing all available resources.
475
- */
476
- private registerListResourcesHandler;
477
- /**
478
- * Register the ReadResource handler for reading a resource by URI.
548
+ * Handle an elicitation request by sending it to the connected client.
549
+ * This method sends an elicitation/create request to the client and waits for the response.
550
+ *
551
+ * @param request - The elicitation request containing message and schema
552
+ * @param serverInstance - Optional server instance to use; defaults to main server for backward compatibility
553
+ * @returns Promise that resolves to the client's response
479
554
  */
480
- private registerReadResourceHandler;
555
+ private handleElicitationRequest;
481
556
  /**
482
- * Register the ListResourceTemplates handler.
557
+ * Creates a new Server instance configured with all handlers for HTTP sessions.
558
+ * Each HTTP client connection gets its own Server instance to avoid routing conflicts.
483
559
  */
484
- private registerListResourceTemplatesHandler;
560
+ private createServerInstance;
485
561
  /**
486
- * Register the SubscribeResource handler.
562
+ * Registers all MCP handlers on a given server instance.
563
+ * This allows us to create multiple server instances with identical functionality.
487
564
  */
488
- private registerSubscribeResourceHandler;
565
+ private registerHandlersOnServer;
489
566
  /**
490
- * Register the UnsubscribeResource handler.
567
+ * Registers resource-related handlers on a server instance.
491
568
  */
492
- private registerUnsubscribeResourceHandler;
569
+ private registerResourceHandlersOnServer;
493
570
  /**
494
- * Register the ListPrompts handler.
571
+ * Registers prompt-related handlers on a server instance.
495
572
  */
496
- private registerListPromptsHandler;
573
+ private registerPromptHandlersOnServer;
574
+ private convertAgentsToTools;
575
+ private convertWorkflowsToTools;
497
576
  /**
498
- * Register the GetPrompt handler.
577
+ * Convert and validate all provided tools, logging registration status.
578
+ * Also converts agents and workflows into tools.
579
+ * @param tools Tool definitions
580
+ * @param agentsConfig Agent definitions to be converted to tools, expected from MCPServerConfig
581
+ * @param workflowsConfig Workflow definitions to be converted to tools, expected from MCPServerConfig
582
+ * @returns Converted tools registry
499
583
  */
500
- private registerGetPromptHandler;
584
+ convertTools(tools: ToolsInput, agentsConfig?: Record<string, Agent>, workflowsConfig?: Record<string, Workflow>): Record<string, ConvertedTool>;
501
585
  /**
502
586
  * Start the MCP server using stdio transport (for Windsurf integration).
503
587
  */
@@ -572,6 +656,7 @@ declare class MCPServer extends MCPServerBase {
572
656
  name: string;
573
657
  description?: string;
574
658
  inputSchema: any;
659
+ outputSchema?: any;
575
660
  toolType?: MCPToolType;
576
661
  }>;
577
662
  };
@@ -584,6 +669,7 @@ declare class MCPServer extends MCPServerBase {
584
669
  name: string;
585
670
  description?: string;
586
671
  inputSchema: any;
672
+ outputSchema?: any;
587
673
  toolType?: MCPToolType;
588
674
  } | undefined;
589
675
  /**
@@ -647,6 +733,19 @@ export { MCPServerResources }
647
733
  export { MCPServerResources as MCPServerResources_alias_1 }
648
734
  export { MCPServerResources as MCPServerResources_alias_2 }
649
735
 
736
+ declare type MCPTool = {
737
+ id?: InternalCoreTool['id'];
738
+ description?: InternalCoreTool['description'];
739
+ parameters: InternalCoreTool['parameters'];
740
+ outputSchema?: InternalCoreTool['outputSchema'];
741
+ execute: (params: any, options: Parameters<NonNullable<InternalCoreTool['execute']>>[1] & {
742
+ elicitation: ElicitationActions;
743
+ }) => Promise<any>;
744
+ };
745
+ export { MCPTool }
746
+ export { MCPTool as MCPTool_alias_1 }
747
+ export { MCPTool as MCPTool_alias_2 }
748
+
650
749
  /**
651
750
  * Client-side prompt actions for listing, getting, and subscribing to prompt changes.
652
751
  */
@@ -712,31 +811,37 @@ export declare class ResourceClientActions {
712
811
  contents: ZodArray<ZodUnion<[ZodObject<objectUtil.extendShape< {
713
812
  uri: ZodString;
714
813
  mimeType: ZodOptional<ZodString>;
814
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
715
815
  }, {
716
816
  text: ZodString;
717
817
  }>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
718
818
  uri: ZodString;
719
819
  mimeType: ZodOptional<ZodString>;
820
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
720
821
  }, {
721
822
  text: ZodString;
722
823
  }>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
723
824
  uri: ZodString;
724
825
  mimeType: ZodOptional<ZodString>;
826
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
725
827
  }, {
726
828
  text: ZodString;
727
829
  }>, ZodTypeAny, "passthrough">>, ZodObject<objectUtil.extendShape< {
728
830
  uri: ZodString;
729
831
  mimeType: ZodOptional<ZodString>;
832
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
730
833
  }, {
731
834
  blob: ZodString;
732
835
  }>, "passthrough", ZodTypeAny, objectOutputType<objectUtil.extendShape< {
733
836
  uri: ZodString;
734
837
  mimeType: ZodOptional<ZodString>;
838
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
735
839
  }, {
736
840
  blob: ZodString;
737
841
  }>, ZodTypeAny, "passthrough">, objectInputType<objectUtil.extendShape< {
738
842
  uri: ZodString;
739
843
  mimeType: ZodOptional<ZodString>;
844
+ _meta: ZodOptional<ZodObject< {}, "passthrough", ZodTypeAny, objectOutputType< {}, ZodTypeAny, "passthrough">, objectInputType< {}, ZodTypeAny, "passthrough">>>;
740
845
  }, {
741
846
  blob: ZodString;
742
847
  }>, ZodTypeAny, "passthrough">>]>, "many">;
@@ -864,76 +969,12 @@ location: z.ZodString;
864
969
  location: string;
865
970
  }, {
866
971
  location: string;
867
- }>, z.ZodObject<{
868
- temperature: z.ZodNumber;
869
- feelsLike: z.ZodNumber;
870
- humidity: z.ZodNumber;
871
- windSpeed: z.ZodNumber;
872
- windGust: z.ZodNumber;
873
- conditions: z.ZodString;
874
- location: z.ZodString;
875
- }, "strip", z.ZodTypeAny, {
876
- temperature: number;
877
- location: string;
878
- feelsLike: number;
879
- humidity: number;
880
- windSpeed: number;
881
- windGust: number;
882
- conditions: string;
883
- }, {
884
- temperature: number;
885
- location: string;
886
- feelsLike: number;
887
- humidity: number;
888
- windSpeed: number;
889
- windGust: number;
890
- conditions: string;
891
- }>, ToolExecutionContext<z.ZodObject<{
972
+ }>, undefined, ToolExecutionContext<z.ZodObject<{
892
973
  location: z.ZodString;
893
974
  }, "strip", z.ZodTypeAny, {
894
975
  location: string;
895
976
  }, {
896
977
  location: string;
897
- }>>> & {
898
- inputSchema: z.ZodObject<{
899
- location: z.ZodString;
900
- }, "strip", z.ZodTypeAny, {
901
- location: string;
902
- }, {
903
- location: string;
904
- }>;
905
- outputSchema: z.ZodObject<{
906
- temperature: z.ZodNumber;
907
- feelsLike: z.ZodNumber;
908
- humidity: z.ZodNumber;
909
- windSpeed: z.ZodNumber;
910
- windGust: z.ZodNumber;
911
- conditions: z.ZodString;
912
- location: z.ZodString;
913
- }, "strip", z.ZodTypeAny, {
914
- temperature: number;
915
- location: string;
916
- feelsLike: number;
917
- humidity: number;
918
- windSpeed: number;
919
- windGust: number;
920
- conditions: string;
921
- }, {
922
- temperature: number;
923
- location: string;
924
- feelsLike: number;
925
- humidity: number;
926
- windSpeed: number;
927
- windGust: number;
928
- conditions: string;
929
- }>;
930
- execute: (context: ToolExecutionContext<z.ZodObject<{
931
- location: z.ZodString;
932
- }, "strip", z.ZodTypeAny, {
933
- location: string;
934
- }, {
935
- location: string;
936
- }>>) => Promise<any>;
937
- };
978
+ }>>>;
938
979
 
939
980
  export { }