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

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,224 @@
1
1
  # @ai-sdk/mcp
2
2
 
3
+ ## 2.0.0-beta.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [f807e45]
8
+ - @ai-sdk/provider-utils@5.0.0-beta.24
9
+
10
+ ## 2.0.0-beta.30
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [350ea38]
15
+ - @ai-sdk/provider-utils@5.0.0-beta.23
16
+
17
+ ## 2.0.0-beta.29
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [083947b]
22
+ - @ai-sdk/provider-utils@5.0.0-beta.22
23
+
24
+ ## 2.0.0-beta.28
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [add1126]
29
+ - @ai-sdk/provider-utils@5.0.0-beta.21
30
+
31
+ ## 2.0.0-beta.27
32
+
33
+ ### Patch Changes
34
+
35
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
36
+ - Updated dependencies [b3976a2]
37
+ - Updated dependencies [ff5eba1]
38
+ - @ai-sdk/provider-utils@5.0.0-beta.20
39
+ - @ai-sdk/provider@4.0.0-beta.12
40
+
41
+ ## 2.0.0-beta.26
42
+
43
+ ### Major Changes
44
+
45
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [ef992f8]
50
+ - @ai-sdk/provider@4.0.0-beta.11
51
+ - @ai-sdk/provider-utils@5.0.0-beta.19
52
+
53
+ ## 2.0.0-beta.25
54
+
55
+ ### Patch Changes
56
+
57
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
58
+ - Updated dependencies [90e2d8a]
59
+ - @ai-sdk/provider-utils@5.0.0-beta.18
60
+
61
+ ## 2.0.0-beta.24
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [3ae1786]
66
+ - @ai-sdk/provider-utils@5.0.0-beta.17
67
+
68
+ ## 2.0.0-beta.23
69
+
70
+ ### Patch Changes
71
+
72
+ - a98bf66: feat(mcp): surface 'serverInfo' exposed from the MCP server
73
+
74
+ ## 2.0.0-beta.22
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [176466a]
79
+ - @ai-sdk/provider@4.0.0-beta.10
80
+ - @ai-sdk/provider-utils@5.0.0-beta.16
81
+
82
+ ## 2.0.0-beta.21
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [e311194]
87
+ - @ai-sdk/provider@4.0.0-beta.9
88
+ - @ai-sdk/provider-utils@5.0.0-beta.15
89
+
90
+ ## 2.0.0-beta.20
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [34bd95d]
95
+ - Updated dependencies [008271d]
96
+ - @ai-sdk/provider@4.0.0-beta.8
97
+ - @ai-sdk/provider-utils@5.0.0-beta.14
98
+
99
+ ## 2.0.0-beta.19
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [b0c2869]
104
+ - Updated dependencies [7e26e81]
105
+ - @ai-sdk/provider-utils@5.0.0-beta.13
106
+
107
+ ## 2.0.0-beta.18
108
+
109
+ ### Patch Changes
110
+
111
+ - e3ea484: fix(mcp): bypass outputSchema validation when tool returns isError
112
+
113
+ ## 2.0.0-beta.17
114
+
115
+ ### Patch Changes
116
+
117
+ - a00d1d3: feat(mcp): allow custom fetch for HTTP and SSE transports
118
+
119
+ ## 2.0.0-beta.16
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [46d1149]
124
+ - @ai-sdk/provider-utils@5.0.0-beta.12
125
+
126
+ ## 2.0.0-beta.15
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [6fd51c0]
131
+ - @ai-sdk/provider-utils@5.0.0-beta.11
132
+ - @ai-sdk/provider@4.0.0-beta.7
133
+
134
+ ## 2.0.0-beta.14
135
+
136
+ ### Patch Changes
137
+
138
+ - 1e89d62: fix(mcp): strip trailing slash from OAuth resource parameter
139
+ - Updated dependencies [c29a26f]
140
+ - @ai-sdk/provider-utils@5.0.0-beta.10
141
+ - @ai-sdk/provider@4.0.0-beta.6
142
+
143
+ ## 2.0.0-beta.13
144
+
145
+ ### Patch Changes
146
+
147
+ - Updated dependencies [2e17091]
148
+ - @ai-sdk/provider-utils@5.0.0-beta.9
149
+
150
+ ## 2.0.0-beta.12
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [986c6fd]
155
+ - Updated dependencies [493295c]
156
+ - @ai-sdk/provider-utils@5.0.0-beta.8
157
+
158
+ ## 2.0.0-beta.11
159
+
160
+ ### Patch Changes
161
+
162
+ - Updated dependencies [1f509d4]
163
+ - @ai-sdk/provider-utils@5.0.0-beta.7
164
+ - @ai-sdk/provider@4.0.0-beta.5
165
+
166
+ ## 2.0.0-beta.10
167
+
168
+ ### Patch Changes
169
+
170
+ - Updated dependencies [3887c70]
171
+ - @ai-sdk/provider-utils@5.0.0-beta.6
172
+ - @ai-sdk/provider@4.0.0-beta.4
173
+
174
+ ## 2.0.0-beta.9
175
+
176
+ ### Patch Changes
177
+
178
+ - Updated dependencies [776b617]
179
+ - @ai-sdk/provider-utils@5.0.0-beta.5
180
+ - @ai-sdk/provider@4.0.0-beta.3
181
+
182
+ ## 2.0.0-beta.8
183
+
184
+ ### Patch Changes
185
+
186
+ - Updated dependencies [61753c3]
187
+ - @ai-sdk/provider-utils@5.0.0-beta.4
188
+
189
+ ## 2.0.0-beta.7
190
+
191
+ ### Major Changes
192
+
193
+ - 23fa161: fix(mcp): setting redirect: error for MCP transport
194
+
195
+ ## 2.0.0-beta.6
196
+
197
+ ### Patch Changes
198
+
199
+ - 58c9eb1: feat(mcp): add `redirect` option to `MCPTransportConfig` for controlling HTTP redirect behavior
200
+
201
+ ## 2.0.0-beta.5
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [f7d4f01]
206
+ - @ai-sdk/provider-utils@5.0.0-beta.3
207
+ - @ai-sdk/provider@4.0.0-beta.2
208
+
209
+ ## 2.0.0-beta.4
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [5c2a5a2]
214
+ - @ai-sdk/provider@4.0.0-beta.1
215
+ - @ai-sdk/provider-utils@5.0.0-beta.2
216
+
3
217
  ## 2.0.0-beta.3
4
218
 
5
219
  ### Patch Changes
6
220
 
7
- - b9b3899: changeset for #13384
221
+ - b9b3899: fix(mcp): validate state param in oauth flow
8
222
 
9
223
  ## 2.0.0-beta.2
10
224
 
@@ -219,15 +433,15 @@
219
433
  This change replaces
220
434
 
221
435
  ```ts
222
- import { experimental_createMCPClient } from 'ai';
223
- import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
436
+ import { experimental_createMCPClient } from "ai";
437
+ import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
224
438
  ```
225
439
 
226
440
  with
227
441
 
228
442
  ```ts
229
- import { experimental_createMCPClient } from '@ai-sdk/mcp';
230
- import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
443
+ import { experimental_createMCPClient } from "@ai-sdk/mcp";
444
+ import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
231
445
  ```
232
446
 
233
447
  ### Patch Changes
@@ -593,13 +807,13 @@
593
807
  This change replaces
594
808
 
595
809
  ```ts
596
- import { experimental_createMCPClient } from 'ai';
597
- import { Experimental_StdioMCPTransport } from 'ai/mcp-stdio';
810
+ import { experimental_createMCPClient } from "ai";
811
+ import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
598
812
  ```
599
813
 
600
814
  with
601
815
 
602
816
  ```ts
603
- import { experimental_createMCPClient } from '@ai-sdk/mcp';
604
- import { Experimental_StdioMCPTransport } from '@ai-sdk/mcp/mcp-stdio';
817
+ import { experimental_createMCPClient } from "@ai-sdk/mcp";
818
+ import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
605
819
  ```
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 };