@ai-sdk/mcp 2.0.0-beta.25 → 2.0.0-beta.26
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 +12 -0
- package/dist/index.js +233 -260
- package/dist/index.js.map +1 -1
- package/dist/mcp-stdio/index.js +134 -161
- package/dist/mcp-stdio/index.js.map +1 -1
- package/package.json +9 -10
- package/dist/index.d.mts +0 -533
- package/dist/index.mjs +0 -2164
- package/dist/index.mjs.map +0 -1
- package/dist/mcp-stdio/index.d.mts +0 -89
- package/dist/mcp-stdio/index.mjs +0 -427
- package/dist/mcp-stdio/index.mjs.map +0 -1
package/dist/index.d.mts
DELETED
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { FetchFunction, FlexibleSchema, Tool } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { JSONObject } from '@ai-sdk/provider';
|
|
4
|
-
|
|
5
|
-
declare const JSONRPCRequestSchema: z.ZodObject<{
|
|
6
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
7
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
8
|
-
method: z.ZodString;
|
|
9
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
10
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
11
|
-
}, z.core.$loose>>;
|
|
12
|
-
}, z.core.$strict>;
|
|
13
|
-
type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
|
|
14
|
-
declare const JSONRPCResponseSchema: z.ZodObject<{
|
|
15
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
16
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
17
|
-
result: z.ZodObject<{
|
|
18
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
19
|
-
}, z.core.$loose>;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
|
|
22
|
-
declare const JSONRPCErrorSchema: z.ZodObject<{
|
|
23
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
24
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
25
|
-
error: z.ZodObject<{
|
|
26
|
-
code: z.ZodNumber;
|
|
27
|
-
message: z.ZodString;
|
|
28
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
29
|
-
}, z.core.$strip>;
|
|
30
|
-
}, z.core.$strict>;
|
|
31
|
-
type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
|
|
32
|
-
declare const JSONRPCNotificationSchema: z.ZodObject<{
|
|
33
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
34
|
-
method: z.ZodString;
|
|
35
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
36
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
37
|
-
}, z.core.$loose>>;
|
|
38
|
-
}, z.core.$strict>;
|
|
39
|
-
type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
|
|
40
|
-
declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
41
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
42
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
43
|
-
method: z.ZodString;
|
|
44
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
45
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
46
|
-
}, z.core.$loose>>;
|
|
47
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
48
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
49
|
-
method: z.ZodString;
|
|
50
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
51
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
52
|
-
}, z.core.$loose>>;
|
|
53
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
54
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
55
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
56
|
-
result: z.ZodObject<{
|
|
57
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
58
|
-
}, z.core.$loose>;
|
|
59
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
-
jsonrpc: z.ZodLiteral<"2.0">;
|
|
61
|
-
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
62
|
-
error: z.ZodObject<{
|
|
63
|
-
code: z.ZodNumber;
|
|
64
|
-
message: z.ZodString;
|
|
65
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
66
|
-
}, z.core.$strip>;
|
|
67
|
-
}, z.core.$strict>]>;
|
|
68
|
-
type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* OAuth 2.1 token response
|
|
72
|
-
*/
|
|
73
|
-
declare const OAuthTokensSchema: z.ZodObject<{
|
|
74
|
-
access_token: z.ZodString;
|
|
75
|
-
id_token: z.ZodOptional<z.ZodString>;
|
|
76
|
-
token_type: z.ZodString;
|
|
77
|
-
expires_in: z.ZodOptional<z.ZodNumber>;
|
|
78
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
79
|
-
refresh_token: z.ZodOptional<z.ZodString>;
|
|
80
|
-
}, z.core.$strip>;
|
|
81
|
-
declare const OAuthMetadataSchema: z.ZodObject<{
|
|
82
|
-
issuer: z.ZodString;
|
|
83
|
-
authorization_endpoint: z.ZodString;
|
|
84
|
-
token_endpoint: z.ZodString;
|
|
85
|
-
registration_endpoint: z.ZodOptional<z.ZodString>;
|
|
86
|
-
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
-
response_types_supported: z.ZodArray<z.ZodString>;
|
|
88
|
-
grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
-
code_challenge_methods_supported: z.ZodArray<z.ZodString>;
|
|
90
|
-
token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
-
token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
-
}, z.core.$loose>;
|
|
93
|
-
/**
|
|
94
|
-
* OpenID Connect Discovery metadata that may include OAuth 2.0 fields
|
|
95
|
-
* This schema represents the real-world scenario where OIDC providers
|
|
96
|
-
* return a mix of OpenID Connect and OAuth 2.0 metadata fields
|
|
97
|
-
*/
|
|
98
|
-
declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
|
|
99
|
-
issuer: z.ZodString;
|
|
100
|
-
authorization_endpoint: z.ZodString;
|
|
101
|
-
token_endpoint: z.ZodString;
|
|
102
|
-
userinfo_endpoint: z.ZodOptional<z.ZodString>;
|
|
103
|
-
jwks_uri: z.ZodString;
|
|
104
|
-
registration_endpoint: z.ZodOptional<z.ZodString>;
|
|
105
|
-
scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
-
response_types_supported: z.ZodArray<z.ZodString>;
|
|
107
|
-
grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
108
|
-
subject_types_supported: z.ZodArray<z.ZodString>;
|
|
109
|
-
id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
|
|
110
|
-
claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
-
token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
|
-
code_challenge_methods_supported: z.ZodArray<z.ZodString>;
|
|
113
|
-
}, z.core.$loose>;
|
|
114
|
-
declare const OAuthClientInformationSchema: z.ZodObject<{
|
|
115
|
-
client_id: z.ZodString;
|
|
116
|
-
client_secret: z.ZodOptional<z.ZodString>;
|
|
117
|
-
client_id_issued_at: z.ZodOptional<z.ZodNumber>;
|
|
118
|
-
client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
|
|
119
|
-
}, z.core.$strip>;
|
|
120
|
-
declare const OAuthClientMetadataSchema: z.ZodObject<{
|
|
121
|
-
redirect_uris: z.ZodArray<z.ZodString>;
|
|
122
|
-
token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
|
|
123
|
-
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
124
|
-
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
125
|
-
client_name: z.ZodOptional<z.ZodString>;
|
|
126
|
-
client_uri: z.ZodOptional<z.ZodString>;
|
|
127
|
-
logo_uri: z.ZodOptional<z.ZodString>;
|
|
128
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
129
|
-
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
130
|
-
tos_uri: z.ZodOptional<z.ZodString>;
|
|
131
|
-
policy_uri: z.ZodOptional<z.ZodString>;
|
|
132
|
-
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
133
|
-
jwks: z.ZodOptional<z.ZodAny>;
|
|
134
|
-
software_id: z.ZodOptional<z.ZodString>;
|
|
135
|
-
software_version: z.ZodOptional<z.ZodString>;
|
|
136
|
-
software_statement: z.ZodOptional<z.ZodString>;
|
|
137
|
-
}, z.core.$strip>;
|
|
138
|
-
type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
|
|
139
|
-
type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
|
|
140
|
-
type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
|
|
141
|
-
type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
|
|
142
|
-
type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
|
|
143
|
-
type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
|
|
144
|
-
|
|
145
|
-
type AuthResult = 'AUTHORIZED' | 'REDIRECT';
|
|
146
|
-
interface OAuthClientProvider {
|
|
147
|
-
/**
|
|
148
|
-
* Returns current access token if present; undefined otherwise.
|
|
149
|
-
*/
|
|
150
|
-
tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
|
|
151
|
-
saveTokens(tokens: OAuthTokens): void | Promise<void>;
|
|
152
|
-
redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
|
|
153
|
-
saveCodeVerifier(codeVerifier: string): void | Promise<void>;
|
|
154
|
-
codeVerifier(): string | Promise<string>;
|
|
155
|
-
/**
|
|
156
|
-
* Adds custom client authentication to OAuth token requests.
|
|
157
|
-
*
|
|
158
|
-
* This optional method allows implementations to customize how client credentials
|
|
159
|
-
* are included in token exchange and refresh requests. When provided, this method
|
|
160
|
-
* is called instead of the default authentication logic, giving full control over
|
|
161
|
-
* the authentication mechanism.
|
|
162
|
-
*
|
|
163
|
-
* Common use cases include:
|
|
164
|
-
* - Supporting authentication methods beyond the standard OAuth 2.0 methods
|
|
165
|
-
* - Adding custom headers for proprietary authentication schemes
|
|
166
|
-
* - Implementing client assertion-based authentication (e.g., JWT bearer tokens)
|
|
167
|
-
*
|
|
168
|
-
* @param headers - The request headers (can be modified to add authentication)
|
|
169
|
-
* @param params - The request body parameters (can be modified to add credentials)
|
|
170
|
-
* @param url - The token endpoint URL being called
|
|
171
|
-
* @param metadata - Optional OAuth metadata for the server, which may include supported authentication methods
|
|
172
|
-
*/
|
|
173
|
-
addClientAuthentication?(headers: Headers, params: URLSearchParams, url: string | URL, metadata?: AuthorizationServerMetadata): void | Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* If implemented, provides a way for the client to invalidate (e.g. delete) the specified
|
|
176
|
-
* credentials, in the case where the server has indicated that they are no longer valid.
|
|
177
|
-
* This avoids requiring the user to intervene manually.
|
|
178
|
-
*/
|
|
179
|
-
invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier'): void | Promise<void>;
|
|
180
|
-
get redirectUrl(): string | URL;
|
|
181
|
-
get clientMetadata(): OAuthClientMetadata;
|
|
182
|
-
clientInformation(): OAuthClientInformation | undefined | Promise<OAuthClientInformation | undefined>;
|
|
183
|
-
saveClientInformation?(clientInformation: OAuthClientInformation): void | Promise<void>;
|
|
184
|
-
state?(): string | Promise<string>;
|
|
185
|
-
saveState?(state: string): void | Promise<void>;
|
|
186
|
-
storedState?(): string | undefined | Promise<string | undefined>;
|
|
187
|
-
validateResourceURL?(serverUrl: string | URL, resource?: string): Promise<URL | undefined>;
|
|
188
|
-
}
|
|
189
|
-
declare class UnauthorizedError extends Error {
|
|
190
|
-
constructor(message?: string);
|
|
191
|
-
}
|
|
192
|
-
declare function auth(provider: OAuthClientProvider, options: {
|
|
193
|
-
serverUrl: string | URL;
|
|
194
|
-
authorizationCode?: string;
|
|
195
|
-
callbackState?: string;
|
|
196
|
-
scope?: string;
|
|
197
|
-
resourceMetadataUrl?: URL;
|
|
198
|
-
fetchFn?: FetchFunction;
|
|
199
|
-
}): Promise<AuthResult>;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Transport interface for MCP (Model Context Protocol) communication.
|
|
203
|
-
* Maps to the `Transport` interface in the MCP spec.
|
|
204
|
-
*/
|
|
205
|
-
interface MCPTransport {
|
|
206
|
-
/**
|
|
207
|
-
* Initialize and start the transport
|
|
208
|
-
*/
|
|
209
|
-
start(): Promise<void>;
|
|
210
|
-
/**
|
|
211
|
-
* Send a JSON-RPC message through the transport
|
|
212
|
-
* @param message The JSON-RPC message to send
|
|
213
|
-
*/
|
|
214
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* Clean up and close the transport
|
|
217
|
-
*/
|
|
218
|
-
close(): Promise<void>;
|
|
219
|
-
/**
|
|
220
|
-
* Event handler for transport closure
|
|
221
|
-
*/
|
|
222
|
-
onclose?: () => void;
|
|
223
|
-
/**
|
|
224
|
-
* Event handler for transport errors
|
|
225
|
-
*/
|
|
226
|
-
onerror?: (error: Error) => void;
|
|
227
|
-
/**
|
|
228
|
-
* Event handler for received messages
|
|
229
|
-
*/
|
|
230
|
-
onmessage?: (message: JSONRPCMessage) => void;
|
|
231
|
-
}
|
|
232
|
-
type MCPTransportConfig = {
|
|
233
|
-
type: 'sse' | 'http';
|
|
234
|
-
/**
|
|
235
|
-
* The URL of the MCP server.
|
|
236
|
-
*/
|
|
237
|
-
url: string;
|
|
238
|
-
/**
|
|
239
|
-
* Additional HTTP headers to be sent with requests.
|
|
240
|
-
*/
|
|
241
|
-
headers?: Record<string, string>;
|
|
242
|
-
/**
|
|
243
|
-
* An optional OAuth client provider to use for authentication for MCP servers.
|
|
244
|
-
*/
|
|
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;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
/** MCP tool metadata - keys should follow MCP _meta key format specification */
|
|
262
|
-
declare const ToolMetaSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
263
|
-
type ToolMeta = z.infer<typeof ToolMetaSchema>;
|
|
264
|
-
type ToolSchemas = Record<string, {
|
|
265
|
-
inputSchema: FlexibleSchema<JSONObject | unknown>;
|
|
266
|
-
outputSchema?: FlexibleSchema<JSONObject | unknown>;
|
|
267
|
-
}> | 'automatic' | undefined;
|
|
268
|
-
/** Base MCP tool type with execute and _meta */
|
|
269
|
-
type McpToolBase<INPUT = unknown, OUTPUT = CallToolResult> = Tool<INPUT, OUTPUT> & Required<Pick<Tool<INPUT, OUTPUT>, 'execute'>> & {
|
|
270
|
-
_meta?: ToolMeta;
|
|
271
|
-
};
|
|
272
|
-
type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS extends Record<string, {
|
|
273
|
-
inputSchema: FlexibleSchema<any>;
|
|
274
|
-
outputSchema?: FlexibleSchema<any>;
|
|
275
|
-
}> ? {
|
|
276
|
-
[K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
|
|
277
|
-
inputSchema: FlexibleSchema<infer INPUT>;
|
|
278
|
-
outputSchema: FlexibleSchema<infer OUTPUT>;
|
|
279
|
-
} ? McpToolBase<INPUT, OUTPUT> : TOOL_SCHEMAS[K] extends {
|
|
280
|
-
inputSchema: FlexibleSchema<infer INPUT>;
|
|
281
|
-
} ? McpToolBase<INPUT, CallToolResult> : never;
|
|
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>;
|
|
289
|
-
declare const BaseParamsSchema: z.ZodObject<{
|
|
290
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
291
|
-
}, z.core.$loose>;
|
|
292
|
-
type BaseParams = z.infer<typeof BaseParamsSchema>;
|
|
293
|
-
declare const RequestSchema: z.ZodObject<{
|
|
294
|
-
method: z.ZodString;
|
|
295
|
-
params: z.ZodOptional<z.ZodObject<{
|
|
296
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
297
|
-
}, z.core.$loose>>;
|
|
298
|
-
}, z.core.$strip>;
|
|
299
|
-
type Request = z.infer<typeof RequestSchema>;
|
|
300
|
-
type RequestOptions = {
|
|
301
|
-
signal?: AbortSignal;
|
|
302
|
-
timeout?: number;
|
|
303
|
-
maxTotalTimeout?: number;
|
|
304
|
-
};
|
|
305
|
-
declare const ClientCapabilitiesSchema: z.ZodObject<{
|
|
306
|
-
elicitation: z.ZodOptional<z.ZodObject<{
|
|
307
|
-
applyDefaults: z.ZodOptional<z.ZodBoolean>;
|
|
308
|
-
}, z.core.$loose>>;
|
|
309
|
-
}, z.core.$loose>;
|
|
310
|
-
type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
|
|
311
|
-
type PaginatedRequest = Request & {
|
|
312
|
-
params?: BaseParams & {
|
|
313
|
-
cursor?: string;
|
|
314
|
-
};
|
|
315
|
-
};
|
|
316
|
-
declare const ListToolsResultSchema: z.ZodObject<{
|
|
317
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
318
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
319
|
-
tools: z.ZodArray<z.ZodObject<{
|
|
320
|
-
name: z.ZodString;
|
|
321
|
-
title: z.ZodOptional<z.ZodString>;
|
|
322
|
-
description: z.ZodOptional<z.ZodString>;
|
|
323
|
-
inputSchema: z.ZodObject<{
|
|
324
|
-
type: z.ZodLiteral<"object">;
|
|
325
|
-
properties: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
326
|
-
}, z.core.$loose>;
|
|
327
|
-
outputSchema: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
328
|
-
annotations: z.ZodOptional<z.ZodObject<{
|
|
329
|
-
title: z.ZodOptional<z.ZodString>;
|
|
330
|
-
}, z.core.$loose>>;
|
|
331
|
-
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
332
|
-
}, z.core.$loose>>;
|
|
333
|
-
}, z.core.$loose>;
|
|
334
|
-
type ListToolsResult = z.infer<typeof ListToolsResultSchema>;
|
|
335
|
-
declare const ListResourcesResultSchema: z.ZodObject<{
|
|
336
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
337
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
338
|
-
resources: z.ZodArray<z.ZodObject<{
|
|
339
|
-
uri: z.ZodString;
|
|
340
|
-
name: z.ZodString;
|
|
341
|
-
title: z.ZodOptional<z.ZodString>;
|
|
342
|
-
description: z.ZodOptional<z.ZodString>;
|
|
343
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
344
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
345
|
-
}, z.core.$loose>>;
|
|
346
|
-
}, z.core.$loose>;
|
|
347
|
-
type ListResourcesResult = z.infer<typeof ListResourcesResultSchema>;
|
|
348
|
-
declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<{
|
|
349
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
350
|
-
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
351
|
-
type: z.ZodLiteral<"text">;
|
|
352
|
-
text: z.ZodString;
|
|
353
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
354
|
-
type: z.ZodLiteral<"image">;
|
|
355
|
-
data: z.ZodBase64;
|
|
356
|
-
mimeType: z.ZodString;
|
|
357
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
358
|
-
type: z.ZodLiteral<"resource">;
|
|
359
|
-
resource: z.ZodUnion<readonly [z.ZodObject<{
|
|
360
|
-
uri: z.ZodString;
|
|
361
|
-
name: z.ZodOptional<z.ZodString>;
|
|
362
|
-
title: z.ZodOptional<z.ZodString>;
|
|
363
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
364
|
-
text: z.ZodString;
|
|
365
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
366
|
-
uri: z.ZodString;
|
|
367
|
-
name: z.ZodOptional<z.ZodString>;
|
|
368
|
-
title: z.ZodOptional<z.ZodString>;
|
|
369
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
370
|
-
blob: z.ZodBase64;
|
|
371
|
-
}, z.core.$loose>]>;
|
|
372
|
-
}, z.core.$loose>]>>;
|
|
373
|
-
structuredContent: z.ZodOptional<z.ZodUnknown>;
|
|
374
|
-
isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
375
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
376
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
377
|
-
toolResult: z.ZodUnknown;
|
|
378
|
-
}, z.core.$loose>]>;
|
|
379
|
-
type CallToolResult = z.infer<typeof CallToolResultSchema>;
|
|
380
|
-
declare const ListResourceTemplatesResultSchema: z.ZodObject<{
|
|
381
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
382
|
-
resourceTemplates: z.ZodArray<z.ZodObject<{
|
|
383
|
-
uriTemplate: z.ZodString;
|
|
384
|
-
name: z.ZodString;
|
|
385
|
-
title: z.ZodOptional<z.ZodString>;
|
|
386
|
-
description: z.ZodOptional<z.ZodString>;
|
|
387
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
388
|
-
}, z.core.$loose>>;
|
|
389
|
-
}, z.core.$loose>;
|
|
390
|
-
type ListResourceTemplatesResult = z.infer<typeof ListResourceTemplatesResultSchema>;
|
|
391
|
-
declare const ReadResourceResultSchema: z.ZodObject<{
|
|
392
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
393
|
-
contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
394
|
-
uri: z.ZodString;
|
|
395
|
-
name: z.ZodOptional<z.ZodString>;
|
|
396
|
-
title: z.ZodOptional<z.ZodString>;
|
|
397
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
398
|
-
text: z.ZodString;
|
|
399
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
400
|
-
uri: z.ZodString;
|
|
401
|
-
name: z.ZodOptional<z.ZodString>;
|
|
402
|
-
title: z.ZodOptional<z.ZodString>;
|
|
403
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
404
|
-
blob: z.ZodBase64;
|
|
405
|
-
}, z.core.$loose>]>>;
|
|
406
|
-
}, z.core.$loose>;
|
|
407
|
-
type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
|
|
408
|
-
declare const ListPromptsResultSchema: z.ZodObject<{
|
|
409
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
410
|
-
nextCursor: z.ZodOptional<z.ZodString>;
|
|
411
|
-
prompts: z.ZodArray<z.ZodObject<{
|
|
412
|
-
name: z.ZodString;
|
|
413
|
-
title: z.ZodOptional<z.ZodString>;
|
|
414
|
-
description: z.ZodOptional<z.ZodString>;
|
|
415
|
-
arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
416
|
-
name: z.ZodString;
|
|
417
|
-
description: z.ZodOptional<z.ZodString>;
|
|
418
|
-
required: z.ZodOptional<z.ZodBoolean>;
|
|
419
|
-
}, z.core.$loose>>>;
|
|
420
|
-
}, z.core.$loose>>;
|
|
421
|
-
}, z.core.$loose>;
|
|
422
|
-
type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
|
|
423
|
-
declare const GetPromptResultSchema: z.ZodObject<{
|
|
424
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
425
|
-
description: z.ZodOptional<z.ZodString>;
|
|
426
|
-
messages: z.ZodArray<z.ZodObject<{
|
|
427
|
-
role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
|
|
428
|
-
content: z.ZodUnion<readonly [z.ZodObject<{
|
|
429
|
-
type: z.ZodLiteral<"text">;
|
|
430
|
-
text: z.ZodString;
|
|
431
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
432
|
-
type: z.ZodLiteral<"image">;
|
|
433
|
-
data: z.ZodBase64;
|
|
434
|
-
mimeType: z.ZodString;
|
|
435
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
436
|
-
type: z.ZodLiteral<"resource">;
|
|
437
|
-
resource: z.ZodUnion<readonly [z.ZodObject<{
|
|
438
|
-
uri: z.ZodString;
|
|
439
|
-
name: z.ZodOptional<z.ZodString>;
|
|
440
|
-
title: z.ZodOptional<z.ZodString>;
|
|
441
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
442
|
-
text: z.ZodString;
|
|
443
|
-
}, z.core.$loose>, z.ZodObject<{
|
|
444
|
-
uri: z.ZodString;
|
|
445
|
-
name: z.ZodOptional<z.ZodString>;
|
|
446
|
-
title: z.ZodOptional<z.ZodString>;
|
|
447
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
448
|
-
blob: z.ZodBase64;
|
|
449
|
-
}, z.core.$loose>]>;
|
|
450
|
-
}, z.core.$loose>]>;
|
|
451
|
-
}, z.core.$loose>>;
|
|
452
|
-
}, z.core.$loose>;
|
|
453
|
-
type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
|
|
454
|
-
declare const ElicitationRequestSchema: z.ZodObject<{
|
|
455
|
-
method: z.ZodLiteral<"elicitation/create">;
|
|
456
|
-
params: z.ZodObject<{
|
|
457
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
458
|
-
message: z.ZodString;
|
|
459
|
-
requestedSchema: z.ZodUnknown;
|
|
460
|
-
}, z.core.$loose>;
|
|
461
|
-
}, z.core.$strip>;
|
|
462
|
-
type ElicitationRequest = z.infer<typeof ElicitationRequestSchema>;
|
|
463
|
-
declare const ElicitResultSchema: z.ZodObject<{
|
|
464
|
-
_meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
465
|
-
action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
|
|
466
|
-
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
467
|
-
}, z.core.$loose>;
|
|
468
|
-
type ElicitResult = z.infer<typeof ElicitResultSchema>;
|
|
469
|
-
|
|
470
|
-
interface MCPClientConfig {
|
|
471
|
-
/** Transport configuration for connecting to the MCP server */
|
|
472
|
-
transport: MCPTransportConfig | MCPTransport;
|
|
473
|
-
/** Optional callback for uncaught errors */
|
|
474
|
-
onUncaughtError?: (error: unknown) => void;
|
|
475
|
-
/** Optional client name, defaults to 'ai-sdk-mcp-client' */
|
|
476
|
-
name?: string;
|
|
477
|
-
/** Optional client version, defaults to '1.0.0' */
|
|
478
|
-
version?: string;
|
|
479
|
-
/**
|
|
480
|
-
* Optional client capabilities to advertise during initialization
|
|
481
|
-
*
|
|
482
|
-
* NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
|
|
483
|
-
*/
|
|
484
|
-
capabilities?: ClientCapabilities;
|
|
485
|
-
}
|
|
486
|
-
declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
|
|
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
|
-
tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
|
|
494
|
-
schemas?: TOOL_SCHEMAS;
|
|
495
|
-
}): Promise<McpToolSet<TOOL_SCHEMAS>>;
|
|
496
|
-
/**
|
|
497
|
-
* Lists available tools from the MCP server.
|
|
498
|
-
*/
|
|
499
|
-
listTools(options?: {
|
|
500
|
-
params?: PaginatedRequest['params'];
|
|
501
|
-
options?: RequestOptions;
|
|
502
|
-
}): Promise<ListToolsResult>;
|
|
503
|
-
/**
|
|
504
|
-
* Creates AI SDK tools from tool definitions.
|
|
505
|
-
*/
|
|
506
|
-
toolsFromDefinitions<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(definitions: ListToolsResult, options?: {
|
|
507
|
-
schemas?: TOOL_SCHEMAS;
|
|
508
|
-
}): McpToolSet<TOOL_SCHEMAS>;
|
|
509
|
-
listResources(options?: {
|
|
510
|
-
params?: PaginatedRequest['params'];
|
|
511
|
-
options?: RequestOptions;
|
|
512
|
-
}): Promise<ListResourcesResult>;
|
|
513
|
-
readResource(args: {
|
|
514
|
-
uri: string;
|
|
515
|
-
options?: RequestOptions;
|
|
516
|
-
}): Promise<ReadResourceResult>;
|
|
517
|
-
listResourceTemplates(options?: {
|
|
518
|
-
options?: RequestOptions;
|
|
519
|
-
}): Promise<ListResourceTemplatesResult>;
|
|
520
|
-
experimental_listPrompts(options?: {
|
|
521
|
-
params?: PaginatedRequest['params'];
|
|
522
|
-
options?: RequestOptions;
|
|
523
|
-
}): Promise<ListPromptsResult>;
|
|
524
|
-
experimental_getPrompt(args: {
|
|
525
|
-
name: string;
|
|
526
|
-
arguments?: Record<string, unknown>;
|
|
527
|
-
options?: RequestOptions;
|
|
528
|
-
}): Promise<GetPromptResult>;
|
|
529
|
-
onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
|
|
530
|
-
close: () => Promise<void>;
|
|
531
|
-
}
|
|
532
|
-
|
|
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 };
|