agents 0.3.10 → 0.4.1
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/README.md +2 -2
- package/dist/{index-N6791tVt.d.ts → agent-DY6QmSI_.d.ts} +3 -25
- package/dist/ai-types.js +1 -1
- package/dist/client-connection-CGMuV62J.js +472 -0
- package/dist/client-connection-CGMuV62J.js.map +1 -0
- package/dist/client-storage-Cvy5r9FG.d.ts +355 -0
- package/dist/client.d.ts +11 -7
- package/dist/client.js +6 -2
- package/dist/client.js.map +1 -1
- package/dist/email.d.ts +146 -16
- package/dist/email.js +222 -2
- package/dist/email.js.map +1 -0
- package/dist/index.d.ts +142 -41
- package/dist/index.js +2326 -6
- package/dist/index.js.map +1 -0
- package/dist/internal_context.d.ts +33 -6
- package/dist/internal_context.js +11 -2
- package/dist/internal_context.js.map +1 -0
- package/dist/mcp/client.d.ts +516 -2
- package/dist/mcp/client.js +662 -3
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/do-oauth-client-provider.d.ts +61 -2
- package/dist/mcp/do-oauth-client-provider.js +154 -2
- package/dist/mcp/do-oauth-client-provider.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -5
- package/dist/mcp/index.js +8 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +34 -14
- package/dist/mcp/x402.js +128 -66
- package/dist/mcp/x402.js.map +1 -1
- package/dist/{mcp-BwPscEiF.d.ts → mcp-Dw5vDrY8.d.ts} +1 -1
- package/dist/observability/index.d.ts +23 -2
- package/dist/observability/index.js +25 -6
- package/dist/observability/index.js.map +1 -0
- package/dist/react.d.ts +10 -10
- package/dist/react.js +6 -2
- package/dist/react.js.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.js +16 -2
- package/dist/types.js.map +1 -0
- package/dist/utils.js +15 -2
- package/dist/utils.js.map +1 -0
- package/dist/workflow-types.d.ts +235 -23
- package/dist/workflows.d.ts +22 -24
- package/dist/workflows.js +2 -5
- package/dist/workflows.js.map +1 -1
- package/package.json +24 -28
- package/dist/client-CtC9E06G.js +0 -1122
- package/dist/client-CtC9E06G.js.map +0 -1
- package/dist/client-DV1CZKqa.d.ts +0 -969
- package/dist/do-oauth-client-provider-BqnOQzjy.d.ts +0 -70
- package/dist/do-oauth-client-provider-DDg8QrEA.js +0 -155
- package/dist/do-oauth-client-provider-DDg8QrEA.js.map +0 -1
- package/dist/email-8ljcpvwV.d.ts +0 -157
- package/dist/email-XHsSYsTO.js +0 -223
- package/dist/email-XHsSYsTO.js.map +0 -1
- package/dist/internal_context-CEu5ji80.d.ts +0 -29
- package/dist/internal_context-D9eKFth1.js +0 -8
- package/dist/internal_context-D9eKFth1.js.map +0 -1
- package/dist/src-i_UcyBYf.js +0 -2147
- package/dist/src-i_UcyBYf.js.map +0 -1
- package/dist/types-BITaDFf-.js +0 -16
- package/dist/types-BITaDFf-.js.map +0 -1
- package/dist/types-DSSHBW6w.d.ts +0 -14
- package/dist/utils-B49TmLCI.js +0 -16
- package/dist/utils-B49TmLCI.js.map +0 -1
- package/dist/workflow-types-Z_Oem1FJ.d.ts +0 -260
package/dist/mcp/client.d.ts
CHANGED
|
@@ -1,2 +1,516 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { d as Event, i as MCPTransportOptions, l as TransportType, n as MCPClientConnection, r as MCPConnectionState, t as MCPServerRow, u as Emitter } from "../client-storage-Cvy5r9FG.js";
|
|
2
|
+
import { t as MCPObservabilityEvent } from "../mcp-Dw5vDrY8.js";
|
|
3
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
|
+
import { CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, GetPromptRequest, Prompt, ReadResourceRequest, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import * as ai from "ai";
|
|
6
|
+
import { ToolSet } from "ai";
|
|
7
|
+
import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
8
|
+
|
|
9
|
+
//#region src/mcp/client.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Options that can be stored in the server_options column
|
|
12
|
+
* This is what gets JSON.stringify'd and stored in the database
|
|
13
|
+
*/
|
|
14
|
+
type MCPServerOptions = {
|
|
15
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
16
|
+
transport?: {
|
|
17
|
+
headers?: HeadersInit;
|
|
18
|
+
type?: TransportType;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Result of an OAuth callback request
|
|
23
|
+
*/
|
|
24
|
+
type MCPOAuthCallbackResult = {
|
|
25
|
+
serverId: string;
|
|
26
|
+
authSuccess: true;
|
|
27
|
+
authError?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
serverId: string;
|
|
30
|
+
authSuccess: false;
|
|
31
|
+
authError: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Options for registering an MCP server
|
|
35
|
+
*/
|
|
36
|
+
type RegisterServerOptions = {
|
|
37
|
+
url: string;
|
|
38
|
+
name: string;
|
|
39
|
+
callbackUrl: string;
|
|
40
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
41
|
+
transport?: MCPTransportOptions;
|
|
42
|
+
authUrl?: string;
|
|
43
|
+
clientId?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Result of attempting to connect to an MCP server.
|
|
47
|
+
* Discriminated union ensures error is present only on failure.
|
|
48
|
+
*/
|
|
49
|
+
type MCPConnectionResult = {
|
|
50
|
+
state: typeof MCPConnectionState.FAILED;
|
|
51
|
+
error: string;
|
|
52
|
+
} | {
|
|
53
|
+
state: typeof MCPConnectionState.AUTHENTICATING;
|
|
54
|
+
authUrl: string;
|
|
55
|
+
clientId?: string;
|
|
56
|
+
} | {
|
|
57
|
+
state: typeof MCPConnectionState.CONNECTED;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Result of discovering server capabilities.
|
|
61
|
+
* success indicates whether discovery completed successfully.
|
|
62
|
+
* state is the current connection state at time of return.
|
|
63
|
+
* error is present when success is false.
|
|
64
|
+
*/
|
|
65
|
+
type MCPDiscoverResult = {
|
|
66
|
+
success: boolean;
|
|
67
|
+
state: MCPConnectionState;
|
|
68
|
+
error?: string;
|
|
69
|
+
};
|
|
70
|
+
type MCPClientOAuthCallbackConfig = {
|
|
71
|
+
successRedirect?: string;
|
|
72
|
+
errorRedirect?: string;
|
|
73
|
+
customHandler?: (result: MCPClientOAuthResult) => Response;
|
|
74
|
+
};
|
|
75
|
+
type MCPClientOAuthResult = {
|
|
76
|
+
serverId: string;
|
|
77
|
+
authSuccess: boolean;
|
|
78
|
+
authError?: string;
|
|
79
|
+
};
|
|
80
|
+
type MCPClientManagerOptions = {
|
|
81
|
+
storage: DurableObjectStorage;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Utility class that aggregates multiple MCP clients into one
|
|
85
|
+
*/
|
|
86
|
+
declare class MCPClientManager {
|
|
87
|
+
private _name;
|
|
88
|
+
private _version;
|
|
89
|
+
mcpConnections: Record<string, MCPClientConnection>;
|
|
90
|
+
private _didWarnAboutUnstableGetAITools;
|
|
91
|
+
private _oauthCallbackConfig?;
|
|
92
|
+
private _connectionDisposables;
|
|
93
|
+
private _storage;
|
|
94
|
+
private _isRestored;
|
|
95
|
+
/** @internal Protected for testing purposes. */
|
|
96
|
+
protected readonly _onObservabilityEvent: Emitter<MCPObservabilityEvent>;
|
|
97
|
+
readonly onObservabilityEvent: Event<MCPObservabilityEvent>;
|
|
98
|
+
private readonly _onServerStateChanged;
|
|
99
|
+
/**
|
|
100
|
+
* Event that fires whenever any MCP server state changes (registered, connected, removed, etc.)
|
|
101
|
+
* This is useful for broadcasting server state to clients.
|
|
102
|
+
*/
|
|
103
|
+
readonly onServerStateChanged: Event<void>;
|
|
104
|
+
/**
|
|
105
|
+
* @param _name Name of the MCP client
|
|
106
|
+
* @param _version Version of the MCP Client
|
|
107
|
+
* @param options Storage adapter for persisting MCP server state
|
|
108
|
+
*/
|
|
109
|
+
constructor(_name: string, _version: string, options: MCPClientManagerOptions);
|
|
110
|
+
private sql;
|
|
111
|
+
private saveServerToStorage;
|
|
112
|
+
private removeServerFromStorage;
|
|
113
|
+
private getServersFromStorage;
|
|
114
|
+
private clearServerAuthUrl;
|
|
115
|
+
private failConnection;
|
|
116
|
+
jsonSchema: typeof ai.jsonSchema | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Create an auth provider for a server
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
private createAuthProvider;
|
|
122
|
+
/**
|
|
123
|
+
* Restore MCP server connections from storage
|
|
124
|
+
* This method is called on Agent initialization to restore previously connected servers
|
|
125
|
+
*
|
|
126
|
+
* @param clientName Name to use for OAuth client (typically the agent instance name)
|
|
127
|
+
*/
|
|
128
|
+
restoreConnectionsFromStorage(clientName: string): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Internal method to restore a single server connection and discovery
|
|
131
|
+
*/
|
|
132
|
+
private _restoreServer;
|
|
133
|
+
/**
|
|
134
|
+
* Connect to and register an MCP server
|
|
135
|
+
*
|
|
136
|
+
* @deprecated This method is maintained for backward compatibility.
|
|
137
|
+
* For new code, use registerServer() and connectToServer() separately.
|
|
138
|
+
*
|
|
139
|
+
* @param url Server URL
|
|
140
|
+
* @param options Connection options
|
|
141
|
+
* @returns Object with server ID, auth URL (if OAuth), and client ID (if OAuth)
|
|
142
|
+
*/
|
|
143
|
+
connect(url: string, options?: {
|
|
144
|
+
reconnect?: {
|
|
145
|
+
id: string;
|
|
146
|
+
oauthClientId?: string;
|
|
147
|
+
oauthCode?: string;
|
|
148
|
+
};
|
|
149
|
+
transport?: MCPTransportOptions;
|
|
150
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
151
|
+
}): Promise<{
|
|
152
|
+
id: string;
|
|
153
|
+
authUrl?: string;
|
|
154
|
+
clientId?: string;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* Create an in-memory connection object and set up observability
|
|
158
|
+
* Does NOT save to storage - use registerServer() for that
|
|
159
|
+
* @returns The connection object (existing or newly created)
|
|
160
|
+
*/
|
|
161
|
+
private createConnection;
|
|
162
|
+
/**
|
|
163
|
+
* Register an MCP server connection without connecting
|
|
164
|
+
* Creates the connection object, sets up observability, and saves to storage
|
|
165
|
+
*
|
|
166
|
+
* @param id Server ID
|
|
167
|
+
* @param options Registration options including URL, name, callback URL, and connection config
|
|
168
|
+
* @returns Server ID
|
|
169
|
+
*/
|
|
170
|
+
registerServer(id: string, options: RegisterServerOptions): Promise<string>;
|
|
171
|
+
/**
|
|
172
|
+
* Connect to an already registered MCP server and initialize the connection.
|
|
173
|
+
*
|
|
174
|
+
* For OAuth servers, returns `{ state: "authenticating", authUrl, clientId? }`.
|
|
175
|
+
* The user must complete the OAuth flow via the authUrl, which triggers a
|
|
176
|
+
* callback handled by `handleCallbackRequest()`.
|
|
177
|
+
*
|
|
178
|
+
* For non-OAuth servers, establishes the transport connection and returns
|
|
179
|
+
* `{ state: "connected" }`. Call `discoverIfConnected()` afterwards to
|
|
180
|
+
* discover capabilities and transition to "ready" state.
|
|
181
|
+
*
|
|
182
|
+
* @param id Server ID (must be registered first via registerServer())
|
|
183
|
+
* @returns Connection result with current state and OAuth info (if applicable)
|
|
184
|
+
*/
|
|
185
|
+
connectToServer(id: string): Promise<MCPConnectionResult>;
|
|
186
|
+
private extractServerIdFromState;
|
|
187
|
+
isCallbackRequest(req: Request): boolean;
|
|
188
|
+
handleCallbackRequest(req: Request): Promise<MCPOAuthCallbackResult>;
|
|
189
|
+
/**
|
|
190
|
+
* Discover server capabilities if connection is in CONNECTED or READY state.
|
|
191
|
+
* Transitions to DISCOVERING then READY (or CONNECTED on error).
|
|
192
|
+
* Can be called to refresh server capabilities (e.g., from a UI refresh button).
|
|
193
|
+
*
|
|
194
|
+
* If called while a previous discovery is in-flight for the same server,
|
|
195
|
+
* the previous discovery will be aborted.
|
|
196
|
+
*
|
|
197
|
+
* @param serverId The server ID to discover
|
|
198
|
+
* @param options Optional configuration
|
|
199
|
+
* @param options.timeoutMs Timeout in milliseconds (default: 30000)
|
|
200
|
+
* @returns Result with current state and optional error, or undefined if connection not found
|
|
201
|
+
*/
|
|
202
|
+
discoverIfConnected(serverId: string, options?: {
|
|
203
|
+
timeoutMs?: number;
|
|
204
|
+
}): Promise<MCPDiscoverResult | undefined>;
|
|
205
|
+
/**
|
|
206
|
+
* Establish connection in the background after OAuth completion
|
|
207
|
+
* This method connects to the server and discovers its capabilities
|
|
208
|
+
* @param serverId The server ID to establish connection for
|
|
209
|
+
*/
|
|
210
|
+
establishConnection(serverId: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Configure OAuth callback handling
|
|
213
|
+
* @param config OAuth callback configuration
|
|
214
|
+
*/
|
|
215
|
+
configureOAuthCallback(config: MCPClientOAuthCallbackConfig): void;
|
|
216
|
+
/**
|
|
217
|
+
* Get the current OAuth callback configuration
|
|
218
|
+
* @returns The current OAuth callback configuration
|
|
219
|
+
*/
|
|
220
|
+
getOAuthCallbackConfig(): MCPClientOAuthCallbackConfig | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* @returns namespaced list of tools
|
|
223
|
+
*/
|
|
224
|
+
listTools(): NamespacedData["tools"];
|
|
225
|
+
/**
|
|
226
|
+
* Lazy-loads the jsonSchema function from the AI SDK.
|
|
227
|
+
*
|
|
228
|
+
* This defers importing the "ai" package until it's actually needed, which helps reduce
|
|
229
|
+
* initial bundle size and startup time. The jsonSchema function is required for converting
|
|
230
|
+
* MCP tools into AI SDK tool definitions via getAITools().
|
|
231
|
+
*
|
|
232
|
+
* @internal This method is for internal use only. It's automatically called before operations
|
|
233
|
+
* that need jsonSchema (like getAITools() or OAuth flows). External consumers should not need
|
|
234
|
+
* to call this directly.
|
|
235
|
+
*/
|
|
236
|
+
ensureJsonSchema(): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* @returns a set of tools that you can use with the AI SDK
|
|
239
|
+
*/
|
|
240
|
+
getAITools(): ToolSet;
|
|
241
|
+
/**
|
|
242
|
+
* @deprecated this has been renamed to getAITools(), and unstable_getAITools will be removed in the next major version
|
|
243
|
+
* @returns a set of tools that you can use with the AI SDK
|
|
244
|
+
*/
|
|
245
|
+
unstable_getAITools(): ToolSet;
|
|
246
|
+
/**
|
|
247
|
+
* Closes all active in-memory connections to MCP servers.
|
|
248
|
+
*
|
|
249
|
+
* Note: This only closes the transport connections - it does NOT remove
|
|
250
|
+
* servers from storage. Servers will still be listed and their callback
|
|
251
|
+
* URLs will still match incoming OAuth requests.
|
|
252
|
+
*
|
|
253
|
+
* Use removeServer() instead if you want to fully clean up a server
|
|
254
|
+
* (closes connection AND removes from storage).
|
|
255
|
+
*/
|
|
256
|
+
closeAllConnections(): Promise<void>;
|
|
257
|
+
/**
|
|
258
|
+
* Closes a connection to an MCP server
|
|
259
|
+
* @param id The id of the connection to close
|
|
260
|
+
*/
|
|
261
|
+
closeConnection(id: string): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Remove an MCP server - closes connection if active and removes from storage.
|
|
264
|
+
*/
|
|
265
|
+
removeServer(serverId: string): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* List all MCP servers from storage
|
|
268
|
+
*/
|
|
269
|
+
listServers(): MCPServerRow[];
|
|
270
|
+
/**
|
|
271
|
+
* Dispose the manager and all resources.
|
|
272
|
+
*/
|
|
273
|
+
dispose(): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* @returns namespaced list of prompts
|
|
276
|
+
*/
|
|
277
|
+
listPrompts(): NamespacedData["prompts"];
|
|
278
|
+
/**
|
|
279
|
+
* @returns namespaced list of tools
|
|
280
|
+
*/
|
|
281
|
+
listResources(): NamespacedData["resources"];
|
|
282
|
+
/**
|
|
283
|
+
* @returns namespaced list of resource templates
|
|
284
|
+
*/
|
|
285
|
+
listResourceTemplates(): NamespacedData["resourceTemplates"];
|
|
286
|
+
/**
|
|
287
|
+
* Namespaced version of callTool
|
|
288
|
+
*/
|
|
289
|
+
callTool(params: CallToolRequest["params"] & {
|
|
290
|
+
serverId: string;
|
|
291
|
+
}, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<{
|
|
292
|
+
[x: string]: unknown;
|
|
293
|
+
content: ({
|
|
294
|
+
type: "text";
|
|
295
|
+
text: string;
|
|
296
|
+
annotations?: {
|
|
297
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
298
|
+
priority?: number | undefined;
|
|
299
|
+
lastModified?: string | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
_meta?: Record<string, unknown> | undefined;
|
|
302
|
+
} | {
|
|
303
|
+
type: "image";
|
|
304
|
+
data: string;
|
|
305
|
+
mimeType: string;
|
|
306
|
+
annotations?: {
|
|
307
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
308
|
+
priority?: number | undefined;
|
|
309
|
+
lastModified?: string | undefined;
|
|
310
|
+
} | undefined;
|
|
311
|
+
_meta?: Record<string, unknown> | undefined;
|
|
312
|
+
} | {
|
|
313
|
+
type: "audio";
|
|
314
|
+
data: string;
|
|
315
|
+
mimeType: string;
|
|
316
|
+
annotations?: {
|
|
317
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
318
|
+
priority?: number | undefined;
|
|
319
|
+
lastModified?: string | undefined;
|
|
320
|
+
} | undefined;
|
|
321
|
+
_meta?: Record<string, unknown> | undefined;
|
|
322
|
+
} | {
|
|
323
|
+
type: "resource";
|
|
324
|
+
resource: {
|
|
325
|
+
uri: string;
|
|
326
|
+
text: string;
|
|
327
|
+
mimeType?: string | undefined;
|
|
328
|
+
_meta?: Record<string, unknown> | undefined;
|
|
329
|
+
} | {
|
|
330
|
+
uri: string;
|
|
331
|
+
blob: string;
|
|
332
|
+
mimeType?: string | undefined;
|
|
333
|
+
_meta?: Record<string, unknown> | undefined;
|
|
334
|
+
};
|
|
335
|
+
annotations?: {
|
|
336
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
337
|
+
priority?: number | undefined;
|
|
338
|
+
lastModified?: string | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
_meta?: Record<string, unknown> | undefined;
|
|
341
|
+
} | {
|
|
342
|
+
uri: string;
|
|
343
|
+
name: string;
|
|
344
|
+
type: "resource_link";
|
|
345
|
+
description?: string | undefined;
|
|
346
|
+
mimeType?: string | undefined;
|
|
347
|
+
annotations?: {
|
|
348
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
349
|
+
priority?: number | undefined;
|
|
350
|
+
lastModified?: string | undefined;
|
|
351
|
+
} | undefined;
|
|
352
|
+
_meta?: {
|
|
353
|
+
[x: string]: unknown;
|
|
354
|
+
} | undefined;
|
|
355
|
+
icons?: {
|
|
356
|
+
src: string;
|
|
357
|
+
mimeType?: string | undefined;
|
|
358
|
+
sizes?: string[] | undefined;
|
|
359
|
+
theme?: "light" | "dark" | undefined;
|
|
360
|
+
}[] | undefined;
|
|
361
|
+
title?: string | undefined;
|
|
362
|
+
})[];
|
|
363
|
+
_meta?: {
|
|
364
|
+
[x: string]: unknown;
|
|
365
|
+
progressToken?: string | number | undefined;
|
|
366
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
367
|
+
taskId: string;
|
|
368
|
+
} | undefined;
|
|
369
|
+
} | undefined;
|
|
370
|
+
structuredContent?: Record<string, unknown> | undefined;
|
|
371
|
+
isError?: boolean | undefined;
|
|
372
|
+
} | {
|
|
373
|
+
[x: string]: unknown;
|
|
374
|
+
toolResult: unknown;
|
|
375
|
+
_meta?: {
|
|
376
|
+
[x: string]: unknown;
|
|
377
|
+
progressToken?: string | number | undefined;
|
|
378
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
379
|
+
taskId: string;
|
|
380
|
+
} | undefined;
|
|
381
|
+
} | undefined;
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* Namespaced version of readResource
|
|
385
|
+
*/
|
|
386
|
+
readResource(params: ReadResourceRequest["params"] & {
|
|
387
|
+
serverId: string;
|
|
388
|
+
}, options: RequestOptions): Promise<{
|
|
389
|
+
[x: string]: unknown;
|
|
390
|
+
contents: ({
|
|
391
|
+
uri: string;
|
|
392
|
+
text: string;
|
|
393
|
+
mimeType?: string | undefined;
|
|
394
|
+
_meta?: Record<string, unknown> | undefined;
|
|
395
|
+
} | {
|
|
396
|
+
uri: string;
|
|
397
|
+
blob: string;
|
|
398
|
+
mimeType?: string | undefined;
|
|
399
|
+
_meta?: Record<string, unknown> | undefined;
|
|
400
|
+
})[];
|
|
401
|
+
_meta?: {
|
|
402
|
+
[x: string]: unknown;
|
|
403
|
+
progressToken?: string | number | undefined;
|
|
404
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
405
|
+
taskId: string;
|
|
406
|
+
} | undefined;
|
|
407
|
+
} | undefined;
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* Namespaced version of getPrompt
|
|
411
|
+
*/
|
|
412
|
+
getPrompt(params: GetPromptRequest["params"] & {
|
|
413
|
+
serverId: string;
|
|
414
|
+
}, options: RequestOptions): Promise<{
|
|
415
|
+
[x: string]: unknown;
|
|
416
|
+
messages: {
|
|
417
|
+
role: "user" | "assistant";
|
|
418
|
+
content: {
|
|
419
|
+
type: "text";
|
|
420
|
+
text: string;
|
|
421
|
+
annotations?: {
|
|
422
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
423
|
+
priority?: number | undefined;
|
|
424
|
+
lastModified?: string | undefined;
|
|
425
|
+
} | undefined;
|
|
426
|
+
_meta?: Record<string, unknown> | undefined;
|
|
427
|
+
} | {
|
|
428
|
+
type: "image";
|
|
429
|
+
data: string;
|
|
430
|
+
mimeType: string;
|
|
431
|
+
annotations?: {
|
|
432
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
433
|
+
priority?: number | undefined;
|
|
434
|
+
lastModified?: string | undefined;
|
|
435
|
+
} | undefined;
|
|
436
|
+
_meta?: Record<string, unknown> | undefined;
|
|
437
|
+
} | {
|
|
438
|
+
type: "audio";
|
|
439
|
+
data: string;
|
|
440
|
+
mimeType: string;
|
|
441
|
+
annotations?: {
|
|
442
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
443
|
+
priority?: number | undefined;
|
|
444
|
+
lastModified?: string | undefined;
|
|
445
|
+
} | undefined;
|
|
446
|
+
_meta?: Record<string, unknown> | undefined;
|
|
447
|
+
} | {
|
|
448
|
+
type: "resource";
|
|
449
|
+
resource: {
|
|
450
|
+
uri: string;
|
|
451
|
+
text: string;
|
|
452
|
+
mimeType?: string | undefined;
|
|
453
|
+
_meta?: Record<string, unknown> | undefined;
|
|
454
|
+
} | {
|
|
455
|
+
uri: string;
|
|
456
|
+
blob: string;
|
|
457
|
+
mimeType?: string | undefined;
|
|
458
|
+
_meta?: Record<string, unknown> | undefined;
|
|
459
|
+
};
|
|
460
|
+
annotations?: {
|
|
461
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
462
|
+
priority?: number | undefined;
|
|
463
|
+
lastModified?: string | undefined;
|
|
464
|
+
} | undefined;
|
|
465
|
+
_meta?: Record<string, unknown> | undefined;
|
|
466
|
+
} | {
|
|
467
|
+
uri: string;
|
|
468
|
+
name: string;
|
|
469
|
+
type: "resource_link";
|
|
470
|
+
description?: string | undefined;
|
|
471
|
+
mimeType?: string | undefined;
|
|
472
|
+
annotations?: {
|
|
473
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
474
|
+
priority?: number | undefined;
|
|
475
|
+
lastModified?: string | undefined;
|
|
476
|
+
} | undefined;
|
|
477
|
+
_meta?: {
|
|
478
|
+
[x: string]: unknown;
|
|
479
|
+
} | undefined;
|
|
480
|
+
icons?: {
|
|
481
|
+
src: string;
|
|
482
|
+
mimeType?: string | undefined;
|
|
483
|
+
sizes?: string[] | undefined;
|
|
484
|
+
theme?: "light" | "dark" | undefined;
|
|
485
|
+
}[] | undefined;
|
|
486
|
+
title?: string | undefined;
|
|
487
|
+
};
|
|
488
|
+
}[];
|
|
489
|
+
_meta?: {
|
|
490
|
+
[x: string]: unknown;
|
|
491
|
+
progressToken?: string | number | undefined;
|
|
492
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
493
|
+
taskId: string;
|
|
494
|
+
} | undefined;
|
|
495
|
+
} | undefined;
|
|
496
|
+
description?: string | undefined;
|
|
497
|
+
}>;
|
|
498
|
+
}
|
|
499
|
+
type NamespacedData = {
|
|
500
|
+
tools: (Tool & {
|
|
501
|
+
serverId: string;
|
|
502
|
+
})[];
|
|
503
|
+
prompts: (Prompt & {
|
|
504
|
+
serverId: string;
|
|
505
|
+
})[];
|
|
506
|
+
resources: (Resource & {
|
|
507
|
+
serverId: string;
|
|
508
|
+
})[];
|
|
509
|
+
resourceTemplates: (ResourceTemplate & {
|
|
510
|
+
serverId: string;
|
|
511
|
+
})[];
|
|
512
|
+
};
|
|
513
|
+
declare function getNamespacedData<T extends keyof NamespacedData>(mcpClients: Record<string, MCPClientConnection>, type: T): NamespacedData[T];
|
|
514
|
+
//#endregion
|
|
515
|
+
export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPOAuthCallbackResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };
|
|
516
|
+
//# sourceMappingURL=client.d.ts.map
|