@opentiny/next-sdk 0.1.13 → 0.1.14-alpha.0

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.
Files changed (62) hide show
  1. package/agent/AgentModelProvider.ts +49 -20
  2. package/agent/type.ts +4 -4
  3. package/dist/McpSdk.d.ts +14 -0
  4. package/dist/WebAgent.d.ts +5 -0
  5. package/dist/WebMcp.d.ts +20 -0
  6. package/dist/WebMcpClient.d.ts +250 -1488
  7. package/dist/WebMcpServer.d.ts +190 -78
  8. package/dist/Zod.d.ts +1 -0
  9. package/dist/agent/AgentModelProvider.d.ts +6 -4
  10. package/dist/agent/type.d.ts +6 -2
  11. package/dist/agent/utils/getAISDKTools.d.ts +1 -0
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.es.dev.js +23743 -25868
  14. package/dist/index.es.js +24524 -24312
  15. package/dist/index.js +1789 -25
  16. package/dist/index.umd.dev.js +23845 -25970
  17. package/dist/index.umd.js +185 -129
  18. package/dist/{mcpsdk@1.20.1.dev.js → mcpsdk@1.23.0.dev.js} +13535 -14184
  19. package/dist/{mcpsdk@1.20.1.es.dev.js → mcpsdk@1.23.0.es.dev.js} +13563 -14212
  20. package/dist/mcpsdk@1.23.0.es.js +15584 -0
  21. package/dist/mcpsdk@1.23.0.js +43 -0
  22. package/dist/remoter/createRemoter.d.ts +9 -0
  23. package/dist/remoter/tooltips.d.ts +36 -0
  24. package/dist/script/utils.d.ts +1 -0
  25. package/dist/transport/ExtensionClientTransport.d.ts +3 -2
  26. package/dist/transport/ExtensionContentServerTransport.d.ts +3 -2
  27. package/dist/transport/ExtensionPageServerTransport.d.ts +3 -2
  28. package/dist/vite-build-tsc.d.ts +2 -0
  29. package/dist/vite.config.d.ts +2 -0
  30. package/dist/vite.config.mcpSdk.d.ts +2 -0
  31. package/dist/vite.config.webAgent.d.ts +2 -0
  32. package/dist/vite.config.webMcp.d.ts +2 -0
  33. package/dist/vite.config.webMcpFull.d.ts +2 -0
  34. package/dist/vite.config.zod.d.ts +2 -0
  35. package/dist/webagent.dev.js +18803 -18836
  36. package/dist/webagent.es.dev.js +17726 -17759
  37. package/dist/webagent.es.js +22571 -20829
  38. package/dist/webagent.js +172 -109
  39. package/dist/webmcp-full.dev.js +14463 -15009
  40. package/dist/webmcp-full.es.dev.js +14471 -15017
  41. package/dist/webmcp-full.es.js +13391 -12365
  42. package/dist/webmcp-full.js +43 -16
  43. package/package.json +3 -2
  44. package/remoter/createRemoter.ts +126 -71
  45. package/remoter/tooltips.ts +260 -0
  46. package/tsconfig.json +5 -3
  47. package/vite-build-tsc.ts +60 -0
  48. package/vite-env.d.ts +5 -0
  49. package/dist/WebMcpClient.js +0 -363
  50. package/dist/WebMcpServer.js +0 -283
  51. package/dist/agent/AgentModelProvider.js +0 -293
  52. package/dist/agent/type.js +0 -1
  53. package/dist/agent/utils/getAISDKTools.js +0 -36
  54. package/dist/mcpsdk@1.20.1.es.js +0 -14600
  55. package/dist/mcpsdk@1.20.1.js +0 -16
  56. package/dist/remoter/QrCode.js +0 -55
  57. package/dist/remoter/createRemoter.js +0 -743
  58. package/dist/transport/ExtensionClientTransport.js +0 -81
  59. package/dist/transport/ExtensionContentServerTransport.js +0 -128
  60. package/dist/transport/ExtensionPageServerTransport.js +0 -118
  61. package/dist/transport/messages.js +0 -51
  62. package/dist/utils/uuid.js +0 -10
@@ -1,13 +1,11 @@
1
1
  import { MessageChannelServerTransport } from '@opentiny/next';
2
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import { z, ZodObject, ZodLiteral, ZodType, ZodOptional } from 'zod';
4
- import { SetLevelRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ListResourcesRequestSchema, RootsListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
5
- import type { ToolCallback, RegisteredTool, PromptCallback, RegisteredPrompt, ResourceMetadata, ResourceTemplate, RegisteredResource, ReadResourceCallback, RegisteredResourceTemplate, ReadResourceTemplateCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
6
- import type { Result, Request, Notification, Implementation, ToolAnnotations, ClientCapabilities, ElicitResult, ElicitRequest, ListRootsRequest, CreateMessageRequest, LoggingMessageNotification, ResourceUpdatedNotification } from '@modelcontextprotocol/sdk/types.js';
7
- import type { ZodRawShape, ZodTypeDef } from 'zod';
8
- import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
9
- import type { ServerOptions } from '@modelcontextprotocol/sdk/server/index.js';
10
- import type { RequestOptions, NotificationOptions, RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
2
+ import { McpServer, ToolCallback, RegisteredTool, PromptCallback, RegisteredPrompt, ResourceMetadata, ResourceTemplate, RegisteredResource, ReadResourceCallback, RegisteredResourceTemplate, ReadResourceTemplateCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { z, ZodObject, ZodLiteral, ZodType, ZodOptional, ZodRawShape, ZodTypeDef } from 'zod';
4
+ import { SetLevelRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, ListResourcesRequestSchema, RootsListChangedNotificationSchema, Result, Request, Notification, Implementation, ToolAnnotations, ClientCapabilities, ElicitResult, ElicitRequest, ListRootsRequest, CreateMessageRequest, LoggingMessageNotification, ResourceUpdatedNotification } from '@modelcontextprotocol/sdk/types.js';
5
+ import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
6
+ import { ServerOptions } from '@modelcontextprotocol/sdk/server/index.js';
7
+ import { RequestOptions, NotificationOptions, RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
8
+
11
9
  type PromptArgsRawShape = {
12
10
  [k: string]: ZodType<string, ZodTypeDef, string> | ZodOptional<ZodType<string, ZodTypeDef, string>>;
13
11
  };
@@ -100,61 +98,183 @@ export declare class WebMcpServer {
100
98
  * Sends a ping to the client to check if it is still connected.
101
99
  */
102
100
  ping(): Promise<{
103
- _meta?: import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough"> | undefined;
101
+ _meta?: Record<string, unknown> | undefined;
104
102
  }>;
105
103
  /**
106
104
  * Creates a LLM message to be sent to the client.
107
105
  */
108
- createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise<z.objectOutputType<{
109
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
110
- } & {
111
- model: import("zod").ZodString;
112
- stopReason: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodEnum<["endTurn", "stopSequence", "maxTokens"]>, import("zod").ZodString]>>;
113
- role: import("zod").ZodEnum<["user", "assistant"]>;
114
- content: import("zod").ZodDiscriminatedUnion<"type", [import("zod").ZodObject<{
115
- type: import("zod").ZodLiteral<"text">;
116
- text: import("zod").ZodString;
117
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
118
- }, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
119
- type: import("zod").ZodLiteral<"text">;
120
- text: import("zod").ZodString;
121
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
122
- }, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
123
- type: import("zod").ZodLiteral<"text">;
124
- text: import("zod").ZodString;
125
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
126
- }, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
127
- type: import("zod").ZodLiteral<"image">;
128
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
129
- mimeType: import("zod").ZodString;
130
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
131
- }, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
132
- type: import("zod").ZodLiteral<"image">;
133
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
134
- mimeType: import("zod").ZodString;
135
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
136
- }, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
137
- type: import("zod").ZodLiteral<"image">;
138
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
139
- mimeType: import("zod").ZodString;
140
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
141
- }, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
142
- type: import("zod").ZodLiteral<"audio">;
143
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
144
- mimeType: import("zod").ZodString;
145
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
146
- }, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
147
- type: import("zod").ZodLiteral<"audio">;
148
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
149
- mimeType: import("zod").ZodString;
150
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
151
- }, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
152
- type: import("zod").ZodLiteral<"audio">;
153
- data: import("zod").ZodEffects<import("zod").ZodString, string, string>;
154
- mimeType: import("zod").ZodString;
155
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
156
- }, import("zod").ZodTypeAny, "passthrough">>]>;
157
- }, z.ZodTypeAny, "passthrough">>;
106
+ createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise<{
107
+ [x: string]: unknown;
108
+ model: string;
109
+ role: "user" | "assistant";
110
+ content: {
111
+ type: "text";
112
+ text: string;
113
+ _meta?: Record<string, unknown> | undefined;
114
+ } | {
115
+ type: "image";
116
+ data: string;
117
+ mimeType: string;
118
+ _meta?: Record<string, unknown> | undefined;
119
+ } | {
120
+ type: "audio";
121
+ data: string;
122
+ mimeType: string;
123
+ _meta?: Record<string, unknown> | undefined;
124
+ } | {
125
+ [x: string]: unknown;
126
+ type: "tool_use";
127
+ name: string;
128
+ id: string;
129
+ input: {
130
+ [x: string]: unknown;
131
+ };
132
+ _meta?: {
133
+ [x: string]: unknown;
134
+ } | undefined;
135
+ } | {
136
+ [x: string]: unknown;
137
+ type: "tool_result";
138
+ toolUseId: string;
139
+ content: ({
140
+ type: "text";
141
+ text: string;
142
+ _meta?: Record<string, unknown> | undefined;
143
+ } | {
144
+ type: "image";
145
+ data: string;
146
+ mimeType: string;
147
+ _meta?: Record<string, unknown> | undefined;
148
+ } | {
149
+ type: "audio";
150
+ data: string;
151
+ mimeType: string;
152
+ _meta?: Record<string, unknown> | undefined;
153
+ } | {
154
+ type: "resource";
155
+ resource: {
156
+ uri: string;
157
+ text: string;
158
+ mimeType?: string | undefined;
159
+ _meta?: Record<string, unknown> | undefined;
160
+ } | {
161
+ uri: string;
162
+ blob: string;
163
+ mimeType?: string | undefined;
164
+ _meta?: Record<string, unknown> | undefined;
165
+ };
166
+ _meta?: Record<string, unknown> | undefined;
167
+ } | {
168
+ uri: string;
169
+ name: string;
170
+ type: "resource_link";
171
+ description?: string | undefined;
172
+ mimeType?: string | undefined;
173
+ _meta?: {
174
+ [x: string]: unknown;
175
+ } | undefined;
176
+ icons?: {
177
+ src: string;
178
+ mimeType?: string | undefined;
179
+ sizes?: string[] | undefined;
180
+ }[] | undefined;
181
+ title?: string | undefined;
182
+ })[];
183
+ structuredContent?: {
184
+ [x: string]: unknown;
185
+ } | undefined;
186
+ isError?: boolean | undefined;
187
+ _meta?: {
188
+ [x: string]: unknown;
189
+ } | undefined;
190
+ } | ({
191
+ type: "text";
192
+ text: string;
193
+ _meta?: Record<string, unknown> | undefined;
194
+ } | {
195
+ type: "image";
196
+ data: string;
197
+ mimeType: string;
198
+ _meta?: Record<string, unknown> | undefined;
199
+ } | {
200
+ type: "audio";
201
+ data: string;
202
+ mimeType: string;
203
+ _meta?: Record<string, unknown> | undefined;
204
+ } | {
205
+ [x: string]: unknown;
206
+ type: "tool_use";
207
+ name: string;
208
+ id: string;
209
+ input: {
210
+ [x: string]: unknown;
211
+ };
212
+ _meta?: {
213
+ [x: string]: unknown;
214
+ } | undefined;
215
+ } | {
216
+ [x: string]: unknown;
217
+ type: "tool_result";
218
+ toolUseId: string;
219
+ content: ({
220
+ type: "text";
221
+ text: string;
222
+ _meta?: Record<string, unknown> | undefined;
223
+ } | {
224
+ type: "image";
225
+ data: string;
226
+ mimeType: string;
227
+ _meta?: Record<string, unknown> | undefined;
228
+ } | {
229
+ type: "audio";
230
+ data: string;
231
+ mimeType: string;
232
+ _meta?: Record<string, unknown> | undefined;
233
+ } | {
234
+ type: "resource";
235
+ resource: {
236
+ uri: string;
237
+ text: string;
238
+ mimeType?: string | undefined;
239
+ _meta?: Record<string, unknown> | undefined;
240
+ } | {
241
+ uri: string;
242
+ blob: string;
243
+ mimeType?: string | undefined;
244
+ _meta?: Record<string, unknown> | undefined;
245
+ };
246
+ _meta?: Record<string, unknown> | undefined;
247
+ } | {
248
+ uri: string;
249
+ name: string;
250
+ type: "resource_link";
251
+ description?: string | undefined;
252
+ mimeType?: string | undefined;
253
+ _meta? /**
254
+ * Registers a handler to invoke when this protocol object receives a notification with the given method.
255
+ *
256
+ * Note that this will replace any previous notification handler for the same method.
257
+ */: {
258
+ [x: string]: unknown;
259
+ } | undefined;
260
+ icons?: {
261
+ src: string;
262
+ mimeType?: string | undefined;
263
+ sizes?: string[] | undefined;
264
+ }[] | undefined;
265
+ title?: string | undefined;
266
+ })[];
267
+ structuredContent?: {
268
+ [x: string]: unknown;
269
+ } | undefined;
270
+ isError?: boolean | undefined;
271
+ _meta?: {
272
+ [x: string]: unknown;
273
+ } | undefined;
274
+ })[];
275
+ _meta?: Record<string, unknown> | undefined;
276
+ stopReason?: string | undefined;
277
+ }>;
158
278
  /**
159
279
  * Elicits input from the client, such as a prompt or resource.
160
280
  */
@@ -162,23 +282,15 @@ export declare class WebMcpServer {
162
282
  /**
163
283
  * Lists the root resources available to the client.
164
284
  */
165
- listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<z.objectOutputType<{
166
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
167
- } & {
168
- roots: import("zod").ZodArray<import("zod").ZodObject<{
169
- uri: import("zod").ZodString;
170
- name: import("zod").ZodOptional<import("zod").ZodString>;
171
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
172
- }, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
173
- uri: import("zod").ZodString;
174
- name: import("zod").ZodOptional<import("zod").ZodString>;
175
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
176
- }, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
177
- uri: import("zod").ZodString;
178
- name: import("zod").ZodOptional<import("zod").ZodString>;
179
- _meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
180
- }, import("zod").ZodTypeAny, "passthrough">>, "many">;
181
- }, z.ZodTypeAny, "passthrough">>;
285
+ listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<{
286
+ [x: string]: unknown;
287
+ roots: {
288
+ uri: string;
289
+ name?: string | undefined;
290
+ _meta?: Record<string, unknown> | undefined;
291
+ }[];
292
+ _meta?: Record<string, unknown> | undefined;
293
+ }>;
182
294
  /**
183
295
  * Sends a logging message to the client.
184
296
  */
@@ -253,7 +365,7 @@ export declare const createMessageChannelServerTransport: (endpoint: string, glo
253
365
  /**
254
366
  * Creates a pair of transports for communication between a server and client using MessageChannel.
255
367
  */
256
- export declare const createMessageChannelPairTransport: () => [import("@opentiny/next").MessageChannelTransport, import("@opentiny/next").MessageChannelTransport];
368
+ export declare const createMessageChannelPairTransport: () => [import('@opentiny/next').MessageChannelTransport, import('@opentiny/next').MessageChannelTransport];
257
369
  /**
258
370
  * Checks if the transport is a MessageChannelServerTransport.
259
371
  */
package/dist/Zod.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { z } from 'zod';
@@ -1,10 +1,10 @@
1
1
  import { streamText, generateText } from 'ai';
2
- import type { IAgentModelProviderOption, McpServerConfig } from './type';
2
+ import { IAgentModelProviderOption, McpServerConfig } from './type';
3
3
  import { ProviderV2 } from '@ai-sdk/provider';
4
- import { OpenAIProvider } from '@ai-sdk/openai';
5
- import { createOpenAI } from '@ai-sdk/openai';
4
+ import { OpenAIProvider, createOpenAI } from '@ai-sdk/openai';
6
5
  import { createDeepSeek } from '@ai-sdk/deepseek';
7
6
  import { WebMcpClient } from '../WebMcpClient';
7
+
8
8
  export declare const AIProviderFactories: {
9
9
  openai: typeof createOpenAI;
10
10
  deepseek: typeof createDeepSeek;
@@ -39,6 +39,8 @@ export declare class AgentModelProvider {
39
39
  private _closeOneClient;
40
40
  /** 创建所有 mcpClients */
41
41
  private _createMpcClients;
42
+ /** 兼容两种 client 类型的 tools 获取方法 */
43
+ private _getClientTools;
42
44
  /** 查询所有 mcpClients 的 tools, 失败则保存为null */
43
45
  private _createMpcTools;
44
46
  /** 关闭所有的 clients */
@@ -48,7 +50,7 @@ export declare class AgentModelProvider {
48
50
  /** 全量更新所有的 mcpServers */
49
51
  updateMcpServers(mcpServers?: Record<string, McpServerConfig>): Promise<void>;
50
52
  /** 插入一个新的mcpServer,如果已经存在则返回false */
51
- insertMcpServer(serverName: string, mcpServer: McpServerConfig): Promise<false | WebMcpClient | null>;
53
+ insertMcpServer(serverName: string, mcpServer: McpServerConfig): Promise<false | WebMcpClient | import('ai').experimental_MCPClient | null>;
52
54
  /** 通过服务器名称删除mcpServer: mcpServers mcpClients mcpTools ignoreToolnames */
53
55
  removeMcpServer(serverName: string): Promise<void>;
54
56
  /** 创建临时允许调用的tools集合 */
@@ -1,6 +1,6 @@
1
+ import { ProviderV2 } from '@ai-sdk/provider';
2
+ import { MCPTransport } from 'ai';
1
3
  export type { experimental_MCPClient as MCPClient } from 'ai';
2
- import type { ProviderV2 } from '@ai-sdk/provider';
3
- import type { MCPTransport } from 'ai';
4
4
  type ProviderFactory = 'openai' | 'deepseek' | ((options: any) => ProviderV2);
5
5
  type LlmFactoryConfig = {
6
6
  /** API密钥 */
@@ -26,15 +26,19 @@ export type IAgentModelProviderLlmConfig = LlmFactoryConfig | LlmInstanceConfig;
26
26
  export type McpServerConfig = {
27
27
  type: 'streamableHttp';
28
28
  url: string;
29
+ useAISdkClient?: boolean;
29
30
  } | {
30
31
  type: 'sse';
31
32
  url: string;
33
+ useAISdkClient?: boolean;
32
34
  } | {
33
35
  type: 'extension';
34
36
  url: string;
35
37
  sessionId: string;
38
+ useAISdkClient?: boolean;
36
39
  } | {
37
40
  transport: MCPTransport;
41
+ useAISdkClient?: boolean;
38
42
  };
39
43
  /** */
40
44
  export interface IAgentModelProviderOption {
@@ -1,5 +1,6 @@
1
1
  import { ToolSet } from 'ai';
2
2
  import { WebMcpClient } from '../../WebMcpClient';
3
+
3
4
  /**
4
5
  * 快速从官方 mcp 或 WebMcpClient 这2种client中读取 tools 数组,并转换成 ai-sdk 的tool的对象格式。
5
6
  * @params client 一个已连接好的 WebMcpClient
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import Ajv from 'ajv';
1
+ import { default as Ajv } from 'ajv';
2
+
2
3
  export { Ajv };
3
4
  export { z } from 'zod';
4
5
  export { AuthClientProvider } from '@opentiny/next';