@ai-sdk/mcp 2.0.0-beta.3 → 2.0.0-beta.30

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,10 +1,217 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 2.0.0-beta.30
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [350ea38]
8
+ - @ai-sdk/provider-utils@5.0.0-beta.23
9
+
10
+ ## 2.0.0-beta.29
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [083947b]
15
+ - @ai-sdk/provider-utils@5.0.0-beta.22
16
+
17
+ ## 2.0.0-beta.28
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [add1126]
22
+ - @ai-sdk/provider-utils@5.0.0-beta.21
23
+
24
+ ## 2.0.0-beta.27
25
+
26
+ ### Patch Changes
27
+
28
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
29
+ - Updated dependencies [b3976a2]
30
+ - Updated dependencies [ff5eba1]
31
+ - @ai-sdk/provider-utils@5.0.0-beta.20
32
+ - @ai-sdk/provider@4.0.0-beta.12
33
+
34
+ ## 2.0.0-beta.26
35
+
36
+ ### Major Changes
37
+
38
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [ef992f8]
43
+ - @ai-sdk/provider@4.0.0-beta.11
44
+ - @ai-sdk/provider-utils@5.0.0-beta.19
45
+
46
+ ## 2.0.0-beta.25
47
+
48
+ ### Patch Changes
49
+
50
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
51
+ - Updated dependencies [90e2d8a]
52
+ - @ai-sdk/provider-utils@5.0.0-beta.18
53
+
54
+ ## 2.0.0-beta.24
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [3ae1786]
59
+ - @ai-sdk/provider-utils@5.0.0-beta.17
60
+
61
+ ## 2.0.0-beta.23
62
+
63
+ ### Patch Changes
64
+
65
+ - a98bf66: feat(mcp): surface 'serverInfo' exposed from the MCP server
66
+
67
+ ## 2.0.0-beta.22
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [176466a]
72
+ - @ai-sdk/provider@4.0.0-beta.10
73
+ - @ai-sdk/provider-utils@5.0.0-beta.16
74
+
75
+ ## 2.0.0-beta.21
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [e311194]
80
+ - @ai-sdk/provider@4.0.0-beta.9
81
+ - @ai-sdk/provider-utils@5.0.0-beta.15
82
+
83
+ ## 2.0.0-beta.20
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [34bd95d]
88
+ - Updated dependencies [008271d]
89
+ - @ai-sdk/provider@4.0.0-beta.8
90
+ - @ai-sdk/provider-utils@5.0.0-beta.14
91
+
92
+ ## 2.0.0-beta.19
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [b0c2869]
97
+ - Updated dependencies [7e26e81]
98
+ - @ai-sdk/provider-utils@5.0.0-beta.13
99
+
100
+ ## 2.0.0-beta.18
101
+
102
+ ### Patch Changes
103
+
104
+ - e3ea484: fix(mcp): bypass outputSchema validation when tool returns isError
105
+
106
+ ## 2.0.0-beta.17
107
+
108
+ ### Patch Changes
109
+
110
+ - a00d1d3: feat(mcp): allow custom fetch for HTTP and SSE transports
111
+
112
+ ## 2.0.0-beta.16
113
+
114
+ ### Patch Changes
115
+
116
+ - Updated dependencies [46d1149]
117
+ - @ai-sdk/provider-utils@5.0.0-beta.12
118
+
119
+ ## 2.0.0-beta.15
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [6fd51c0]
124
+ - @ai-sdk/provider-utils@5.0.0-beta.11
125
+ - @ai-sdk/provider@4.0.0-beta.7
126
+
127
+ ## 2.0.0-beta.14
128
+
129
+ ### Patch Changes
130
+
131
+ - 1e89d62: fix(mcp): strip trailing slash from OAuth resource parameter
132
+ - Updated dependencies [c29a26f]
133
+ - @ai-sdk/provider-utils@5.0.0-beta.10
134
+ - @ai-sdk/provider@4.0.0-beta.6
135
+
136
+ ## 2.0.0-beta.13
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [2e17091]
141
+ - @ai-sdk/provider-utils@5.0.0-beta.9
142
+
143
+ ## 2.0.0-beta.12
144
+
145
+ ### Patch Changes
146
+
147
+ - Updated dependencies [986c6fd]
148
+ - Updated dependencies [493295c]
149
+ - @ai-sdk/provider-utils@5.0.0-beta.8
150
+
151
+ ## 2.0.0-beta.11
152
+
153
+ ### Patch Changes
154
+
155
+ - Updated dependencies [1f509d4]
156
+ - @ai-sdk/provider-utils@5.0.0-beta.7
157
+ - @ai-sdk/provider@4.0.0-beta.5
158
+
159
+ ## 2.0.0-beta.10
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies [3887c70]
164
+ - @ai-sdk/provider-utils@5.0.0-beta.6
165
+ - @ai-sdk/provider@4.0.0-beta.4
166
+
167
+ ## 2.0.0-beta.9
168
+
169
+ ### Patch Changes
170
+
171
+ - Updated dependencies [776b617]
172
+ - @ai-sdk/provider-utils@5.0.0-beta.5
173
+ - @ai-sdk/provider@4.0.0-beta.3
174
+
175
+ ## 2.0.0-beta.8
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies [61753c3]
180
+ - @ai-sdk/provider-utils@5.0.0-beta.4
181
+
182
+ ## 2.0.0-beta.7
183
+
184
+ ### Major Changes
185
+
186
+ - 23fa161: fix(mcp): setting redirect: error for MCP transport
187
+
188
+ ## 2.0.0-beta.6
189
+
190
+ ### Patch Changes
191
+
192
+ - 58c9eb1: feat(mcp): add `redirect` option to `MCPTransportConfig` for controlling HTTP redirect behavior
193
+
194
+ ## 2.0.0-beta.5
195
+
196
+ ### Patch Changes
197
+
198
+ - Updated dependencies [f7d4f01]
199
+ - @ai-sdk/provider-utils@5.0.0-beta.3
200
+ - @ai-sdk/provider@4.0.0-beta.2
201
+
202
+ ## 2.0.0-beta.4
203
+
204
+ ### Patch Changes
205
+
206
+ - Updated dependencies [5c2a5a2]
207
+ - @ai-sdk/provider@4.0.0-beta.1
208
+ - @ai-sdk/provider-utils@5.0.0-beta.2
209
+
3
210
  ## 2.0.0-beta.3
4
211
 
5
212
  ### Patch Changes
6
213
 
7
- - b9b3899: changeset for #13384
214
+ - b9b3899: fix(mcp): validate state param in oauth flow
8
215
 
9
216
  ## 2.0.0-beta.2
10
217
 
@@ -219,15 +426,15 @@
219
426
  This change replaces
220
427
 
221
428
  ```ts
222
- import { experimental_createMCPClient } from 'ai';
223
- import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
429
+ import { experimental_createMCPClient } from "ai";
430
+ import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
224
431
  ```
225
432
 
226
433
  with
227
434
 
228
435
  ```ts
229
- import { experimental_createMCPClient } from '@ai-sdk/mcp';
230
- import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
436
+ import { experimental_createMCPClient } from "@ai-sdk/mcp";
437
+ import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
231
438
  ```
232
439
 
233
440
  ### Patch Changes
@@ -593,13 +800,13 @@
593
800
  This change replaces
594
801
 
595
802
  ```ts
596
- import { experimental_createMCPClient } from 'ai';
597
- import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
803
+ import { experimental_createMCPClient } from "ai";
804
+ import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
598
805
  ```
599
806
 
600
807
  with
601
808
 
602
809
  ```ts
603
- import { experimental_createMCPClient } from '@ai-sdk/mcp';
604
- import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
810
+ import { experimental_createMCPClient } from "@ai-sdk/mcp";
811
+ import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
605
812
  ```
package/dist/index.d.ts CHANGED
@@ -243,6 +243,19 @@ type MCPTransportConfig = {
243
243
  * An optional OAuth client provider to use for authentication for MCP servers.
244
244
  */
245
245
  authProvider?: OAuthClientProvider;
246
+ /**
247
+ * Controls how HTTP redirects are handled for transport requests.
248
+ * - `'follow'`: Follow redirects automatically (standard fetch behavior).
249
+ * - `'error'`: Reject any redirect response with an error.
250
+ * @default 'error'
251
+ */
252
+ redirect?: 'follow' | 'error';
253
+ /**
254
+ * Optional custom fetch implementation to use for HTTP requests.
255
+ * Useful for runtimes that need a request-local fetch.
256
+ * @default globalThis.fetch
257
+ */
258
+ fetch?: FetchFunction;
246
259
  };
247
260
 
248
261
  /** MCP tool metadata - keys should follow MCP _meta key format specification */
@@ -267,6 +280,12 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
267
280
  inputSchema: FlexibleSchema<infer INPUT>;
268
281
  } ? McpToolBase<INPUT, CallToolResult> : never;
269
282
  } : Record<string, McpToolBase<unknown, CallToolResult>>;
283
+ declare const ClientOrServerImplementationSchema: z.ZodObject<{
284
+ name: z.ZodString;
285
+ version: z.ZodString;
286
+ title: z.ZodOptional<z.ZodString>;
287
+ }, z.core.$loose>;
288
+ type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;
270
289
  declare const BaseParamsSchema: z.ZodObject<{
271
290
  _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
272
291
  }, z.core.$loose>;
@@ -466,6 +485,11 @@ interface MCPClientConfig {
466
485
  }
467
486
  declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
468
487
  interface MCPClient {
488
+ /**
489
+ * Information about the connected MCP server, as reported during initialization.
490
+ * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
491
+ */
492
+ readonly serverInfo: Configuration;
469
493
  tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
470
494
  schemas?: TOOL_SCHEMAS;
471
495
  }): Promise<McpToolSet<TOOL_SCHEMAS>>;
@@ -506,4 +530,4 @@ interface MCPClient {
506
530
  close: () => Promise<void>;
507
531
  }
508
532
 
509
- export { type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, 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 };
533
+ export { type Configuration, type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, 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 };