@ai-sdk/mcp 1.0.0-beta.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,319 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [29264a3]
8
+ - @ai-sdk/provider-utils@4.0.1
9
+
10
+ ## 1.0.0
11
+
12
+ ### Major Changes
13
+
14
+ - eca63f3: feat(ai): add OAuth for MCP clients + refactor to new package
15
+
16
+ This change replaces
17
+
18
+ ```ts
19
+ import { experimental_createMCPClient } from 'ai';
20
+ import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
21
+ ```
22
+
23
+ with
24
+
25
+ ```ts
26
+ import { experimental_createMCPClient } from '@ai-sdk/mcp';
27
+ import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
28
+ ```
29
+
30
+ ### Patch Changes
31
+
32
+ - 90ede04: feat(mcp): make MCPClient stable
33
+ - 6f1577e: fix(mcp): pass json header for refreshAuth
34
+ - 17c04d4: feat(mcp): expose `_meta` field from MCP tool definitions
35
+ - 1cff766: feat(packages/mcp): add support for MCP server prompts exposed
36
+ - 3ed5519: chore: rename ToolCallOptions to ToolExecutionOptions
37
+ - ba2ca2d: feat(mcp): add the possibility to define client version in mcp client definition
38
+ - f702df2: feat(mcp): add client elicitation support
39
+ - 5939b92: feat(mcp): adding resources support to MCP client
40
+ - Updated dependencies
41
+ - @ai-sdk/provider@3.0.0
42
+ - @ai-sdk/provider-utils@4.0.0
43
+
44
+ ## 1.0.0-beta.46
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [475189e]
49
+ - @ai-sdk/provider@3.0.0-beta.32
50
+ - @ai-sdk/provider-utils@4.0.0-beta.59
51
+
52
+ ## 1.0.0-beta.45
53
+
54
+ ### Patch Changes
55
+
56
+ - Updated dependencies [2625a04]
57
+ - @ai-sdk/provider@3.0.0-beta.31
58
+ - @ai-sdk/provider-utils@4.0.0-beta.58
59
+
60
+ ## 1.0.0-beta.44
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [cbf52cd]
65
+ - @ai-sdk/provider@3.0.0-beta.30
66
+ - @ai-sdk/provider-utils@4.0.0-beta.57
67
+
68
+ ## 1.0.0-beta.43
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [9549c9e]
73
+ - @ai-sdk/provider@3.0.0-beta.29
74
+ - @ai-sdk/provider-utils@4.0.0-beta.56
75
+
76
+ ## 1.0.0-beta.42
77
+
78
+ ### Patch Changes
79
+
80
+ - Updated dependencies [50b70d6]
81
+ - @ai-sdk/provider-utils@4.0.0-beta.55
82
+
83
+ ## 1.0.0-beta.41
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [9061dc0]
88
+ - @ai-sdk/provider-utils@4.0.0-beta.54
89
+ - @ai-sdk/provider@3.0.0-beta.28
90
+
91
+ ## 1.0.0-beta.40
92
+
93
+ ### Patch Changes
94
+
95
+ - 90ede04: feat(mcp): make MCPClient stable
96
+
97
+ ## 1.0.0-beta.39
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies [366f50b]
102
+ - @ai-sdk/provider@3.0.0-beta.27
103
+ - @ai-sdk/provider-utils@4.0.0-beta.53
104
+
105
+ ## 1.0.0-beta.38
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [763d04a]
110
+ - @ai-sdk/provider-utils@4.0.0-beta.52
111
+
112
+ ## 1.0.0-beta.37
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [c1efac4]
117
+ - @ai-sdk/provider-utils@4.0.0-beta.51
118
+
119
+ ## 1.0.0-beta.36
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [32223c8]
124
+ - @ai-sdk/provider-utils@4.0.0-beta.50
125
+
126
+ ## 1.0.0-beta.35
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [83e5744]
131
+ - @ai-sdk/provider-utils@4.0.0-beta.49
132
+
133
+ ## 1.0.0-beta.34
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [960ec8f]
138
+ - @ai-sdk/provider-utils@4.0.0-beta.48
139
+
140
+ ## 1.0.0-beta.33
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [e9e157f]
145
+ - @ai-sdk/provider-utils@4.0.0-beta.47
146
+
147
+ ## 1.0.0-beta.32
148
+
149
+ ### Patch Changes
150
+
151
+ - Updated dependencies [81e29ab]
152
+ - @ai-sdk/provider-utils@4.0.0-beta.46
153
+
154
+ ## 1.0.0-beta.31
155
+
156
+ ### Patch Changes
157
+
158
+ - Updated dependencies [3bd2689]
159
+ - @ai-sdk/provider@3.0.0-beta.26
160
+ - @ai-sdk/provider-utils@4.0.0-beta.45
161
+
162
+ ## 1.0.0-beta.30
163
+
164
+ ### Patch Changes
165
+
166
+ - 6f1577e: fix(mcp): pass json header for refreshAuth
167
+
168
+ ## 1.0.0-beta.29
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies [53f3368]
173
+ - @ai-sdk/provider@3.0.0-beta.25
174
+ - @ai-sdk/provider-utils@4.0.0-beta.44
175
+
176
+ ## 1.0.0-beta.28
177
+
178
+ ### Patch Changes
179
+
180
+ - Updated dependencies [dce03c4]
181
+ - @ai-sdk/provider-utils@4.0.0-beta.43
182
+ - @ai-sdk/provider@3.0.0-beta.24
183
+
184
+ ## 1.0.0-beta.27
185
+
186
+ ### Patch Changes
187
+
188
+ - 3ed5519: chore: rename ToolCallOptions to ToolExecutionOptions
189
+ - Updated dependencies [3ed5519]
190
+ - @ai-sdk/provider-utils@4.0.0-beta.42
191
+
192
+ ## 1.0.0-beta.26
193
+
194
+ ### Patch Changes
195
+
196
+ - 17c04d4: feat(mcp): expose `_meta` field from MCP tool definitions
197
+
198
+ ## 1.0.0-beta.25
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies [1bd7d32]
203
+ - @ai-sdk/provider-utils@4.0.0-beta.41
204
+ - @ai-sdk/provider@3.0.0-beta.23
205
+
206
+ ## 1.0.0-beta.24
207
+
208
+ ### Patch Changes
209
+
210
+ - Updated dependencies [544d4e8]
211
+ - @ai-sdk/provider-utils@4.0.0-beta.40
212
+ - @ai-sdk/provider@3.0.0-beta.22
213
+
214
+ ## 1.0.0-beta.23
215
+
216
+ ### Patch Changes
217
+
218
+ - Updated dependencies [954c356]
219
+ - @ai-sdk/provider-utils@4.0.0-beta.39
220
+ - @ai-sdk/provider@3.0.0-beta.21
221
+
222
+ ## 1.0.0-beta.22
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [03849b0]
227
+ - @ai-sdk/provider-utils@4.0.0-beta.38
228
+
229
+ ## 1.0.0-beta.21
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [457318b]
234
+ - @ai-sdk/provider@3.0.0-beta.20
235
+ - @ai-sdk/provider-utils@4.0.0-beta.37
236
+
237
+ ## 1.0.0-beta.20
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [8d9e8ad]
242
+ - @ai-sdk/provider@3.0.0-beta.19
243
+ - @ai-sdk/provider-utils@4.0.0-beta.36
244
+
245
+ ## 1.0.0-beta.19
246
+
247
+ ### Patch Changes
248
+
249
+ - Updated dependencies [10d819b]
250
+ - @ai-sdk/provider@3.0.0-beta.18
251
+ - @ai-sdk/provider-utils@4.0.0-beta.35
252
+
253
+ ## 1.0.0-beta.18
254
+
255
+ ### Patch Changes
256
+
257
+ - ba2ca2d: feat(mcp): add the possibility to define client version in mcp client definition
258
+
259
+ ## 1.0.0-beta.17
260
+
261
+ ### Patch Changes
262
+
263
+ - f702df2: feat(mcp): add client elicitation support
264
+
265
+ ## 1.0.0-beta.16
266
+
267
+ ### Patch Changes
268
+
269
+ - Updated dependencies [db913bd]
270
+ - @ai-sdk/provider@3.0.0-beta.17
271
+ - @ai-sdk/provider-utils@4.0.0-beta.34
272
+
273
+ ## 1.0.0-beta.15
274
+
275
+ ### Patch Changes
276
+
277
+ - Updated dependencies [b681d7d]
278
+ - @ai-sdk/provider@3.0.0-beta.16
279
+ - @ai-sdk/provider-utils@4.0.0-beta.33
280
+
281
+ ## 1.0.0-beta.14
282
+
283
+ ### Patch Changes
284
+
285
+ - Updated dependencies [32d8dbb]
286
+ - @ai-sdk/provider-utils@4.0.0-beta.32
287
+
288
+ ## 1.0.0-beta.13
289
+
290
+ ### Patch Changes
291
+
292
+ - 1cff766: feat(packages/mcp): add support for MCP server prompts exposed
293
+
294
+ ## 1.0.0-beta.12
295
+
296
+ ### Patch Changes
297
+
298
+ - Updated dependencies [bb36798]
299
+ - @ai-sdk/provider@3.0.0-beta.15
300
+ - @ai-sdk/provider-utils@4.0.0-beta.31
301
+
302
+ ## 1.0.0-beta.11
303
+
304
+ ### Patch Changes
305
+
306
+ - Updated dependencies [4f16c37]
307
+ - @ai-sdk/provider-utils@4.0.0-beta.30
308
+
309
+ ## 1.0.0-beta.10
310
+
311
+ ### Patch Changes
312
+
313
+ - Updated dependencies [af3780b]
314
+ - @ai-sdk/provider@3.0.0-beta.14
315
+ - @ai-sdk/provider-utils@4.0.0-beta.29
316
+
3
317
  ## 1.0.0-beta.9
4
318
 
5
319
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -242,18 +242,23 @@ type MCPTransportConfig = {
242
242
  authProvider?: OAuthClientProvider;
243
243
  };
244
244
 
245
+ /** MCP tool metadata - keys should follow MCP _meta key format specification */
246
+ declare const ToolMetaSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
+ type ToolMeta = z.infer<typeof ToolMetaSchema>;
245
248
  type ToolSchemas = Record<string, {
246
249
  inputSchema: FlexibleSchema<JSONObject | unknown>;
247
250
  }> | 'automatic' | undefined;
251
+ /** Base MCP tool type with execute and _meta */
252
+ type McpToolBase<INPUT = unknown> = Tool<INPUT, CallToolResult> & Required<Pick<Tool<INPUT, CallToolResult>, 'execute'>> & {
253
+ _meta?: ToolMeta;
254
+ };
248
255
  type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS extends Record<string, {
249
256
  inputSchema: FlexibleSchema<any>;
250
257
  }> ? {
251
258
  [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
252
259
  inputSchema: FlexibleSchema<infer INPUT>;
253
- } ? Tool<INPUT, CallToolResult> & Required<Pick<Tool<INPUT, CallToolResult>, 'execute'>> : never;
254
- } : McpToolSet<Record<string, {
255
- inputSchema: FlexibleSchema<unknown>;
256
- }>>;
260
+ } ? McpToolBase<INPUT> : never;
261
+ } : Record<string, McpToolBase<unknown>>;
257
262
  declare const BaseParamsSchema: z.ZodObject<{
258
263
  _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
259
264
  }, z.core.$loose>;
@@ -270,6 +275,12 @@ type RequestOptions = {
270
275
  timeout?: number;
271
276
  maxTotalTimeout?: number;
272
277
  };
278
+ declare const ClientCapabilitiesSchema: z.ZodObject<{
279
+ elicitation: z.ZodOptional<z.ZodObject<{
280
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
281
+ }, z.core.$loose>>;
282
+ }, z.core.$loose>;
283
+ type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
273
284
  type PaginatedRequest = Request & {
274
285
  params?: BaseParams & {
275
286
  cursor?: string;
@@ -347,6 +358,67 @@ declare const ReadResourceResultSchema: z.ZodObject<{
347
358
  }, z.core.$loose>]>>;
348
359
  }, z.core.$loose>;
349
360
  type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
361
+ declare const ListPromptsResultSchema: z.ZodObject<{
362
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
363
+ nextCursor: z.ZodOptional<z.ZodString>;
364
+ prompts: z.ZodArray<z.ZodObject<{
365
+ name: z.ZodString;
366
+ title: z.ZodOptional<z.ZodString>;
367
+ description: z.ZodOptional<z.ZodString>;
368
+ arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
369
+ name: z.ZodString;
370
+ description: z.ZodOptional<z.ZodString>;
371
+ required: z.ZodOptional<z.ZodBoolean>;
372
+ }, z.core.$loose>>>;
373
+ }, z.core.$loose>>;
374
+ }, z.core.$loose>;
375
+ type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
376
+ declare const GetPromptResultSchema: z.ZodObject<{
377
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
378
+ description: z.ZodOptional<z.ZodString>;
379
+ messages: z.ZodArray<z.ZodObject<{
380
+ role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
381
+ content: z.ZodUnion<readonly [z.ZodObject<{
382
+ type: z.ZodLiteral<"text">;
383
+ text: z.ZodString;
384
+ }, z.core.$loose>, z.ZodObject<{
385
+ type: z.ZodLiteral<"image">;
386
+ data: z.ZodBase64;
387
+ mimeType: z.ZodString;
388
+ }, z.core.$loose>, z.ZodObject<{
389
+ type: z.ZodLiteral<"resource">;
390
+ resource: z.ZodUnion<readonly [z.ZodObject<{
391
+ uri: z.ZodString;
392
+ name: z.ZodOptional<z.ZodString>;
393
+ title: z.ZodOptional<z.ZodString>;
394
+ mimeType: z.ZodOptional<z.ZodString>;
395
+ text: z.ZodString;
396
+ }, z.core.$loose>, z.ZodObject<{
397
+ uri: z.ZodString;
398
+ name: z.ZodOptional<z.ZodString>;
399
+ title: z.ZodOptional<z.ZodString>;
400
+ mimeType: z.ZodOptional<z.ZodString>;
401
+ blob: z.ZodBase64;
402
+ }, z.core.$loose>]>;
403
+ }, z.core.$loose>]>;
404
+ }, z.core.$loose>>;
405
+ }, z.core.$loose>;
406
+ type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
407
+ declare const ElicitationRequestSchema: z.ZodObject<{
408
+ method: z.ZodLiteral<"elicitation/create">;
409
+ params: z.ZodObject<{
410
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
411
+ message: z.ZodString;
412
+ requestedSchema: z.ZodUnknown;
413
+ }, z.core.$loose>;
414
+ }, z.core.$strip>;
415
+ type ElicitationRequest = z.infer<typeof ElicitationRequestSchema>;
416
+ declare const ElicitResultSchema: z.ZodObject<{
417
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
418
+ action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
419
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
420
+ }, z.core.$loose>;
421
+ type ElicitResult = z.infer<typeof ElicitResultSchema>;
350
422
 
351
423
  interface MCPClientConfig {
352
424
  /** Transport configuration for connecting to the MCP server */
@@ -355,6 +427,14 @@ interface MCPClientConfig {
355
427
  onUncaughtError?: (error: unknown) => void;
356
428
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
357
429
  name?: string;
430
+ /** Optional client version, defaults to '1.0.0' */
431
+ version?: string;
432
+ /**
433
+ * Optional client capabilities to advertise during initialization
434
+ *
435
+ * NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
436
+ */
437
+ capabilities?: ClientCapabilities;
358
438
  }
359
439
  declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
360
440
  interface MCPClient {
@@ -372,7 +452,17 @@ interface MCPClient {
372
452
  listResourceTemplates(options?: {
373
453
  options?: RequestOptions;
374
454
  }): Promise<ListResourceTemplatesResult>;
455
+ experimental_listPrompts(options?: {
456
+ params?: PaginatedRequest['params'];
457
+ options?: RequestOptions;
458
+ }): Promise<ListPromptsResult>;
459
+ experimental_getPrompt(args: {
460
+ name: string;
461
+ arguments?: Record<string, unknown>;
462
+ options?: RequestOptions;
463
+ }): Promise<GetPromptResult>;
464
+ onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
375
465
  close: () => Promise<void>;
376
466
  }
377
467
 
378
- export { type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, type MCPClient as experimental_MCPClient, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
468
+ export { type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
package/dist/index.d.ts CHANGED
@@ -242,18 +242,23 @@ type MCPTransportConfig = {
242
242
  authProvider?: OAuthClientProvider;
243
243
  };
244
244
 
245
+ /** MCP tool metadata - keys should follow MCP _meta key format specification */
246
+ declare const ToolMetaSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
247
+ type ToolMeta = z.infer<typeof ToolMetaSchema>;
245
248
  type ToolSchemas = Record<string, {
246
249
  inputSchema: FlexibleSchema<JSONObject | unknown>;
247
250
  }> | 'automatic' | undefined;
251
+ /** Base MCP tool type with execute and _meta */
252
+ type McpToolBase<INPUT = unknown> = Tool<INPUT, CallToolResult> & Required<Pick<Tool<INPUT, CallToolResult>, 'execute'>> & {
253
+ _meta?: ToolMeta;
254
+ };
248
255
  type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS extends Record<string, {
249
256
  inputSchema: FlexibleSchema<any>;
250
257
  }> ? {
251
258
  [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
252
259
  inputSchema: FlexibleSchema<infer INPUT>;
253
- } ? Tool<INPUT, CallToolResult> & Required<Pick<Tool<INPUT, CallToolResult>, 'execute'>> : never;
254
- } : McpToolSet<Record<string, {
255
- inputSchema: FlexibleSchema<unknown>;
256
- }>>;
260
+ } ? McpToolBase<INPUT> : never;
261
+ } : Record<string, McpToolBase<unknown>>;
257
262
  declare const BaseParamsSchema: z.ZodObject<{
258
263
  _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
259
264
  }, z.core.$loose>;
@@ -270,6 +275,12 @@ type RequestOptions = {
270
275
  timeout?: number;
271
276
  maxTotalTimeout?: number;
272
277
  };
278
+ declare const ClientCapabilitiesSchema: z.ZodObject<{
279
+ elicitation: z.ZodOptional<z.ZodObject<{
280
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
281
+ }, z.core.$loose>>;
282
+ }, z.core.$loose>;
283
+ type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
273
284
  type PaginatedRequest = Request & {
274
285
  params?: BaseParams & {
275
286
  cursor?: string;
@@ -347,6 +358,67 @@ declare const ReadResourceResultSchema: z.ZodObject<{
347
358
  }, z.core.$loose>]>>;
348
359
  }, z.core.$loose>;
349
360
  type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
361
+ declare const ListPromptsResultSchema: z.ZodObject<{
362
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
363
+ nextCursor: z.ZodOptional<z.ZodString>;
364
+ prompts: z.ZodArray<z.ZodObject<{
365
+ name: z.ZodString;
366
+ title: z.ZodOptional<z.ZodString>;
367
+ description: z.ZodOptional<z.ZodString>;
368
+ arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
369
+ name: z.ZodString;
370
+ description: z.ZodOptional<z.ZodString>;
371
+ required: z.ZodOptional<z.ZodBoolean>;
372
+ }, z.core.$loose>>>;
373
+ }, z.core.$loose>>;
374
+ }, z.core.$loose>;
375
+ type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
376
+ declare const GetPromptResultSchema: z.ZodObject<{
377
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
378
+ description: z.ZodOptional<z.ZodString>;
379
+ messages: z.ZodArray<z.ZodObject<{
380
+ role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
381
+ content: z.ZodUnion<readonly [z.ZodObject<{
382
+ type: z.ZodLiteral<"text">;
383
+ text: z.ZodString;
384
+ }, z.core.$loose>, z.ZodObject<{
385
+ type: z.ZodLiteral<"image">;
386
+ data: z.ZodBase64;
387
+ mimeType: z.ZodString;
388
+ }, z.core.$loose>, z.ZodObject<{
389
+ type: z.ZodLiteral<"resource">;
390
+ resource: z.ZodUnion<readonly [z.ZodObject<{
391
+ uri: z.ZodString;
392
+ name: z.ZodOptional<z.ZodString>;
393
+ title: z.ZodOptional<z.ZodString>;
394
+ mimeType: z.ZodOptional<z.ZodString>;
395
+ text: z.ZodString;
396
+ }, z.core.$loose>, z.ZodObject<{
397
+ uri: z.ZodString;
398
+ name: z.ZodOptional<z.ZodString>;
399
+ title: z.ZodOptional<z.ZodString>;
400
+ mimeType: z.ZodOptional<z.ZodString>;
401
+ blob: z.ZodBase64;
402
+ }, z.core.$loose>]>;
403
+ }, z.core.$loose>]>;
404
+ }, z.core.$loose>>;
405
+ }, z.core.$loose>;
406
+ type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
407
+ declare const ElicitationRequestSchema: z.ZodObject<{
408
+ method: z.ZodLiteral<"elicitation/create">;
409
+ params: z.ZodObject<{
410
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
411
+ message: z.ZodString;
412
+ requestedSchema: z.ZodUnknown;
413
+ }, z.core.$loose>;
414
+ }, z.core.$strip>;
415
+ type ElicitationRequest = z.infer<typeof ElicitationRequestSchema>;
416
+ declare const ElicitResultSchema: z.ZodObject<{
417
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
418
+ action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
419
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
420
+ }, z.core.$loose>;
421
+ type ElicitResult = z.infer<typeof ElicitResultSchema>;
350
422
 
351
423
  interface MCPClientConfig {
352
424
  /** Transport configuration for connecting to the MCP server */
@@ -355,6 +427,14 @@ interface MCPClientConfig {
355
427
  onUncaughtError?: (error: unknown) => void;
356
428
  /** Optional client name, defaults to 'ai-sdk-mcp-client' */
357
429
  name?: string;
430
+ /** Optional client version, defaults to '1.0.0' */
431
+ version?: string;
432
+ /**
433
+ * Optional client capabilities to advertise during initialization
434
+ *
435
+ * NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
436
+ */
437
+ capabilities?: ClientCapabilities;
358
438
  }
359
439
  declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
360
440
  interface MCPClient {
@@ -372,7 +452,17 @@ interface MCPClient {
372
452
  listResourceTemplates(options?: {
373
453
  options?: RequestOptions;
374
454
  }): Promise<ListResourceTemplatesResult>;
455
+ experimental_listPrompts(options?: {
456
+ params?: PaginatedRequest['params'];
457
+ options?: RequestOptions;
458
+ }): Promise<ListPromptsResult>;
459
+ experimental_getPrompt(args: {
460
+ name: string;
461
+ arguments?: Record<string, unknown>;
462
+ options?: RequestOptions;
463
+ }): Promise<GetPromptResult>;
464
+ onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
375
465
  close: () => Promise<void>;
376
466
  }
377
467
 
378
- export { type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, type MCPClient as experimental_MCPClient, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };
468
+ export { type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient };