agents 0.0.0-e03246e → 0.0.0-e416962
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/dist/ai-chat-agent.d.ts +22 -3
- package/dist/ai-chat-agent.js +92 -26
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.js +24 -16
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +5 -0
- package/dist/{chunk-YMUU7QHV.js → chunk-HN5JVKAZ.js} +25 -14
- package/dist/chunk-HN5JVKAZ.js.map +1 -0
- package/dist/chunk-Q5ZBHY4Z.js +456 -0
- package/dist/chunk-Q5ZBHY4Z.js.map +1 -0
- package/dist/index.d.ts +18 -12
- package/dist/index.js +6 -7
- package/dist/mcp/client.d.ts +138 -36
- package/dist/mcp/client.js +4 -262
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +41 -0
- package/dist/mcp/do-oauth-client-provider.js +107 -0
- package/dist/mcp/do-oauth-client-provider.js.map +1 -0
- package/dist/mcp/index.d.ts +33 -4
- package/dist/mcp/index.js +578 -113
- package/dist/mcp/index.js.map +1 -1
- package/dist/react.js +20 -20
- package/dist/react.js.map +1 -1
- package/package.json +27 -5
- package/src/index.ts +35 -14
- package/dist/chunk-YMUU7QHV.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent,
|
|
3
3
|
StreamingResponse,
|
|
4
|
-
WorkflowEntrypoint,
|
|
5
4
|
getAgentByName,
|
|
5
|
+
getCurrentAgent,
|
|
6
6
|
routeAgentEmail,
|
|
7
7
|
routeAgentRequest,
|
|
8
|
-
unstable_callable
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
unstable_callable
|
|
9
|
+
} from "./chunk-HN5JVKAZ.js";
|
|
10
|
+
import "./chunk-Q5ZBHY4Z.js";
|
|
11
11
|
import "./chunk-HMLY7DHA.js";
|
|
12
12
|
export {
|
|
13
13
|
Agent,
|
|
14
14
|
StreamingResponse,
|
|
15
|
-
WorkflowEntrypoint,
|
|
16
15
|
getAgentByName,
|
|
16
|
+
getCurrentAgent,
|
|
17
17
|
routeAgentEmail,
|
|
18
18
|
routeAgentRequest,
|
|
19
|
-
unstable_callable
|
|
20
|
-
unstable_context
|
|
19
|
+
unstable_callable
|
|
21
20
|
};
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
package/dist/mcp/client.d.ts
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
|
-
import { Tool, Prompt
|
|
2
|
+
import { ClientCapabilities, Tool, Prompt, Resource, ResourceTemplate, ServerCapabilities, CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, ReadResourceRequest, GetPromptRequest } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
5
|
+
import { AgentsOAuthProvider } from './do-oauth-client-provider.js';
|
|
5
6
|
import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
7
|
+
import { ToolSet } from 'ai';
|
|
8
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
9
|
+
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
6
10
|
|
|
7
11
|
declare class MCPClientConnection {
|
|
8
|
-
|
|
12
|
+
url: URL;
|
|
13
|
+
options: {
|
|
14
|
+
transport: SSEClientTransportOptions & {
|
|
15
|
+
authProvider?: AgentsOAuthProvider;
|
|
16
|
+
};
|
|
17
|
+
client: ConstructorParameters<typeof Client>[1];
|
|
18
|
+
capabilities: ClientCapabilities;
|
|
19
|
+
};
|
|
9
20
|
client: Client;
|
|
10
|
-
|
|
11
|
-
connected: boolean;
|
|
21
|
+
connectionState: "authenticating" | "connecting" | "ready" | "discovering" | "failed";
|
|
12
22
|
instructions?: string;
|
|
13
23
|
tools: Tool[];
|
|
14
|
-
prompts: Prompt
|
|
24
|
+
prompts: Prompt[];
|
|
15
25
|
resources: Resource[];
|
|
16
26
|
resourceTemplates: ResourceTemplate[];
|
|
17
27
|
serverCapabilities: ServerCapabilities | undefined;
|
|
18
|
-
constructor(url: URL, info: ConstructorParameters<typeof Client>[0],
|
|
19
|
-
transport: SSEClientTransportOptions
|
|
28
|
+
constructor(url: URL, info: ConstructorParameters<typeof Client>[0], options?: {
|
|
29
|
+
transport: SSEClientTransportOptions & {
|
|
30
|
+
authProvider?: AgentsOAuthProvider;
|
|
31
|
+
};
|
|
20
32
|
client: ConstructorParameters<typeof Client>[1];
|
|
21
33
|
capabilities: ClientCapabilities;
|
|
22
34
|
});
|
|
23
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Initialize a client connection
|
|
37
|
+
*
|
|
38
|
+
* @param code Optional OAuth code to initialize the connection with if auth hasn't been initialized
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
init(code?: string, clientId?: string): Promise<void>;
|
|
24
42
|
/**
|
|
25
43
|
* Notification handler registration
|
|
26
44
|
*/
|
|
27
45
|
registerTools(): Promise<Tool[]>;
|
|
28
46
|
registerResources(): Promise<Resource[]>;
|
|
29
|
-
registerPrompts(): Promise<Prompt
|
|
47
|
+
registerPrompts(): Promise<Prompt[]>;
|
|
30
48
|
registerResourceTemplates(): Promise<ResourceTemplate[]>;
|
|
31
49
|
fetchTools(): Promise<{
|
|
32
50
|
[x: string]: unknown;
|
|
@@ -42,10 +60,10 @@ declare class MCPClientConnection {
|
|
|
42
60
|
}[]>;
|
|
43
61
|
fetchResources(): Promise<{
|
|
44
62
|
[x: string]: unknown;
|
|
45
|
-
name: string;
|
|
46
63
|
uri: string;
|
|
47
|
-
|
|
64
|
+
name: string;
|
|
48
65
|
mimeType?: string | undefined;
|
|
66
|
+
description?: string | undefined;
|
|
49
67
|
}[]>;
|
|
50
68
|
fetchPrompts(): Promise<{
|
|
51
69
|
[x: string]: unknown;
|
|
@@ -62,8 +80,8 @@ declare class MCPClientConnection {
|
|
|
62
80
|
[x: string]: unknown;
|
|
63
81
|
name: string;
|
|
64
82
|
uriTemplate: string;
|
|
65
|
-
description?: string | undefined;
|
|
66
83
|
mimeType?: string | undefined;
|
|
84
|
+
description?: string | undefined;
|
|
67
85
|
}[]>;
|
|
68
86
|
}
|
|
69
87
|
|
|
@@ -71,7 +89,16 @@ declare class MCPClientConnection {
|
|
|
71
89
|
* Utility class that aggregates multiple MCP clients into one
|
|
72
90
|
*/
|
|
73
91
|
declare class MCPClientManager {
|
|
92
|
+
private name;
|
|
93
|
+
private version;
|
|
74
94
|
mcpConnections: Record<string, MCPClientConnection>;
|
|
95
|
+
private callbackUrls;
|
|
96
|
+
/**
|
|
97
|
+
* @param name Name of the MCP client
|
|
98
|
+
* @param version Version of the MCP Client
|
|
99
|
+
* @param auth Auth paramters if being used to create a DurableObjectOAuthClientProvider
|
|
100
|
+
*/
|
|
101
|
+
constructor(name: string, version: string);
|
|
75
102
|
/**
|
|
76
103
|
* Connect to and register an MCP server
|
|
77
104
|
*
|
|
@@ -79,15 +106,42 @@ declare class MCPClientManager {
|
|
|
79
106
|
* @param clientConfig Client config
|
|
80
107
|
* @param capabilities Client capabilities (i.e. if the client supports roots/sampling)
|
|
81
108
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
109
|
+
connect(url: string, options?: {
|
|
110
|
+
reconnect?: {
|
|
111
|
+
id: string;
|
|
112
|
+
oauthClientId?: string;
|
|
113
|
+
oauthCode?: string;
|
|
114
|
+
};
|
|
115
|
+
transport?: SSEClientTransportOptions & {
|
|
116
|
+
authProvider?: AgentsOAuthProvider;
|
|
117
|
+
};
|
|
118
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
119
|
+
capabilities?: ClientCapabilities;
|
|
120
|
+
}): Promise<{
|
|
121
|
+
id: string;
|
|
122
|
+
authUrl: string | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
isCallbackRequest(req: Request): boolean;
|
|
125
|
+
handleCallbackRequest(req: Request): Promise<{
|
|
126
|
+
serverId: string;
|
|
127
|
+
}>;
|
|
87
128
|
/**
|
|
88
129
|
* @returns namespaced list of tools
|
|
89
130
|
*/
|
|
90
131
|
listTools(): NamespacedData["tools"];
|
|
132
|
+
/**
|
|
133
|
+
* @returns a set of tools that you can use with the AI SDK
|
|
134
|
+
*/
|
|
135
|
+
unstable_getAITools(): ToolSet;
|
|
136
|
+
/**
|
|
137
|
+
* Closes all connections to MCP servers
|
|
138
|
+
*/
|
|
139
|
+
closeAllConnections(): Promise<void[]>;
|
|
140
|
+
/**
|
|
141
|
+
* Closes a connection to an MCP server
|
|
142
|
+
* @param id The id of the connection to close
|
|
143
|
+
*/
|
|
144
|
+
closeConnection(id: string): Promise<void>;
|
|
91
145
|
/**
|
|
92
146
|
* @returns namespaced list of prompts
|
|
93
147
|
*/
|
|
@@ -104,10 +158,10 @@ declare class MCPClientManager {
|
|
|
104
158
|
* Namespaced version of callTool
|
|
105
159
|
*/
|
|
106
160
|
callTool(params: CallToolRequest["params"] & {
|
|
107
|
-
|
|
108
|
-
}, resultSchema
|
|
161
|
+
serverId: string;
|
|
162
|
+
}, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<zod.objectOutputType<{
|
|
109
163
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
110
|
-
}
|
|
164
|
+
} & {
|
|
111
165
|
content: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
|
|
112
166
|
type: zod.ZodLiteral<"text">;
|
|
113
167
|
text: zod.ZodString;
|
|
@@ -129,6 +183,18 @@ declare class MCPClientManager {
|
|
|
129
183
|
type: zod.ZodLiteral<"image">;
|
|
130
184
|
data: zod.ZodString;
|
|
131
185
|
mimeType: zod.ZodString;
|
|
186
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
187
|
+
type: zod.ZodLiteral<"audio">;
|
|
188
|
+
data: zod.ZodString;
|
|
189
|
+
mimeType: zod.ZodString;
|
|
190
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
191
|
+
type: zod.ZodLiteral<"audio">;
|
|
192
|
+
data: zod.ZodString;
|
|
193
|
+
mimeType: zod.ZodString;
|
|
194
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
195
|
+
type: zod.ZodLiteral<"audio">;
|
|
196
|
+
data: zod.ZodString;
|
|
197
|
+
mimeType: zod.ZodString;
|
|
132
198
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
133
199
|
type: zod.ZodLiteral<"resource">;
|
|
134
200
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
@@ -230,19 +296,19 @@ declare class MCPClientManager {
|
|
|
230
296
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
231
297
|
}, zod.ZodTypeAny, "passthrough">>]>, "many">;
|
|
232
298
|
isError: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
|
|
233
|
-
}
|
|
299
|
+
}, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<{
|
|
234
300
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
235
|
-
}
|
|
301
|
+
} & {
|
|
236
302
|
toolResult: zod.ZodUnknown;
|
|
237
|
-
}
|
|
303
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
238
304
|
/**
|
|
239
305
|
* Namespaced version of readResource
|
|
240
306
|
*/
|
|
241
307
|
readResource(params: ReadResourceRequest["params"] & {
|
|
242
|
-
|
|
243
|
-
}, options: RequestOptions): Promise<zod.objectOutputType<
|
|
308
|
+
serverId: string;
|
|
309
|
+
}, options: RequestOptions): Promise<zod.objectOutputType<{
|
|
244
310
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
245
|
-
}
|
|
311
|
+
} & {
|
|
246
312
|
contents: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
247
313
|
uri: zod.ZodString;
|
|
248
314
|
mimeType: zod.ZodOptional<zod.ZodString>;
|
|
@@ -274,15 +340,15 @@ declare class MCPClientManager {
|
|
|
274
340
|
}, {
|
|
275
341
|
blob: zod.ZodString;
|
|
276
342
|
}>, zod.ZodTypeAny, "passthrough">>]>, "many">;
|
|
277
|
-
}
|
|
343
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
278
344
|
/**
|
|
279
345
|
* Namespaced version of getPrompt
|
|
280
346
|
*/
|
|
281
347
|
getPrompt(params: GetPromptRequest["params"] & {
|
|
282
|
-
|
|
283
|
-
}, options: RequestOptions): Promise<zod.objectOutputType<
|
|
348
|
+
serverId: string;
|
|
349
|
+
}, options: RequestOptions): Promise<zod.objectOutputType<{
|
|
284
350
|
_meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
|
|
285
|
-
}
|
|
351
|
+
} & {
|
|
286
352
|
description: zod.ZodOptional<zod.ZodString>;
|
|
287
353
|
messages: zod.ZodArray<zod.ZodObject<{
|
|
288
354
|
role: zod.ZodEnum<["user", "assistant"]>;
|
|
@@ -307,6 +373,18 @@ declare class MCPClientManager {
|
|
|
307
373
|
type: zod.ZodLiteral<"image">;
|
|
308
374
|
data: zod.ZodString;
|
|
309
375
|
mimeType: zod.ZodString;
|
|
376
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
377
|
+
type: zod.ZodLiteral<"audio">;
|
|
378
|
+
data: zod.ZodString;
|
|
379
|
+
mimeType: zod.ZodString;
|
|
380
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
381
|
+
type: zod.ZodLiteral<"audio">;
|
|
382
|
+
data: zod.ZodString;
|
|
383
|
+
mimeType: zod.ZodString;
|
|
384
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
385
|
+
type: zod.ZodLiteral<"audio">;
|
|
386
|
+
data: zod.ZodString;
|
|
387
|
+
mimeType: zod.ZodString;
|
|
310
388
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
311
389
|
type: zod.ZodLiteral<"resource">;
|
|
312
390
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
@@ -430,6 +508,18 @@ declare class MCPClientManager {
|
|
|
430
508
|
type: zod.ZodLiteral<"image">;
|
|
431
509
|
data: zod.ZodString;
|
|
432
510
|
mimeType: zod.ZodString;
|
|
511
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
512
|
+
type: zod.ZodLiteral<"audio">;
|
|
513
|
+
data: zod.ZodString;
|
|
514
|
+
mimeType: zod.ZodString;
|
|
515
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
516
|
+
type: zod.ZodLiteral<"audio">;
|
|
517
|
+
data: zod.ZodString;
|
|
518
|
+
mimeType: zod.ZodString;
|
|
519
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
520
|
+
type: zod.ZodLiteral<"audio">;
|
|
521
|
+
data: zod.ZodString;
|
|
522
|
+
mimeType: zod.ZodString;
|
|
433
523
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
434
524
|
type: zod.ZodLiteral<"resource">;
|
|
435
525
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
@@ -553,6 +643,18 @@ declare class MCPClientManager {
|
|
|
553
643
|
type: zod.ZodLiteral<"image">;
|
|
554
644
|
data: zod.ZodString;
|
|
555
645
|
mimeType: zod.ZodString;
|
|
646
|
+
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
647
|
+
type: zod.ZodLiteral<"audio">;
|
|
648
|
+
data: zod.ZodString;
|
|
649
|
+
mimeType: zod.ZodString;
|
|
650
|
+
}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
|
|
651
|
+
type: zod.ZodLiteral<"audio">;
|
|
652
|
+
data: zod.ZodString;
|
|
653
|
+
mimeType: zod.ZodString;
|
|
654
|
+
}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
|
|
655
|
+
type: zod.ZodLiteral<"audio">;
|
|
656
|
+
data: zod.ZodString;
|
|
657
|
+
mimeType: zod.ZodString;
|
|
556
658
|
}, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
|
|
557
659
|
type: zod.ZodLiteral<"resource">;
|
|
558
660
|
resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
|
|
@@ -654,20 +756,20 @@ declare class MCPClientManager {
|
|
|
654
756
|
}>, zod.ZodTypeAny, "passthrough">>]>;
|
|
655
757
|
}, zod.ZodTypeAny, "passthrough">>]>;
|
|
656
758
|
}, zod.ZodTypeAny, "passthrough">>, "many">;
|
|
657
|
-
}
|
|
759
|
+
}, zod.ZodTypeAny, "passthrough">>;
|
|
658
760
|
}
|
|
659
761
|
type NamespacedData = {
|
|
660
762
|
tools: (Tool & {
|
|
661
|
-
|
|
763
|
+
serverId: string;
|
|
662
764
|
})[];
|
|
663
765
|
prompts: (Prompt & {
|
|
664
|
-
|
|
766
|
+
serverId: string;
|
|
665
767
|
})[];
|
|
666
768
|
resources: (Resource & {
|
|
667
|
-
|
|
769
|
+
serverId: string;
|
|
668
770
|
})[];
|
|
669
771
|
resourceTemplates: (ResourceTemplate & {
|
|
670
|
-
|
|
772
|
+
serverId: string;
|
|
671
773
|
})[];
|
|
672
774
|
};
|
|
673
775
|
declare function getNamespacedData<T extends keyof NamespacedData>(mcpClients: Record<string, MCPClientConnection>, type: T): NamespacedData[T];
|
package/dist/mcp/client.js
CHANGED
|
@@ -1,266 +1,8 @@
|
|
|
1
|
-
import "../chunk-HMLY7DHA.js";
|
|
2
|
-
|
|
3
|
-
// src/mcp/sse-edge.ts
|
|
4
|
-
import {
|
|
5
|
-
SSEClientTransport
|
|
6
|
-
} from "@modelcontextprotocol/sdk/client/sse.js";
|
|
7
|
-
var SSEEdgeClientTransport = class extends SSEClientTransport {
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new EdgeSSEClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
10
|
-
*/
|
|
11
|
-
constructor(url, options) {
|
|
12
|
-
const fetchOverride = (url2, options2 = {}) => {
|
|
13
|
-
const workerOptions = {
|
|
14
|
-
...options2
|
|
15
|
-
};
|
|
16
|
-
delete workerOptions.mode;
|
|
17
|
-
return global.fetch(url2, workerOptions);
|
|
18
|
-
};
|
|
19
|
-
super(url, {
|
|
20
|
-
...options,
|
|
21
|
-
eventSourceInit: {
|
|
22
|
-
fetch: fetchOverride
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
this.url = url;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// src/mcp/client-connection.ts
|
|
30
1
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
36
|
-
var MCPClientConnection = class {
|
|
37
|
-
constructor(url, info, opts = { transport: {}, client: {}, capabilities: {} }) {
|
|
38
|
-
this.info = info;
|
|
39
|
-
this.transport = new SSEEdgeClientTransport(url, opts.transport);
|
|
40
|
-
this.client = new Client(info, opts.client);
|
|
41
|
-
this.client.registerCapabilities(opts.capabilities);
|
|
42
|
-
this.connected = false;
|
|
43
|
-
this.tools = [];
|
|
44
|
-
this.prompts = [];
|
|
45
|
-
this.resources = [];
|
|
46
|
-
this.resourceTemplates = [];
|
|
47
|
-
}
|
|
48
|
-
async init() {
|
|
49
|
-
await this.client.connect(this.transport);
|
|
50
|
-
this.serverCapabilities = await this.client.getServerCapabilities();
|
|
51
|
-
if (!this.serverCapabilities) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
`The MCP Server ${this.info.name} failed to return server capabilities`
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
const [instructions, tools, resources, prompts, resourceTemplates] = await Promise.all([
|
|
57
|
-
this.client.getInstructions(),
|
|
58
|
-
this.registerTools(),
|
|
59
|
-
this.registerResources(),
|
|
60
|
-
this.registerPrompts(),
|
|
61
|
-
this.registerResourceTemplates()
|
|
62
|
-
]);
|
|
63
|
-
this.instructions = instructions;
|
|
64
|
-
this.tools = tools;
|
|
65
|
-
this.resources = resources;
|
|
66
|
-
this.prompts = prompts;
|
|
67
|
-
this.resourceTemplates = resourceTemplates;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Notification handler registration
|
|
71
|
-
*/
|
|
72
|
-
async registerTools() {
|
|
73
|
-
if (!this.serverCapabilities || !this.serverCapabilities.tools) {
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
if (this.serverCapabilities.tools.listChanged) {
|
|
77
|
-
this.client.setNotificationHandler(
|
|
78
|
-
ToolListChangedNotificationSchema,
|
|
79
|
-
async (_notification) => {
|
|
80
|
-
this.tools = await this.fetchTools();
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
return this.fetchTools();
|
|
85
|
-
}
|
|
86
|
-
async registerResources() {
|
|
87
|
-
if (!this.serverCapabilities || !this.serverCapabilities.resources) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
if (this.serverCapabilities.resources.listChanged) {
|
|
91
|
-
this.client.setNotificationHandler(
|
|
92
|
-
ResourceListChangedNotificationSchema,
|
|
93
|
-
async (_notification) => {
|
|
94
|
-
this.resources = await this.fetchResources();
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
return this.fetchResources();
|
|
99
|
-
}
|
|
100
|
-
async registerPrompts() {
|
|
101
|
-
if (!this.serverCapabilities || !this.serverCapabilities.prompts) {
|
|
102
|
-
return [];
|
|
103
|
-
}
|
|
104
|
-
if (this.serverCapabilities.prompts.listChanged) {
|
|
105
|
-
this.client.setNotificationHandler(
|
|
106
|
-
PromptListChangedNotificationSchema,
|
|
107
|
-
async (_notification) => {
|
|
108
|
-
this.prompts = await this.fetchPrompts();
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
return this.fetchPrompts();
|
|
113
|
-
}
|
|
114
|
-
async registerResourceTemplates() {
|
|
115
|
-
if (!this.serverCapabilities || !this.serverCapabilities.resources) {
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
return this.fetchResourceTemplates();
|
|
119
|
-
}
|
|
120
|
-
async fetchTools() {
|
|
121
|
-
let toolsAgg = [];
|
|
122
|
-
let toolsResult = { tools: [] };
|
|
123
|
-
do {
|
|
124
|
-
toolsResult = await this.client.listTools({
|
|
125
|
-
cursor: toolsResult.nextCursor
|
|
126
|
-
});
|
|
127
|
-
toolsAgg = toolsAgg.concat(toolsResult.tools);
|
|
128
|
-
} while (toolsResult.nextCursor);
|
|
129
|
-
return toolsAgg;
|
|
130
|
-
}
|
|
131
|
-
async fetchResources() {
|
|
132
|
-
let resourcesAgg = [];
|
|
133
|
-
let resourcesResult = { resources: [] };
|
|
134
|
-
do {
|
|
135
|
-
resourcesResult = await this.client.listResources({
|
|
136
|
-
cursor: resourcesResult.nextCursor
|
|
137
|
-
});
|
|
138
|
-
resourcesAgg = resourcesAgg.concat(resourcesResult.resources);
|
|
139
|
-
} while (resourcesResult.nextCursor);
|
|
140
|
-
return resourcesAgg;
|
|
141
|
-
}
|
|
142
|
-
async fetchPrompts() {
|
|
143
|
-
let promptsAgg = [];
|
|
144
|
-
let promptsResult = { prompts: [] };
|
|
145
|
-
do {
|
|
146
|
-
promptsResult = await this.client.listPrompts({
|
|
147
|
-
cursor: promptsResult.nextCursor
|
|
148
|
-
});
|
|
149
|
-
promptsAgg = promptsAgg.concat(promptsResult.prompts);
|
|
150
|
-
} while (promptsResult.nextCursor);
|
|
151
|
-
return promptsAgg;
|
|
152
|
-
}
|
|
153
|
-
async fetchResourceTemplates() {
|
|
154
|
-
let templatesAgg = [];
|
|
155
|
-
let templatesResult = {
|
|
156
|
-
resourceTemplates: []
|
|
157
|
-
};
|
|
158
|
-
do {
|
|
159
|
-
templatesResult = await this.client.listResourceTemplates({
|
|
160
|
-
cursor: templatesResult.nextCursor
|
|
161
|
-
});
|
|
162
|
-
templatesAgg = templatesAgg.concat(templatesResult.resourceTemplates);
|
|
163
|
-
} while (templatesResult.nextCursor);
|
|
164
|
-
return templatesAgg;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/mcp/client.ts
|
|
169
|
-
var MCPClientManager = class {
|
|
170
|
-
constructor() {
|
|
171
|
-
this.mcpConnections = {};
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Connect to and register an MCP server
|
|
175
|
-
*
|
|
176
|
-
* @param transportConfig Transport config
|
|
177
|
-
* @param clientConfig Client config
|
|
178
|
-
* @param capabilities Client capabilities (i.e. if the client supports roots/sampling)
|
|
179
|
-
*/
|
|
180
|
-
async connectToServer(url, info, opts = { transport: {}, client: {}, capabilities: {} }) {
|
|
181
|
-
if (info.name in this.mcpConnections) {
|
|
182
|
-
throw new Error(
|
|
183
|
-
`An existing MCP client has already been registered under the name "${info.name}". The MCP client name must be unique.`
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
this.mcpConnections[info.name] = new MCPClientConnection(url, info, opts);
|
|
187
|
-
await this.mcpConnections[info.name].init();
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* @returns namespaced list of tools
|
|
191
|
-
*/
|
|
192
|
-
listTools() {
|
|
193
|
-
return getNamespacedData(this.mcpConnections, "tools");
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @returns namespaced list of prompts
|
|
197
|
-
*/
|
|
198
|
-
listPrompts() {
|
|
199
|
-
return getNamespacedData(this.mcpConnections, "prompts");
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @returns namespaced list of tools
|
|
203
|
-
*/
|
|
204
|
-
listResources() {
|
|
205
|
-
return getNamespacedData(this.mcpConnections, "resources");
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* @returns namespaced list of resource templates
|
|
209
|
-
*/
|
|
210
|
-
listResourceTemplates() {
|
|
211
|
-
return getNamespacedData(this.mcpConnections, "resourceTemplates");
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Namespaced version of callTool
|
|
215
|
-
*/
|
|
216
|
-
callTool(params, resultSchema, options) {
|
|
217
|
-
const unqualifiedName = params.name.replace(`${params.serverName}.`, "");
|
|
218
|
-
return this.mcpConnections[params.serverName].client.callTool(
|
|
219
|
-
{
|
|
220
|
-
...params,
|
|
221
|
-
name: unqualifiedName
|
|
222
|
-
},
|
|
223
|
-
resultSchema,
|
|
224
|
-
options
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Namespaced version of readResource
|
|
229
|
-
*/
|
|
230
|
-
readResource(params, options) {
|
|
231
|
-
return this.mcpConnections[params.serverName].client.readResource(
|
|
232
|
-
params,
|
|
233
|
-
options
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Namespaced version of getPrompt
|
|
238
|
-
*/
|
|
239
|
-
getPrompt(params, options) {
|
|
240
|
-
return this.mcpConnections[params.serverName].client.getPrompt(
|
|
241
|
-
params,
|
|
242
|
-
options
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
function getNamespacedData(mcpClients, type) {
|
|
247
|
-
const sets = Object.entries(mcpClients).map(([name, conn]) => {
|
|
248
|
-
return { name, data: conn[type] };
|
|
249
|
-
});
|
|
250
|
-
const namespacedData = sets.flatMap(({ name: serverName, data }) => {
|
|
251
|
-
return data.map((item) => {
|
|
252
|
-
return {
|
|
253
|
-
...item,
|
|
254
|
-
// we add a servername so we can easily pull it out and convert between qualified<->unqualified name
|
|
255
|
-
// just in case the server name or item name includes a "."
|
|
256
|
-
serverName: `${serverName}`,
|
|
257
|
-
// qualified name
|
|
258
|
-
name: `${serverName}.${item.name}`
|
|
259
|
-
};
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
return namespacedData;
|
|
263
|
-
}
|
|
2
|
+
MCPClientManager,
|
|
3
|
+
getNamespacedData
|
|
4
|
+
} from "../chunk-Q5ZBHY4Z.js";
|
|
5
|
+
import "../chunk-HMLY7DHA.js";
|
|
264
6
|
export {
|
|
265
7
|
MCPClientManager,
|
|
266
8
|
getNamespacedData
|
package/dist/mcp/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/sse-edge.ts","../../src/mcp/client-connection.ts","../../src/mcp/client.ts"],"sourcesContent":["import {\n SSEClientTransport,\n type SSEClientTransportOptions,\n} from \"@modelcontextprotocol/sdk/client/sse.js\";\n\nexport class SSEEdgeClientTransport extends SSEClientTransport {\n /**\n * Creates a new EdgeSSEClientTransport, which overrides fetch to be compatible with the CF workers environment\n */\n constructor(\n private url: URL,\n options: SSEClientTransportOptions\n ) {\n // biome-ignore lint/suspicious/noExplicitAny: Overriding fetch, type doesn't matter here\n const fetchOverride = (url: any, options = {}) => {\n const workerOptions = {\n ...options,\n };\n // Remove unsupported properties\n // @ts-ignore\n // biome-ignore lint/performance/noDelete: workaround for workers environment\n delete workerOptions.mode;\n\n // Call the original fetch with fixed options\n return global.fetch(url, workerOptions);\n };\n\n super(url, {\n ...options,\n eventSourceInit: {\n fetch: fetchOverride,\n },\n });\n }\n}\n","import { SSEEdgeClientTransport } from \"./sse-edge\";\n\nimport {\n ToolListChangedNotificationSchema,\n type ClientCapabilities,\n type Resource,\n type Tool,\n type Prompt,\n ResourceListChangedNotificationSchema,\n PromptListChangedNotificationSchema,\n type ListToolsResult,\n type ListResourcesResult,\n type ListPromptsResult,\n type ServerCapabilities,\n type ResourceTemplate,\n type ListResourceTemplatesResult,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport type {\n SSEClientTransport,\n SSEClientTransportOptions,\n} from \"@modelcontextprotocol/sdk/client/sse.js\";\n\nexport class MCPClientConnection {\n client: Client;\n transport: SSEClientTransport;\n connected: boolean;\n instructions?: string;\n tools: Tool[];\n prompts: Prompt[];\n resources: Resource[];\n resourceTemplates: ResourceTemplate[];\n serverCapabilities: ServerCapabilities | undefined;\n\n constructor(\n url: URL,\n private info: ConstructorParameters<typeof Client>[0],\n opts: {\n transport: SSEClientTransportOptions;\n client: ConstructorParameters<typeof Client>[1];\n capabilities: ClientCapabilities;\n } = { transport: {}, client: {}, capabilities: {} }\n ) {\n this.transport = new SSEEdgeClientTransport(url, opts.transport);\n this.client = new Client(info, opts.client);\n this.client.registerCapabilities(opts.capabilities);\n this.connected = false;\n this.tools = [];\n this.prompts = [];\n this.resources = [];\n this.resourceTemplates = [];\n }\n\n async init() {\n await this.client.connect(this.transport);\n\n this.serverCapabilities = await this.client.getServerCapabilities();\n if (!this.serverCapabilities) {\n throw new Error(\n `The MCP Server ${this.info.name} failed to return server capabilities`\n );\n }\n\n const [instructions, tools, resources, prompts, resourceTemplates] =\n await Promise.all([\n this.client.getInstructions(),\n this.registerTools(),\n this.registerResources(),\n this.registerPrompts(),\n this.registerResourceTemplates(),\n ]);\n\n this.instructions = instructions;\n this.tools = tools;\n this.resources = resources;\n this.prompts = prompts;\n this.resourceTemplates = resourceTemplates;\n }\n\n /**\n * Notification handler registration\n */\n async registerTools(): Promise<Tool[]> {\n if (!this.serverCapabilities || !this.serverCapabilities.tools) {\n return [];\n }\n\n if (this.serverCapabilities.tools.listChanged) {\n this.client.setNotificationHandler(\n ToolListChangedNotificationSchema,\n async (_notification) => {\n this.tools = await this.fetchTools();\n }\n );\n }\n\n return this.fetchTools();\n }\n\n async registerResources(): Promise<Resource[]> {\n if (!this.serverCapabilities || !this.serverCapabilities.resources) {\n return [];\n }\n\n if (this.serverCapabilities.resources.listChanged) {\n this.client.setNotificationHandler(\n ResourceListChangedNotificationSchema,\n async (_notification) => {\n this.resources = await this.fetchResources();\n }\n );\n }\n\n return this.fetchResources();\n }\n\n async registerPrompts(): Promise<Prompt[]> {\n if (!this.serverCapabilities || !this.serverCapabilities.prompts) {\n return [];\n }\n\n if (this.serverCapabilities.prompts.listChanged) {\n this.client.setNotificationHandler(\n PromptListChangedNotificationSchema,\n async (_notification) => {\n this.prompts = await this.fetchPrompts();\n }\n );\n }\n\n return this.fetchPrompts();\n }\n\n async registerResourceTemplates(): Promise<ResourceTemplate[]> {\n if (!this.serverCapabilities || !this.serverCapabilities.resources) {\n return [];\n }\n\n return this.fetchResourceTemplates();\n }\n\n async fetchTools() {\n let toolsAgg: Tool[] = [];\n let toolsResult: ListToolsResult = { tools: [] };\n do {\n toolsResult = await this.client.listTools({\n cursor: toolsResult.nextCursor,\n });\n toolsAgg = toolsAgg.concat(toolsResult.tools);\n } while (toolsResult.nextCursor);\n return toolsAgg;\n }\n\n async fetchResources() {\n let resourcesAgg: Resource[] = [];\n let resourcesResult: ListResourcesResult = { resources: [] };\n do {\n resourcesResult = await this.client.listResources({\n cursor: resourcesResult.nextCursor,\n });\n resourcesAgg = resourcesAgg.concat(resourcesResult.resources);\n } while (resourcesResult.nextCursor);\n return resourcesAgg;\n }\n\n async fetchPrompts() {\n let promptsAgg: Prompt[] = [];\n let promptsResult: ListPromptsResult = { prompts: [] };\n do {\n promptsResult = await this.client.listPrompts({\n cursor: promptsResult.nextCursor,\n });\n promptsAgg = promptsAgg.concat(promptsResult.prompts);\n } while (promptsResult.nextCursor);\n return promptsAgg;\n }\n\n async fetchResourceTemplates() {\n let templatesAgg: ResourceTemplate[] = [];\n let templatesResult: ListResourceTemplatesResult = {\n resourceTemplates: [],\n };\n do {\n templatesResult = await this.client.listResourceTemplates({\n cursor: templatesResult.nextCursor,\n });\n templatesAgg = templatesAgg.concat(templatesResult.resourceTemplates);\n } while (templatesResult.nextCursor);\n return templatesAgg;\n }\n}\n","import { MCPClientConnection } from \"./client-connection\";\n\nimport type {\n ClientCapabilities,\n CallToolRequest,\n CallToolResultSchema,\n CompatibilityCallToolResultSchema,\n ReadResourceRequest,\n GetPromptRequest,\n Tool,\n Resource,\n ResourceTemplate,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { SSEClientTransportOptions } from \"@modelcontextprotocol/sdk/client/sse.js\";\nimport type { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport type { RequestOptions } from \"@modelcontextprotocol/sdk/shared/protocol.js\";\n\n/**\n * Utility class that aggregates multiple MCP clients into one\n */\nexport class MCPClientManager {\n public mcpConnections: Record<string, MCPClientConnection> = {};\n\n /**\n * Connect to and register an MCP server\n *\n * @param transportConfig Transport config\n * @param clientConfig Client config\n * @param capabilities Client capabilities (i.e. if the client supports roots/sampling)\n */\n async connectToServer(\n url: URL,\n info: ConstructorParameters<typeof Client>[0],\n opts: {\n transport: SSEClientTransportOptions;\n client: ConstructorParameters<typeof Client>[1];\n capabilities: ClientCapabilities;\n } = { transport: {}, client: {}, capabilities: {} }\n ) {\n if (info.name in this.mcpConnections) {\n throw new Error(\n `An existing MCP client has already been registered under the name \"${info.name}\". The MCP client name must be unique.`\n );\n }\n\n this.mcpConnections[info.name] = new MCPClientConnection(url, info, opts);\n await this.mcpConnections[info.name].init();\n }\n\n /**\n * @returns namespaced list of tools\n */\n listTools(): NamespacedData[\"tools\"] {\n return getNamespacedData(this.mcpConnections, \"tools\");\n }\n\n /**\n * @returns namespaced list of prompts\n */\n listPrompts(): NamespacedData[\"prompts\"] {\n return getNamespacedData(this.mcpConnections, \"prompts\");\n }\n\n /**\n * @returns namespaced list of tools\n */\n listResources(): NamespacedData[\"resources\"] {\n return getNamespacedData(this.mcpConnections, \"resources\");\n }\n\n /**\n * @returns namespaced list of resource templates\n */\n listResourceTemplates(): NamespacedData[\"resourceTemplates\"] {\n return getNamespacedData(this.mcpConnections, \"resourceTemplates\");\n }\n\n /**\n * Namespaced version of callTool\n */\n callTool(\n params: CallToolRequest[\"params\"] & { serverName: string },\n resultSchema:\n | typeof CallToolResultSchema\n | typeof CompatibilityCallToolResultSchema,\n options: RequestOptions\n ) {\n const unqualifiedName = params.name.replace(`${params.serverName}.`, \"\");\n return this.mcpConnections[params.serverName].client.callTool(\n {\n ...params,\n name: unqualifiedName,\n },\n resultSchema,\n options\n );\n }\n\n /**\n * Namespaced version of readResource\n */\n readResource(\n params: ReadResourceRequest[\"params\"] & { serverName: string },\n options: RequestOptions\n ) {\n return this.mcpConnections[params.serverName].client.readResource(\n params,\n options\n );\n }\n\n /**\n * Namespaced version of getPrompt\n */\n getPrompt(\n params: GetPromptRequest[\"params\"] & { serverName: string },\n options: RequestOptions\n ) {\n return this.mcpConnections[params.serverName].client.getPrompt(\n params,\n options\n );\n }\n}\n\ntype NamespacedData = {\n tools: (Tool & { serverName: string })[];\n prompts: (Prompt & { serverName: string })[];\n resources: (Resource & { serverName: string })[];\n resourceTemplates: (ResourceTemplate & { serverName: string })[];\n};\n\nexport function getNamespacedData<T extends keyof NamespacedData>(\n mcpClients: Record<string, MCPClientConnection>,\n type: T\n): NamespacedData[T] {\n const sets = Object.entries(mcpClients).map(([name, conn]) => {\n return { name, data: conn[type] };\n });\n\n const namespacedData = sets.flatMap(({ name: serverName, data }) => {\n return data.map((item) => {\n return {\n ...item,\n // we add a servername so we can easily pull it out and convert between qualified<->unqualified name\n // just in case the server name or item name includes a \".\"\n serverName: `${serverName}`,\n // qualified name\n name: `${serverName}.${item.name}`,\n };\n });\n });\n\n return namespacedData as NamespacedData[T]; // Type assertion needed due to TS limitations with conditional return types\n}\n"],"mappings":";;;AAAA;AAAA,EACE;AAAA,OAEK;AAEA,IAAM,yBAAN,cAAqC,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAI7D,YACU,KACR,SACA;AAEA,UAAM,gBAAgB,CAACA,MAAUC,WAAU,CAAC,MAAM;AAChD,YAAM,gBAAgB;AAAA,QACpB,GAAGA;AAAA,MACL;AAIA,aAAO,cAAc;AAGrB,aAAO,OAAO,MAAMD,MAAK,aAAa;AAAA,IACxC;AAEA,UAAM,KAAK;AAAA,MACT,GAAG;AAAA,MACH,iBAAiB;AAAA,QACf,OAAO;AAAA,MACT;AAAA,IACF,CAAC;AAtBO;AAAA,EAuBV;AACF;;;AChCA;AAAA,EACE;AAAA,EAKA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,cAAc;AAMhB,IAAM,sBAAN,MAA0B;AAAA,EAW/B,YACE,KACQ,MACR,OAII,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,GAAG,cAAc,CAAC,EAAE,GAClD;AANQ;AAOR,SAAK,YAAY,IAAI,uBAAuB,KAAK,KAAK,SAAS;AAC/D,SAAK,SAAS,IAAI,OAAO,MAAM,KAAK,MAAM;AAC1C,SAAK,OAAO,qBAAqB,KAAK,YAAY;AAClD,SAAK,YAAY;AACjB,SAAK,QAAQ,CAAC;AACd,SAAK,UAAU,CAAC;AAChB,SAAK,YAAY,CAAC;AAClB,SAAK,oBAAoB,CAAC;AAAA,EAC5B;AAAA,EAEA,MAAM,OAAO;AACX,UAAM,KAAK,OAAO,QAAQ,KAAK,SAAS;AAExC,SAAK,qBAAqB,MAAM,KAAK,OAAO,sBAAsB;AAClE,QAAI,CAAC,KAAK,oBAAoB;AAC5B,YAAM,IAAI;AAAA,QACR,kBAAkB,KAAK,KAAK,IAAI;AA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