@ai-sdk/mcp 1.0.0-beta.9 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,375 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - eca63f3: feat(ai): add OAuth for MCP clients + refactor to new package
8
+
9
+ This change replaces
10
+
11
+ ```ts
12
+ import { experimental_createMCPClient } from 'ai';
13
+ import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
14
+ ```
15
+
16
+ with
17
+
18
+ ```ts
19
+ import { experimental_createMCPClient } from '@ai-sdk/mcp';
20
+ import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
21
+ ```
22
+
23
+ ### Patch Changes
24
+
25
+ - 90ede04: feat(mcp): make MCPClient stable
26
+ - 6f1577e: fix(mcp): pass json header for refreshAuth
27
+ - 17c04d4: feat(mcp): expose `_meta` field from MCP tool definitions
28
+ - 1cff766: feat(packages/mcp): add support for MCP server prompts exposed
29
+ - 3ed5519: chore: rename ToolCallOptions to ToolExecutionOptions
30
+ - ba2ca2d: feat(mcp): add the possibility to define client version in mcp client definition
31
+ - f702df2: feat(mcp): add client elicitation support
32
+ - 5939b92: feat(mcp): adding resources support to MCP client
33
+ - Updated dependencies [0c3b58b]
34
+ - Updated dependencies [0adc679]
35
+ - Updated dependencies [50b70d6]
36
+ - Updated dependencies [d1bdadb]
37
+ - Updated dependencies [dee8b05]
38
+ - Updated dependencies [046aa3b]
39
+ - Updated dependencies [8d9e8ad]
40
+ - Updated dependencies [78928cb]
41
+ - Updated dependencies [dce03c4]
42
+ - Updated dependencies [2625a04]
43
+ - Updated dependencies [37c58a0]
44
+ - Updated dependencies [3b1d015]
45
+ - Updated dependencies [2b0caef]
46
+ - Updated dependencies [95f65c2]
47
+ - Updated dependencies [016b111]
48
+ - Updated dependencies [58920e0]
49
+ - Updated dependencies [954c356]
50
+ - Updated dependencies [544d4e8]
51
+ - Updated dependencies [0c4822d]
52
+ - Updated dependencies [521c537]
53
+ - Updated dependencies [4c44a5b]
54
+ - Updated dependencies [e8109d3]
55
+ - Updated dependencies [03849b0]
56
+ - Updated dependencies [ed329cb]
57
+ - Updated dependencies [e06565c]
58
+ - Updated dependencies [32d8dbb]
59
+ - Updated dependencies [53f3368]
60
+ - Updated dependencies [d116b4b]
61
+ - Updated dependencies [3bd2689]
62
+ - Updated dependencies [293a6b7]
63
+ - Updated dependencies [703459a]
64
+ - Updated dependencies [bb36798]
65
+ - Updated dependencies [83e5744]
66
+ - Updated dependencies [7e32fea]
67
+ - Updated dependencies [3ed5519]
68
+ - Updated dependencies [8dac895]
69
+ - Updated dependencies [a755db5]
70
+ - Updated dependencies [cbb1d35]
71
+ - Updated dependencies [475189e]
72
+ - Updated dependencies [457318b]
73
+ - Updated dependencies [b681d7d]
74
+ - Updated dependencies [db913bd]
75
+ - Updated dependencies [9061dc0]
76
+ - Updated dependencies [32223c8]
77
+ - Updated dependencies [c1efac4]
78
+ - Updated dependencies [366f50b]
79
+ - Updated dependencies [4616b86]
80
+ - Updated dependencies [81d4308]
81
+ - Updated dependencies [9549c9e]
82
+ - Updated dependencies [af3780b]
83
+ - Updated dependencies [4f16c37]
84
+ - Updated dependencies [81e29ab]
85
+ - Updated dependencies [522f6b8]
86
+ - Updated dependencies [6306603]
87
+ - Updated dependencies [fca786b]
88
+ - Updated dependencies [763d04a]
89
+ - Updated dependencies [10d819b]
90
+ - Updated dependencies [3794514]
91
+ - Updated dependencies [cbf52cd]
92
+ - Updated dependencies [e9e157f]
93
+ - Updated dependencies [960ec8f]
94
+ - Updated dependencies [1bd7d32]
95
+ - Updated dependencies [f0b2157]
96
+ - Updated dependencies [95f65c2]
97
+ - @ai-sdk/provider@3.0.0
98
+ - @ai-sdk/provider-utils@4.0.0
99
+
100
+ ## 1.0.0-beta.46
101
+
102
+ ### Patch Changes
103
+
104
+ - Updated dependencies [475189e]
105
+ - @ai-sdk/provider@3.0.0-beta.32
106
+ - @ai-sdk/provider-utils@4.0.0-beta.59
107
+
108
+ ## 1.0.0-beta.45
109
+
110
+ ### Patch Changes
111
+
112
+ - Updated dependencies [2625a04]
113
+ - @ai-sdk/provider@3.0.0-beta.31
114
+ - @ai-sdk/provider-utils@4.0.0-beta.58
115
+
116
+ ## 1.0.0-beta.44
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [cbf52cd]
121
+ - @ai-sdk/provider@3.0.0-beta.30
122
+ - @ai-sdk/provider-utils@4.0.0-beta.57
123
+
124
+ ## 1.0.0-beta.43
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [9549c9e]
129
+ - @ai-sdk/provider@3.0.0-beta.29
130
+ - @ai-sdk/provider-utils@4.0.0-beta.56
131
+
132
+ ## 1.0.0-beta.42
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [50b70d6]
137
+ - @ai-sdk/provider-utils@4.0.0-beta.55
138
+
139
+ ## 1.0.0-beta.41
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [9061dc0]
144
+ - @ai-sdk/provider-utils@4.0.0-beta.54
145
+ - @ai-sdk/provider@3.0.0-beta.28
146
+
147
+ ## 1.0.0-beta.40
148
+
149
+ ### Patch Changes
150
+
151
+ - 90ede04: feat(mcp): make MCPClient stable
152
+
153
+ ## 1.0.0-beta.39
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [366f50b]
158
+ - @ai-sdk/provider@3.0.0-beta.27
159
+ - @ai-sdk/provider-utils@4.0.0-beta.53
160
+
161
+ ## 1.0.0-beta.38
162
+
163
+ ### Patch Changes
164
+
165
+ - Updated dependencies [763d04a]
166
+ - @ai-sdk/provider-utils@4.0.0-beta.52
167
+
168
+ ## 1.0.0-beta.37
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies [c1efac4]
173
+ - @ai-sdk/provider-utils@4.0.0-beta.51
174
+
175
+ ## 1.0.0-beta.36
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies [32223c8]
180
+ - @ai-sdk/provider-utils@4.0.0-beta.50
181
+
182
+ ## 1.0.0-beta.35
183
+
184
+ ### Patch Changes
185
+
186
+ - Updated dependencies [83e5744]
187
+ - @ai-sdk/provider-utils@4.0.0-beta.49
188
+
189
+ ## 1.0.0-beta.34
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [960ec8f]
194
+ - @ai-sdk/provider-utils@4.0.0-beta.48
195
+
196
+ ## 1.0.0-beta.33
197
+
198
+ ### Patch Changes
199
+
200
+ - Updated dependencies [e9e157f]
201
+ - @ai-sdk/provider-utils@4.0.0-beta.47
202
+
203
+ ## 1.0.0-beta.32
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies [81e29ab]
208
+ - @ai-sdk/provider-utils@4.0.0-beta.46
209
+
210
+ ## 1.0.0-beta.31
211
+
212
+ ### Patch Changes
213
+
214
+ - Updated dependencies [3bd2689]
215
+ - @ai-sdk/provider@3.0.0-beta.26
216
+ - @ai-sdk/provider-utils@4.0.0-beta.45
217
+
218
+ ## 1.0.0-beta.30
219
+
220
+ ### Patch Changes
221
+
222
+ - 6f1577e: fix(mcp): pass json header for refreshAuth
223
+
224
+ ## 1.0.0-beta.29
225
+
226
+ ### Patch Changes
227
+
228
+ - Updated dependencies [53f3368]
229
+ - @ai-sdk/provider@3.0.0-beta.25
230
+ - @ai-sdk/provider-utils@4.0.0-beta.44
231
+
232
+ ## 1.0.0-beta.28
233
+
234
+ ### Patch Changes
235
+
236
+ - Updated dependencies [dce03c4]
237
+ - @ai-sdk/provider-utils@4.0.0-beta.43
238
+ - @ai-sdk/provider@3.0.0-beta.24
239
+
240
+ ## 1.0.0-beta.27
241
+
242
+ ### Patch Changes
243
+
244
+ - 3ed5519: chore: rename ToolCallOptions to ToolExecutionOptions
245
+ - Updated dependencies [3ed5519]
246
+ - @ai-sdk/provider-utils@4.0.0-beta.42
247
+
248
+ ## 1.0.0-beta.26
249
+
250
+ ### Patch Changes
251
+
252
+ - 17c04d4: feat(mcp): expose `_meta` field from MCP tool definitions
253
+
254
+ ## 1.0.0-beta.25
255
+
256
+ ### Patch Changes
257
+
258
+ - Updated dependencies [1bd7d32]
259
+ - @ai-sdk/provider-utils@4.0.0-beta.41
260
+ - @ai-sdk/provider@3.0.0-beta.23
261
+
262
+ ## 1.0.0-beta.24
263
+
264
+ ### Patch Changes
265
+
266
+ - Updated dependencies [544d4e8]
267
+ - @ai-sdk/provider-utils@4.0.0-beta.40
268
+ - @ai-sdk/provider@3.0.0-beta.22
269
+
270
+ ## 1.0.0-beta.23
271
+
272
+ ### Patch Changes
273
+
274
+ - Updated dependencies [954c356]
275
+ - @ai-sdk/provider-utils@4.0.0-beta.39
276
+ - @ai-sdk/provider@3.0.0-beta.21
277
+
278
+ ## 1.0.0-beta.22
279
+
280
+ ### Patch Changes
281
+
282
+ - Updated dependencies [03849b0]
283
+ - @ai-sdk/provider-utils@4.0.0-beta.38
284
+
285
+ ## 1.0.0-beta.21
286
+
287
+ ### Patch Changes
288
+
289
+ - Updated dependencies [457318b]
290
+ - @ai-sdk/provider@3.0.0-beta.20
291
+ - @ai-sdk/provider-utils@4.0.0-beta.37
292
+
293
+ ## 1.0.0-beta.20
294
+
295
+ ### Patch Changes
296
+
297
+ - Updated dependencies [8d9e8ad]
298
+ - @ai-sdk/provider@3.0.0-beta.19
299
+ - @ai-sdk/provider-utils@4.0.0-beta.36
300
+
301
+ ## 1.0.0-beta.19
302
+
303
+ ### Patch Changes
304
+
305
+ - Updated dependencies [10d819b]
306
+ - @ai-sdk/provider@3.0.0-beta.18
307
+ - @ai-sdk/provider-utils@4.0.0-beta.35
308
+
309
+ ## 1.0.0-beta.18
310
+
311
+ ### Patch Changes
312
+
313
+ - ba2ca2d: feat(mcp): add the possibility to define client version in mcp client definition
314
+
315
+ ## 1.0.0-beta.17
316
+
317
+ ### Patch Changes
318
+
319
+ - f702df2: feat(mcp): add client elicitation support
320
+
321
+ ## 1.0.0-beta.16
322
+
323
+ ### Patch Changes
324
+
325
+ - Updated dependencies [db913bd]
326
+ - @ai-sdk/provider@3.0.0-beta.17
327
+ - @ai-sdk/provider-utils@4.0.0-beta.34
328
+
329
+ ## 1.0.0-beta.15
330
+
331
+ ### Patch Changes
332
+
333
+ - Updated dependencies [b681d7d]
334
+ - @ai-sdk/provider@3.0.0-beta.16
335
+ - @ai-sdk/provider-utils@4.0.0-beta.33
336
+
337
+ ## 1.0.0-beta.14
338
+
339
+ ### Patch Changes
340
+
341
+ - Updated dependencies [32d8dbb]
342
+ - @ai-sdk/provider-utils@4.0.0-beta.32
343
+
344
+ ## 1.0.0-beta.13
345
+
346
+ ### Patch Changes
347
+
348
+ - 1cff766: feat(packages/mcp): add support for MCP server prompts exposed
349
+
350
+ ## 1.0.0-beta.12
351
+
352
+ ### Patch Changes
353
+
354
+ - Updated dependencies [bb36798]
355
+ - @ai-sdk/provider@3.0.0-beta.15
356
+ - @ai-sdk/provider-utils@4.0.0-beta.31
357
+
358
+ ## 1.0.0-beta.11
359
+
360
+ ### Patch Changes
361
+
362
+ - Updated dependencies [4f16c37]
363
+ - @ai-sdk/provider-utils@4.0.0-beta.30
364
+
365
+ ## 1.0.0-beta.10
366
+
367
+ ### Patch Changes
368
+
369
+ - Updated dependencies [af3780b]
370
+ - @ai-sdk/provider@3.0.0-beta.14
371
+ - @ai-sdk/provider-utils@4.0.0-beta.29
372
+
3
373
  ## 1.0.0-beta.9
4
374
 
5
375
  ### 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 };