@ai-sdk/mcp 2.0.0-beta.9 → 2.0.0-canary.38
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 +244 -8
- package/dist/index.d.ts +27 -1
- package/dist/index.js +295 -280
- package/dist/index.js.map +1 -1
- package/dist/mcp-stdio/index.js +149 -170
- package/dist/mcp-stdio/index.js.map +1 -1
- package/package.json +14 -15
- package/src/index.ts +1 -0
- package/src/tool/json-rpc-message.ts +7 -0
- package/src/tool/mcp-client.ts +70 -32
- package/src/tool/mcp-http-transport.ts +19 -8
- package/src/tool/mcp-sse-transport.ts +17 -10
- package/src/tool/mcp-stdio/create-child-process.ts +2 -2
- package/src/tool/mcp-stdio/mcp-stdio-transport.ts +17 -14
- package/src/tool/mcp-transport.ts +10 -2
- package/src/tool/mock-mcp-transport.ts +6 -8
- package/src/tool/oauth.ts +17 -12
- package/src/tool/types.ts +4 -2
- package/src/util/oauth-util.ts +13 -0
- package/dist/index.d.mts +0 -516
- package/dist/index.mjs +0 -2137
- package/dist/index.mjs.map +0 -1
- package/dist/mcp-stdio/index.d.mts +0 -89
- package/dist/mcp-stdio/index.mjs +0 -426
- package/dist/mcp-stdio/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,241 @@
|
|
|
1
1
|
# @ai-sdk/mcp
|
|
2
2
|
|
|
3
|
+
## 2.0.0-canary.38
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0c4c275: trigger initial canary release
|
|
8
|
+
- Updated dependencies [0c4c275]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-canary.31
|
|
10
|
+
- @ai-sdk/provider@4.0.0-canary.15
|
|
11
|
+
|
|
12
|
+
## 2.0.0-beta.37
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 08d2129: feat(mcp): propagate the server name through dynamic tool parts
|
|
17
|
+
- Updated dependencies [08d2129]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.0-beta.30
|
|
19
|
+
|
|
20
|
+
## 2.0.0-beta.36
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
25
|
+
- Updated dependencies [9bd6512]
|
|
26
|
+
- Updated dependencies [258c093]
|
|
27
|
+
- Updated dependencies [b6783da]
|
|
28
|
+
- @ai-sdk/provider-utils@5.0.0-beta.29
|
|
29
|
+
- @ai-sdk/provider@4.0.0-beta.14
|
|
30
|
+
|
|
31
|
+
## 2.0.0-beta.35
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
36
|
+
- Updated dependencies [9f0e36c]
|
|
37
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
38
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
39
|
+
|
|
40
|
+
## 2.0.0-beta.34
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 93afb28: feat(mcp): expose server instructions to be accessible through client
|
|
45
|
+
- 9b0bc8a: fix(mcp): prevent prototype pollution by using secureJsonParse
|
|
46
|
+
- Updated dependencies [785fe16]
|
|
47
|
+
- Updated dependencies [67df0a0]
|
|
48
|
+
- Updated dependencies [befb78c]
|
|
49
|
+
- Updated dependencies [0458559]
|
|
50
|
+
- Updated dependencies [5852c0a]
|
|
51
|
+
- Updated dependencies [fc92055]
|
|
52
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
53
|
+
|
|
54
|
+
## 2.0.0-beta.33
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [2e98477]
|
|
59
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
60
|
+
|
|
61
|
+
## 2.0.0-beta.32
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [eea8d98]
|
|
66
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
67
|
+
|
|
68
|
+
## 2.0.0-beta.31
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [f807e45]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
74
|
+
|
|
75
|
+
## 2.0.0-beta.30
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [350ea38]
|
|
80
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
81
|
+
|
|
82
|
+
## 2.0.0-beta.29
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [083947b]
|
|
87
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
88
|
+
|
|
89
|
+
## 2.0.0-beta.28
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- Updated dependencies [add1126]
|
|
94
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
95
|
+
|
|
96
|
+
## 2.0.0-beta.27
|
|
97
|
+
|
|
98
|
+
### Patch Changes
|
|
99
|
+
|
|
100
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
101
|
+
- Updated dependencies [b3976a2]
|
|
102
|
+
- Updated dependencies [ff5eba1]
|
|
103
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
104
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
105
|
+
|
|
106
|
+
## 2.0.0-beta.26
|
|
107
|
+
|
|
108
|
+
### Major Changes
|
|
109
|
+
|
|
110
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [ef992f8]
|
|
115
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
116
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
117
|
+
|
|
118
|
+
## 2.0.0-beta.25
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
123
|
+
- Updated dependencies [90e2d8a]
|
|
124
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
125
|
+
|
|
126
|
+
## 2.0.0-beta.24
|
|
127
|
+
|
|
128
|
+
### Patch Changes
|
|
129
|
+
|
|
130
|
+
- Updated dependencies [3ae1786]
|
|
131
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
132
|
+
|
|
133
|
+
## 2.0.0-beta.23
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- a98bf66: feat(mcp): surface 'serverInfo' exposed from the MCP server
|
|
138
|
+
|
|
139
|
+
## 2.0.0-beta.22
|
|
140
|
+
|
|
141
|
+
### Patch Changes
|
|
142
|
+
|
|
143
|
+
- Updated dependencies [176466a]
|
|
144
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
145
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
146
|
+
|
|
147
|
+
## 2.0.0-beta.21
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- Updated dependencies [e311194]
|
|
152
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
153
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
154
|
+
|
|
155
|
+
## 2.0.0-beta.20
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- Updated dependencies [34bd95d]
|
|
160
|
+
- Updated dependencies [008271d]
|
|
161
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
162
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
163
|
+
|
|
164
|
+
## 2.0.0-beta.19
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Updated dependencies [b0c2869]
|
|
169
|
+
- Updated dependencies [7e26e81]
|
|
170
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
171
|
+
|
|
172
|
+
## 2.0.0-beta.18
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- e3ea484: fix(mcp): bypass outputSchema validation when tool returns isError
|
|
177
|
+
|
|
178
|
+
## 2.0.0-beta.17
|
|
179
|
+
|
|
180
|
+
### Patch Changes
|
|
181
|
+
|
|
182
|
+
- a00d1d3: feat(mcp): allow custom fetch for HTTP and SSE transports
|
|
183
|
+
|
|
184
|
+
## 2.0.0-beta.16
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- Updated dependencies [46d1149]
|
|
189
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
190
|
+
|
|
191
|
+
## 2.0.0-beta.15
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- Updated dependencies [6fd51c0]
|
|
196
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
197
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
198
|
+
|
|
199
|
+
## 2.0.0-beta.14
|
|
200
|
+
|
|
201
|
+
### Patch Changes
|
|
202
|
+
|
|
203
|
+
- 1e89d62: fix(mcp): strip trailing slash from OAuth resource parameter
|
|
204
|
+
- Updated dependencies [c29a26f]
|
|
205
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
206
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
207
|
+
|
|
208
|
+
## 2.0.0-beta.13
|
|
209
|
+
|
|
210
|
+
### Patch Changes
|
|
211
|
+
|
|
212
|
+
- Updated dependencies [2e17091]
|
|
213
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
214
|
+
|
|
215
|
+
## 2.0.0-beta.12
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- Updated dependencies [986c6fd]
|
|
220
|
+
- Updated dependencies [493295c]
|
|
221
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
222
|
+
|
|
223
|
+
## 2.0.0-beta.11
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- Updated dependencies [1f509d4]
|
|
228
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
229
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
230
|
+
|
|
231
|
+
## 2.0.0-beta.10
|
|
232
|
+
|
|
233
|
+
### Patch Changes
|
|
234
|
+
|
|
235
|
+
- Updated dependencies [3887c70]
|
|
236
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
237
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
238
|
+
|
|
3
239
|
## 2.0.0-beta.9
|
|
4
240
|
|
|
5
241
|
### Patch Changes
|
|
@@ -262,15 +498,15 @@
|
|
|
262
498
|
This change replaces
|
|
263
499
|
|
|
264
500
|
```ts
|
|
265
|
-
import { experimental_createMCPClient } from
|
|
266
|
-
import { Experimental_StdioMCPTransport } from
|
|
501
|
+
import { experimental_createMCPClient } from "ai";
|
|
502
|
+
import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
|
|
267
503
|
```
|
|
268
504
|
|
|
269
505
|
with
|
|
270
506
|
|
|
271
507
|
```ts
|
|
272
|
-
import { experimental_createMCPClient } from
|
|
273
|
-
import { Experimental_StdioMCPTransport } from
|
|
508
|
+
import { experimental_createMCPClient } from "@ai-sdk/mcp";
|
|
509
|
+
import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
|
|
274
510
|
```
|
|
275
511
|
|
|
276
512
|
### Patch Changes
|
|
@@ -636,13 +872,13 @@
|
|
|
636
872
|
This change replaces
|
|
637
873
|
|
|
638
874
|
```ts
|
|
639
|
-
import { experimental_createMCPClient } from
|
|
640
|
-
import { Experimental_StdioMCPTransport } from
|
|
875
|
+
import { experimental_createMCPClient } from "ai";
|
|
876
|
+
import { Experimental_StdioMCPTransport } from "ai/mcp-stdio";
|
|
641
877
|
```
|
|
642
878
|
|
|
643
879
|
with
|
|
644
880
|
|
|
645
881
|
```ts
|
|
646
|
-
import { experimental_createMCPClient } from
|
|
647
|
-
import { Experimental_StdioMCPTransport } from
|
|
882
|
+
import { experimental_createMCPClient } from "@ai-sdk/mcp";
|
|
883
|
+
import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
|
|
648
884
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,12 @@ type MCPTransportConfig = {
|
|
|
250
250
|
* @default 'error'
|
|
251
251
|
*/
|
|
252
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;
|
|
253
259
|
};
|
|
254
260
|
|
|
255
261
|
/** MCP tool metadata - keys should follow MCP _meta key format specification */
|
|
@@ -274,6 +280,12 @@ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS e
|
|
|
274
280
|
inputSchema: FlexibleSchema<infer INPUT>;
|
|
275
281
|
} ? McpToolBase<INPUT, CallToolResult> : never;
|
|
276
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>;
|
|
277
289
|
declare const BaseParamsSchema: z.ZodObject<{
|
|
278
290
|
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
279
291
|
}, z.core.$loose>;
|
|
@@ -473,6 +485,20 @@ interface MCPClientConfig {
|
|
|
473
485
|
}
|
|
474
486
|
declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
475
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;
|
|
493
|
+
/**
|
|
494
|
+
* Optional instructions provided by the server during the initialize handshake.
|
|
495
|
+
*
|
|
496
|
+
* These describe how to use the server and its features, and can be used by clients
|
|
497
|
+
* to improve LLM interactions (e.g. by including them in the system prompt).
|
|
498
|
+
*
|
|
499
|
+
* @see https://modelcontextprotocol.io/specification/2025-11-25/schema#initializeresult
|
|
500
|
+
*/
|
|
501
|
+
readonly instructions?: string;
|
|
476
502
|
tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
|
|
477
503
|
schemas?: TOOL_SCHEMAS;
|
|
478
504
|
}): Promise<McpToolSet<TOOL_SCHEMAS>>;
|
|
@@ -513,4 +539,4 @@ interface MCPClient {
|
|
|
513
539
|
close: () => Promise<void>;
|
|
514
540
|
}
|
|
515
541
|
|
|
516
|
-
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 };
|
|
542
|
+
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 };
|