eve 0.13.8 → 0.15.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 (237) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/src/channel/compiled-channel.js +2 -1
  3. package/dist/src/channel/routes.d.ts +5 -0
  4. package/dist/src/channel/send.js +1 -1
  5. package/dist/src/channel/types.d.ts +5 -0
  6. package/dist/src/cli/dev/tui/runner.js +1 -1
  7. package/dist/src/cli/dev/tui/setup-panel.d.ts +3 -4
  8. package/dist/src/cli/dev/tui/setup-panel.js +2 -2
  9. package/dist/src/cli/dev/tui/terminal-renderer.js +1 -1
  10. package/dist/src/compiled/.vendor-stamp.json +12 -8
  11. package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +2 -2
  12. package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
  13. package/dist/src/compiled/@ai-sdk/google/index.d.ts +25 -3
  14. package/dist/src/compiled/@ai-sdk/google/index.js +6 -6
  15. package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +647 -30
  16. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  17. package/dist/src/compiled/@ai-sdk/openai/index.d.ts +8 -2
  18. package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
  19. package/dist/src/compiled/@ai-sdk/otel/index.d.ts +165 -28
  20. package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
  21. package/dist/src/compiled/@ai-sdk/provider/index.d.ts +10 -2
  22. package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +2362 -0
  23. package/dist/src/compiled/@ai-sdk/provider-utils/index.js +1 -0
  24. package/dist/src/compiled/@workflow/serde/LICENSE.md +3 -0
  25. package/dist/src/compiled/@workflow/serde/index.d.ts +30 -0
  26. package/dist/src/compiled/@workflow/serde/index.js +1 -0
  27. package/dist/src/compiled/_chunks/workflow/{dist-C9PV_vnE.js → dist-D7CzPkf8.js} +1 -1
  28. package/dist/src/compiled/eventsource-parser/stream/LICENSE +21 -0
  29. package/dist/src/compiled/eventsource-parser/stream/index.d.ts +121 -0
  30. package/dist/src/compiled/eventsource-parser/stream/index.js +1 -0
  31. package/dist/src/compiled/experimental-ai-sdk-code-mode/approval-continuation.d.ts +7 -7
  32. package/dist/src/compiled/experimental-ai-sdk-code-mode/continuation-capability.d.ts +15 -4
  33. package/dist/src/compiled/experimental-ai-sdk-code-mode/index.d.ts +1 -1
  34. package/dist/src/compiled/experimental-ai-sdk-code-mode/index.js +15 -15
  35. package/dist/src/compiled/experimental-ai-sdk-code-mode/interrupt-continuation.d.ts +5 -5
  36. package/dist/src/compiled/experimental-ai-sdk-code-mode/runtime/protocol.d.ts +13 -2
  37. package/dist/src/compiled/experimental-ai-sdk-code-mode/types.d.ts +26 -0
  38. package/dist/src/compiled/json-schema/LICENSE +21 -0
  39. package/dist/src/compiled/json-schema/index.d.ts +749 -0
  40. package/dist/src/compiled/json-schema/index.js +1 -0
  41. package/dist/src/compiler/manifest.js +1 -1
  42. package/dist/src/compiler/normalize-agent-config.js +1 -1
  43. package/dist/src/context/build-dynamic-tools.js +1 -1
  44. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  45. package/dist/src/context/keys.d.ts +1 -1
  46. package/dist/src/evals/assertions/collector.d.ts +19 -6
  47. package/dist/src/evals/assertions/collector.js +1 -1
  48. package/dist/src/evals/assertions/run.d.ts +24 -17
  49. package/dist/src/evals/assertions/run.js +2 -2
  50. package/dist/src/evals/assertions/scoped.d.ts +17 -0
  51. package/dist/src/evals/assertions/scoped.js +1 -0
  52. package/dist/src/evals/context.d.ts +1 -0
  53. package/dist/src/evals/context.js +1 -1
  54. package/dist/src/evals/control-flow.d.ts +9 -0
  55. package/dist/src/evals/control-flow.js +1 -0
  56. package/dist/src/evals/define-eval.d.ts +1 -1
  57. package/dist/src/evals/define-eval.js +1 -1
  58. package/dist/src/evals/expect/index.d.ts +5 -3
  59. package/dist/src/evals/expect/index.js +1 -1
  60. package/dist/src/evals/index.d.ts +2 -2
  61. package/dist/src/evals/match.d.ts +50 -13
  62. package/dist/src/evals/match.js +1 -1
  63. package/dist/src/evals/runner/artifacts.js +1 -1
  64. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  65. package/dist/src/evals/runner/execute-eval.js +1 -1
  66. package/dist/src/evals/runner/execute-task.d.ts +1 -0
  67. package/dist/src/evals/runner/execute-task.js +1 -1
  68. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  69. package/dist/src/evals/runner/reporters/console.js +1 -1
  70. package/dist/src/evals/runner/reporters/junit.js +3 -2
  71. package/dist/src/evals/runner/run-evals.js +1 -1
  72. package/dist/src/evals/runner/verdict.d.ts +1 -0
  73. package/dist/src/evals/runner/verdict.js +1 -1
  74. package/dist/src/evals/session.d.ts +9 -5
  75. package/dist/src/evals/session.js +1 -1
  76. package/dist/src/evals/types.d.ts +69 -47
  77. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  78. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +12 -0
  79. package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -0
  80. package/dist/src/execution/next-driver-action.d.ts +1 -1
  81. package/dist/src/execution/node-step.js +1 -1
  82. package/dist/src/execution/session.js +3 -3
  83. package/dist/src/execution/turn-workflow.js +1 -1
  84. package/dist/src/execution/workflow-entry.js +1 -1
  85. package/dist/src/execution/workflow-runtime.d.ts +2 -11
  86. package/dist/src/execution/workflow-runtime.js +1 -1
  87. package/dist/src/execution/workflow-steps.d.ts +1 -1
  88. package/dist/src/execution/workflow-steps.js +1 -1
  89. package/dist/src/harness/action-result-helpers.d.ts +2 -2
  90. package/dist/src/harness/emission.d.ts +13 -27
  91. package/dist/src/harness/emission.js +1 -1
  92. package/dist/src/harness/execute-tool.d.ts +2 -2
  93. package/dist/src/harness/input-extraction.js +1 -1
  94. package/dist/src/harness/step-hooks.d.ts +3 -3
  95. package/dist/src/harness/step-hooks.js +1 -1
  96. package/dist/src/harness/tool-loop.js +1 -1
  97. package/dist/src/harness/tools.d.ts +4 -6
  98. package/dist/src/harness/tools.js +1 -1
  99. package/dist/src/harness/types.d.ts +4 -10
  100. package/dist/src/harness/workflow-continuation-security.d.ts +4 -0
  101. package/dist/src/harness/workflow-continuation-security.js +1 -0
  102. package/dist/src/harness/workflow-interrupt-state.d.ts +14 -0
  103. package/dist/src/harness/workflow-interrupt-state.js +1 -0
  104. package/dist/src/harness/workflow-lifecycle.d.ts +13 -0
  105. package/dist/src/harness/workflow-lifecycle.js +1 -0
  106. package/dist/src/harness/workflow-runtime-action-state.d.ts +9 -0
  107. package/dist/src/harness/workflow-runtime-action-state.js +1 -0
  108. package/dist/src/harness/workflow-sandbox.d.ts +22 -0
  109. package/dist/src/harness/workflow-sandbox.js +2 -0
  110. package/dist/src/harness/workflow-tool-description.d.ts +2 -2
  111. package/dist/src/harness/workflow-tool-description.js +16 -4
  112. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  113. package/dist/src/internal/application/package.d.ts +12 -0
  114. package/dist/src/internal/application/package.js +1 -1
  115. package/dist/src/internal/application/paths.d.ts +6 -0
  116. package/dist/src/internal/application/paths.js +1 -1
  117. package/dist/src/internal/authored-definition/connection.js +1 -1
  118. package/dist/src/internal/authored-definition/core.js +1 -1
  119. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  120. package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
  121. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  122. package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.d.ts +1 -0
  123. package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -0
  124. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
  125. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  126. package/dist/src/internal/workflow/configure-world.d.ts +6 -0
  127. package/dist/src/internal/workflow/configure-world.js +1 -1
  128. package/dist/src/internal/workflow/runtime.d.ts +1 -0
  129. package/dist/src/internal/workflow/world-compatibility.d.ts +32 -0
  130. package/dist/src/internal/workflow/world-compatibility.js +1 -0
  131. package/dist/src/protocol/message.d.ts +7 -5
  132. package/dist/src/public/channels/slack/attachments.js +1 -1
  133. package/dist/src/public/channels/slack/auth.d.ts +2 -0
  134. package/dist/src/public/channels/slack/auth.js +1 -1
  135. package/dist/src/public/channels/slack/defaults.js +2 -2
  136. package/dist/src/public/channels/slack/inbound.d.ts +4 -11
  137. package/dist/src/public/channels/slack/inbound.js +1 -2
  138. package/dist/src/public/channels/slack/model-context.d.ts +28 -0
  139. package/dist/src/public/channels/slack/model-context.js +3 -0
  140. package/dist/src/public/channels/slack/slackChannel.d.ts +8 -0
  141. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  142. package/dist/src/public/connections/index.d.ts +1 -1
  143. package/dist/src/public/definitions/agent.d.ts +1 -1
  144. package/dist/src/public/definitions/approval.d.ts +40 -0
  145. package/dist/src/public/definitions/approval.js +1 -0
  146. package/dist/src/public/definitions/connections/mcp.d.ts +11 -9
  147. package/dist/src/public/definitions/connections/mcp.js +1 -1
  148. package/dist/src/public/definitions/connections/openapi.d.ts +9 -7
  149. package/dist/src/public/definitions/connections/openapi.js +1 -1
  150. package/dist/src/public/definitions/tool.d.ts +7 -20
  151. package/dist/src/public/index.d.ts +1 -1
  152. package/dist/src/public/tools/approval/approval-helpers.d.ts +7 -7
  153. package/dist/src/public/tools/approval/approval-helpers.js +1 -1
  154. package/dist/src/public/tools/approval/index.d.ts +1 -1
  155. package/dist/src/public/tools/index.d.ts +2 -1
  156. package/dist/src/public/tools/internal.js +1 -1
  157. package/dist/src/runtime/actions/types.d.ts +10 -11
  158. package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
  159. package/dist/src/runtime/agent/bootstrap.js +1 -1
  160. package/dist/src/runtime/agent/mock-model-adapter.js +2 -3
  161. package/dist/src/runtime/connections/mcp-client.d.ts +3 -3
  162. package/dist/src/runtime/connections/mcp-client.js +1 -1
  163. package/dist/src/runtime/connections/registry.d.ts +2 -2
  164. package/dist/src/runtime/connections/resolve-authorization.d.ts +11 -0
  165. package/dist/src/runtime/connections/resolve-authorization.js +1 -0
  166. package/dist/src/runtime/connections/types.d.ts +27 -11
  167. package/dist/src/runtime/framework-tools/connection-search-dynamic.js +1 -1
  168. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  169. package/dist/src/runtime/resolve-agent.js +1 -1
  170. package/dist/src/runtime/resolve-connection.js +1 -1
  171. package/dist/src/runtime/resolve-tool.d.ts +1 -1
  172. package/dist/src/runtime/resolve-tool.js +1 -1
  173. package/dist/src/runtime/types.d.ts +8 -7
  174. package/dist/src/setup/boxes/resolve-provisioning.js +1 -1
  175. package/dist/src/setup/primitives/pm/pnpm.js +6 -5
  176. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  177. package/dist/src/setup/scaffold/create/project.js +2 -2
  178. package/dist/src/setup/scaffold/update/channels.js +1 -1
  179. package/dist/src/shared/agent-definition.d.ts +11 -13
  180. package/dist/src/shared/dynamic-tool-definition.d.ts +3 -3
  181. package/dist/src/shared/tool-definition.d.ts +1 -2
  182. package/dist/src/shared/workflow-sandbox.d.ts +37 -0
  183. package/dist/src/shared/workflow-sandbox.js +1 -0
  184. package/docs/agent-config.md +43 -13
  185. package/docs/channels/custom.mdx +2 -2
  186. package/docs/channels/slack.mdx +7 -13
  187. package/docs/concepts/execution-model-and-durability.md +1 -1
  188. package/docs/concepts/sessions-runs-and-streaming.md +1 -1
  189. package/docs/connections/mcp.mdx +2 -2
  190. package/docs/connections/openapi.mdx +37 -2
  191. package/docs/connections/overview.mdx +72 -2
  192. package/docs/evals/assertions.mdx +97 -39
  193. package/docs/evals/cases.mdx +24 -15
  194. package/docs/evals/judge.mdx +2 -2
  195. package/docs/evals/overview.mdx +7 -5
  196. package/docs/evals/reporters.mdx +2 -2
  197. package/docs/evals/running.mdx +3 -1
  198. package/docs/evals/targets.mdx +2 -2
  199. package/docs/guides/auth-and-route-protection.md +48 -1
  200. package/docs/guides/client/streaming.mdx +1 -1
  201. package/docs/guides/deployment.md +5 -4
  202. package/docs/guides/dynamic-workflows.md +1 -7
  203. package/docs/guides/frontend/overview.mdx +1 -1
  204. package/docs/guides/frontend/use-eve-agent-svelte.mdx +1 -1
  205. package/docs/guides/frontend/use-eve-agent-vue.mdx +1 -1
  206. package/docs/guides/session-context.md +2 -1
  207. package/docs/reference/typescript-api.md +2 -2
  208. package/docs/subagents.mdx +2 -2
  209. package/docs/tools/human-in-the-loop.md +43 -6
  210. package/docs/tools/overview.mdx +3 -3
  211. package/docs/tutorial/connect-a-warehouse.mdx +2 -0
  212. package/docs/tutorial/first-agent.mdx +1 -1
  213. package/docs/tutorial/guard-the-spend.mdx +4 -3
  214. package/docs/tutorial/ship-it.mdx +1 -1
  215. package/package.json +14 -11
  216. package/dist/src/compiled/@ai-sdk/anthropic/_provider-utils.d.ts +0 -15
  217. package/dist/src/compiled/@ai-sdk/google/_provider-utils.d.ts +0 -11
  218. package/dist/src/compiled/@ai-sdk/openai/_provider-utils.d.ts +0 -15
  219. package/dist/src/compiled/@ai-sdk/provider/_json-schema.d.ts +0 -5
  220. package/dist/src/execution/dispatch-code-mode-runtime-actions-step.d.ts +0 -21
  221. package/dist/src/execution/dispatch-code-mode-runtime-actions-step.js +0 -1
  222. package/dist/src/harness/code-mode-interrupt-state.d.ts +0 -26
  223. package/dist/src/harness/code-mode-interrupt-state.js +0 -1
  224. package/dist/src/harness/code-mode-lifecycle.d.ts +0 -16
  225. package/dist/src/harness/code-mode-lifecycle.js +0 -1
  226. package/dist/src/harness/code-mode-runtime-action-state.d.ts +0 -6
  227. package/dist/src/harness/code-mode-runtime-action-state.js +0 -1
  228. package/dist/src/harness/code-mode.d.ts +0 -26
  229. package/dist/src/harness/code-mode.js +0 -1
  230. package/dist/src/harness/sandbox-surface.d.ts +0 -68
  231. package/dist/src/harness/sandbox-surface.js +0 -1
  232. package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.d.ts +0 -1
  233. package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.js +0 -1
  234. package/dist/src/runtime/framework-tools/code-mode-connection-auth.d.ts +0 -29
  235. package/dist/src/runtime/framework-tools/code-mode-connection-auth.js +0 -1
  236. package/dist/src/shared/code-mode.d.ts +0 -29
  237. package/dist/src/shared/code-mode.js +0 -1
@@ -1,37 +1,654 @@
1
- import type { ToolSet } from "ai";
2
-
3
- export interface MCPListToolDefinition {
4
- annotations?: Record<string, unknown> | undefined;
5
- description?: string | undefined;
6
- inputSchema?: Record<string, unknown> | undefined;
7
- name: string;
8
- [key: string]: unknown;
9
- }
1
+ import { z } from '#compiled/zod/index.js';
2
+ import { FetchFunction, FlexibleSchema, Tool } from '#compiled/@ai-sdk/provider-utils/index.js';
3
+ import { JSONObject } from '#compiled/@ai-sdk/provider/index.js';
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>;
10
69
 
11
- export interface MCPListToolsResult {
12
- tools: MCPListToolDefinition[];
13
- [key: string]: unknown;
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
+ authorization_server: z.ZodOptional<z.ZodString>;
81
+ token_endpoint: z.ZodOptional<z.ZodString>;
82
+ }, z.core.$strip>;
83
+ declare const OAuthMetadataSchema: z.ZodObject<{
84
+ issuer: z.ZodString;
85
+ authorization_endpoint: z.ZodString;
86
+ token_endpoint: z.ZodString;
87
+ registration_endpoint: z.ZodOptional<z.ZodString>;
88
+ scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
+ response_types_supported: z.ZodArray<z.ZodString>;
90
+ grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
91
+ code_challenge_methods_supported: z.ZodArray<z.ZodString>;
92
+ token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
+ token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ }, z.core.$loose>;
95
+ /**
96
+ * OpenID Connect Discovery metadata that may include OAuth 2.0 fields
97
+ * This schema represents the real-world scenario where OIDC providers
98
+ * return a mix of OpenID Connect and OAuth 2.0 metadata fields
99
+ */
100
+ declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
101
+ issuer: z.ZodString;
102
+ authorization_endpoint: z.ZodString;
103
+ token_endpoint: z.ZodString;
104
+ userinfo_endpoint: z.ZodOptional<z.ZodString>;
105
+ jwks_uri: z.ZodString;
106
+ registration_endpoint: z.ZodOptional<z.ZodString>;
107
+ scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
108
+ response_types_supported: z.ZodArray<z.ZodString>;
109
+ grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ subject_types_supported: z.ZodArray<z.ZodString>;
111
+ id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
112
+ claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
+ token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
+ code_challenge_methods_supported: z.ZodArray<z.ZodString>;
115
+ }, z.core.$loose>;
116
+ declare const OAuthClientInformationSchema: z.ZodObject<{
117
+ client_id: z.ZodString;
118
+ client_secret: z.ZodOptional<z.ZodString>;
119
+ client_id_issued_at: z.ZodOptional<z.ZodNumber>;
120
+ client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
121
+ authorization_server: z.ZodOptional<z.ZodString>;
122
+ token_endpoint: z.ZodOptional<z.ZodString>;
123
+ }, z.core.$strip>;
124
+ declare const OAuthClientMetadataSchema: z.ZodObject<{
125
+ redirect_uris: z.ZodArray<z.ZodString>;
126
+ token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
127
+ grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
+ client_name: z.ZodOptional<z.ZodString>;
130
+ client_uri: z.ZodOptional<z.ZodString>;
131
+ logo_uri: z.ZodOptional<z.ZodString>;
132
+ scope: z.ZodOptional<z.ZodString>;
133
+ contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
134
+ tos_uri: z.ZodOptional<z.ZodString>;
135
+ policy_uri: z.ZodOptional<z.ZodString>;
136
+ jwks_uri: z.ZodOptional<z.ZodString>;
137
+ jwks: z.ZodOptional<z.ZodAny>;
138
+ software_id: z.ZodOptional<z.ZodString>;
139
+ software_version: z.ZodOptional<z.ZodString>;
140
+ software_statement: z.ZodOptional<z.ZodString>;
141
+ }, z.core.$strip>;
142
+ type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
143
+ type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
144
+ type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
145
+ type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
146
+ type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
147
+ type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
148
+
149
+ type AuthResult = 'AUTHORIZED' | 'REDIRECT';
150
+ interface OAuthAuthorizationServerInformation {
151
+ authorizationServerUrl: string;
152
+ tokenEndpoint: string;
153
+ }
154
+ interface OAuthClientProvider {
155
+ /**
156
+ * Returns current access token if present; undefined otherwise.
157
+ */
158
+ tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
159
+ saveTokens(tokens: OAuthTokens): void | Promise<void>;
160
+ redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
161
+ saveCodeVerifier(codeVerifier: string): void | Promise<void>;
162
+ codeVerifier(): string | Promise<string>;
163
+ /**
164
+ * Adds custom client authentication to OAuth token requests.
165
+ *
166
+ * This optional method allows implementations to customize how client credentials
167
+ * are included in token exchange and refresh requests. When provided, this method
168
+ * is called instead of the default authentication logic, giving full control over
169
+ * the authentication mechanism.
170
+ *
171
+ * Common use cases include:
172
+ * - Supporting authentication methods beyond the standard OAuth 2.0 methods
173
+ * - Adding custom headers for proprietary authentication schemes
174
+ * - Implementing client assertion-based authentication (e.g., JWT bearer tokens)
175
+ *
176
+ * @param headers - The request headers (can be modified to add authentication)
177
+ * @param params - The request body parameters (can be modified to add credentials)
178
+ * @param url - The token endpoint URL being called
179
+ * @param metadata - Optional OAuth metadata for the server, which may include supported authentication methods
180
+ */
181
+ addClientAuthentication?(headers: Headers, params: URLSearchParams, url: string | URL, metadata?: AuthorizationServerMetadata): void | Promise<void>;
182
+ /**
183
+ * If implemented, provides a way for the client to invalidate (e.g. delete) the specified
184
+ * credentials, in the case where the server has indicated that they are no longer valid.
185
+ * This avoids requiring the user to intervene manually.
186
+ */
187
+ invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier'): void | Promise<void>;
188
+ get redirectUrl(): string | URL;
189
+ get clientMetadata(): OAuthClientMetadata;
190
+ clientInformation(): OAuthClientInformation | undefined | Promise<OAuthClientInformation | undefined>;
191
+ saveClientInformation?(clientInformation: OAuthClientInformation): void | Promise<void>;
192
+ authorizationServerInformation?(): OAuthAuthorizationServerInformation | undefined | Promise<OAuthAuthorizationServerInformation | undefined>;
193
+ saveAuthorizationServerInformation?(authorizationServerInformation: OAuthAuthorizationServerInformation): void | Promise<void>;
194
+ /**
195
+ * Validates an authorization server URL discovered from MCP protected resource
196
+ * metadata before the client fetches its OAuth metadata.
197
+ */
198
+ validateAuthorizationServerURL?(serverUrl: string | URL, authorizationServerUrl: string | URL): void | Promise<void>;
199
+ state?(): string | Promise<string>;
200
+ saveState?(state: string): void | Promise<void>;
201
+ storedState?(): string | undefined | Promise<string | undefined>;
202
+ validateResourceURL?(serverUrl: string | URL, resource?: string): Promise<URL | undefined>;
14
203
  }
204
+ declare class UnauthorizedError extends Error {
205
+ constructor(message?: string);
206
+ }
207
+ declare function auth(provider: OAuthClientProvider, options: {
208
+ serverUrl: string | URL;
209
+ authorizationCode?: string;
210
+ callbackState?: string;
211
+ scope?: string;
212
+ resourceMetadataUrl?: URL;
213
+ fetchFn?: FetchFunction;
214
+ }): Promise<AuthResult>;
15
215
 
16
- export interface MCPClient {
17
- listTools(options?: unknown): Promise<MCPListToolsResult>;
18
- toolsFromDefinitions(definitions: MCPListToolsResult, options?: unknown): ToolSet;
19
- close(): Promise<void>;
216
+ /**
217
+ * Transport interface for MCP (Model Context Protocol) communication.
218
+ * Maps to the `Transport` interface in the MCP spec.
219
+ */
220
+ interface MCPTransport {
221
+ /**
222
+ * Initialize and start the transport
223
+ */
224
+ start(): Promise<void>;
225
+ /**
226
+ * Send a JSON-RPC message through the transport
227
+ * @param message The JSON-RPC message to send
228
+ */
229
+ send(message: JSONRPCMessage): Promise<void>;
230
+ /**
231
+ * Clean up and close the transport
232
+ */
233
+ close(): Promise<void>;
234
+ /**
235
+ * Event handler for transport closure
236
+ */
237
+ onclose?: () => void;
238
+ /**
239
+ * Event handler for transport errors
240
+ */
241
+ onerror?: (error: Error) => void;
242
+ /**
243
+ * Event handler for received messages
244
+ */
245
+ onmessage?: (message: JSONRPCMessage) => void;
246
+ /**
247
+ * The protocol version negotiated during initialization.
248
+ */
249
+ protocolVersion?: string;
250
+ /**
251
+ * Set the protocol version negotiated during initialization.
252
+ */
253
+ setProtocolVersion?(version: string): void;
20
254
  }
255
+ type MCPTransportConfig = {
256
+ type: 'sse' | 'http';
257
+ /**
258
+ * The URL of the MCP server.
259
+ */
260
+ url: string;
261
+ /**
262
+ * Additional HTTP headers to be sent with requests.
263
+ */
264
+ headers?: Record<string, string>;
265
+ /**
266
+ * An optional OAuth client provider to use for authentication for MCP servers.
267
+ */
268
+ authProvider?: OAuthClientProvider;
269
+ /**
270
+ * Controls how HTTP redirects are handled for transport requests.
271
+ * - `'follow'`: Follow redirects automatically (standard fetch behavior).
272
+ * - `'error'`: Reject any redirect response with an error.
273
+ * @default 'error'
274
+ */
275
+ redirect?: 'follow' | 'error';
276
+ /**
277
+ * Optional custom fetch implementation to use for HTTP requests.
278
+ * Useful for runtimes that need a request-local fetch.
279
+ * @default globalThis.fetch
280
+ */
281
+ fetch?: FetchFunction;
282
+ };
283
+
284
+ type McpProviderMetadata = {
285
+ clientName?: string;
286
+ title?: string;
287
+ toolName?: string;
288
+ app?: JSONObject;
289
+ };
290
+ /** MCP tool metadata - keys should follow MCP _meta key format specification */
291
+ declare const ToolMetaSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
292
+ type ToolMeta = z.infer<typeof ToolMetaSchema>;
293
+ type ToolSchemas = Record<string, {
294
+ inputSchema: FlexibleSchema<JSONObject | unknown>;
295
+ outputSchema?: FlexibleSchema<JSONObject | unknown>;
296
+ }> | 'automatic' | undefined;
297
+ /** Base MCP tool type with execute and _meta */
298
+ type McpToolBase<INPUT = unknown, OUTPUT = CallToolResult> = Tool<INPUT, OUTPUT> & Required<Pick<Tool<INPUT, OUTPUT>, 'execute'>> & {
299
+ _meta?: ToolMeta;
300
+ };
301
+ type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS extends Record<string, {
302
+ inputSchema: FlexibleSchema<any>;
303
+ outputSchema?: FlexibleSchema<any>;
304
+ }> ? {
305
+ [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
306
+ inputSchema: FlexibleSchema<infer INPUT>;
307
+ outputSchema: FlexibleSchema<infer OUTPUT>;
308
+ } ? McpToolBase<INPUT, OUTPUT> : TOOL_SCHEMAS[K] extends {
309
+ inputSchema: FlexibleSchema<infer INPUT>;
310
+ } ? McpToolBase<INPUT, CallToolResult> : never;
311
+ } : Record<string, McpToolBase<unknown, CallToolResult>>;
312
+ declare const ClientOrServerImplementationSchema: z.ZodObject<{
313
+ name: z.ZodString;
314
+ version: z.ZodString;
315
+ title: z.ZodOptional<z.ZodString>;
316
+ }, z.core.$loose>;
317
+ type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;
318
+ declare const BaseParamsSchema: z.ZodObject<{
319
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
320
+ }, z.core.$loose>;
321
+ type BaseParams = z.infer<typeof BaseParamsSchema>;
322
+ declare const RequestSchema: z.ZodObject<{
323
+ method: z.ZodString;
324
+ params: z.ZodOptional<z.ZodObject<{
325
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
326
+ }, z.core.$loose>>;
327
+ }, z.core.$strip>;
328
+ type Request = z.infer<typeof RequestSchema>;
329
+ type RequestOptions = {
330
+ signal?: AbortSignal;
331
+ timeout?: number;
332
+ maxTotalTimeout?: number;
333
+ };
334
+ declare const ClientCapabilitiesSchema: z.ZodObject<{
335
+ elicitation: z.ZodOptional<z.ZodObject<{
336
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
337
+ }, z.core.$loose>>;
338
+ }, z.core.$loose>;
339
+ type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
340
+ type PaginatedRequest = Request & {
341
+ params?: BaseParams & {
342
+ cursor?: string;
343
+ };
344
+ };
345
+ declare const ListToolsResultSchema: z.ZodObject<{
346
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
347
+ nextCursor: z.ZodOptional<z.ZodString>;
348
+ tools: z.ZodArray<z.ZodObject<{
349
+ name: z.ZodString;
350
+ title: z.ZodOptional<z.ZodString>;
351
+ description: z.ZodOptional<z.ZodString>;
352
+ inputSchema: z.ZodObject<{
353
+ type: z.ZodLiteral<"object">;
354
+ properties: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
355
+ }, z.core.$loose>;
356
+ outputSchema: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
357
+ annotations: z.ZodOptional<z.ZodObject<{
358
+ title: z.ZodOptional<z.ZodString>;
359
+ }, z.core.$loose>>;
360
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
361
+ }, z.core.$loose>>;
362
+ }, z.core.$loose>;
363
+ type ListToolsResult = z.infer<typeof ListToolsResultSchema>;
364
+ declare const ListResourcesResultSchema: z.ZodObject<{
365
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
366
+ nextCursor: z.ZodOptional<z.ZodString>;
367
+ resources: z.ZodArray<z.ZodObject<{
368
+ uri: z.ZodString;
369
+ name: z.ZodString;
370
+ title: z.ZodOptional<z.ZodString>;
371
+ description: z.ZodOptional<z.ZodString>;
372
+ mimeType: z.ZodOptional<z.ZodString>;
373
+ size: z.ZodOptional<z.ZodNumber>;
374
+ }, z.core.$loose>>;
375
+ }, z.core.$loose>;
376
+ type ListResourcesResult = z.infer<typeof ListResourcesResultSchema>;
377
+ declare const CallToolResultSchema: z.ZodUnion<[z.ZodObject<{
378
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
379
+ content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
380
+ type: z.ZodLiteral<"text">;
381
+ text: z.ZodString;
382
+ }, z.core.$loose>, z.ZodObject<{
383
+ type: z.ZodLiteral<"image">;
384
+ data: z.ZodBase64;
385
+ mimeType: z.ZodString;
386
+ }, z.core.$loose>, z.ZodObject<{
387
+ type: z.ZodLiteral<"resource">;
388
+ resource: z.ZodUnion<readonly [z.ZodObject<{
389
+ uri: z.ZodString;
390
+ name: z.ZodOptional<z.ZodString>;
391
+ title: z.ZodOptional<z.ZodString>;
392
+ mimeType: z.ZodOptional<z.ZodString>;
393
+ text: z.ZodString;
394
+ }, z.core.$loose>, z.ZodObject<{
395
+ uri: z.ZodString;
396
+ name: z.ZodOptional<z.ZodString>;
397
+ title: z.ZodOptional<z.ZodString>;
398
+ mimeType: z.ZodOptional<z.ZodString>;
399
+ blob: z.ZodBase64;
400
+ }, z.core.$loose>]>;
401
+ }, z.core.$loose>, z.ZodObject<{
402
+ type: z.ZodLiteral<"resource_link">;
403
+ uri: z.ZodString;
404
+ name: z.ZodString;
405
+ description: z.ZodOptional<z.ZodString>;
406
+ mimeType: z.ZodOptional<z.ZodString>;
407
+ }, z.core.$loose>]>>;
408
+ structuredContent: z.ZodOptional<z.ZodUnknown>;
409
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
410
+ }, z.core.$loose>, z.ZodObject<{
411
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
412
+ toolResult: z.ZodUnknown;
413
+ }, z.core.$loose>]>;
414
+ type CallToolResult = z.infer<typeof CallToolResultSchema>;
415
+ declare const ListResourceTemplatesResultSchema: z.ZodObject<{
416
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
417
+ resourceTemplates: z.ZodArray<z.ZodObject<{
418
+ uriTemplate: z.ZodString;
419
+ name: z.ZodString;
420
+ title: z.ZodOptional<z.ZodString>;
421
+ description: z.ZodOptional<z.ZodString>;
422
+ mimeType: z.ZodOptional<z.ZodString>;
423
+ }, z.core.$loose>>;
424
+ }, z.core.$loose>;
425
+ type ListResourceTemplatesResult = z.infer<typeof ListResourceTemplatesResultSchema>;
426
+ declare const ReadResourceResultSchema: z.ZodObject<{
427
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
428
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
429
+ uri: z.ZodString;
430
+ name: z.ZodOptional<z.ZodString>;
431
+ title: z.ZodOptional<z.ZodString>;
432
+ mimeType: z.ZodOptional<z.ZodString>;
433
+ text: z.ZodString;
434
+ }, z.core.$loose>, z.ZodObject<{
435
+ uri: z.ZodString;
436
+ name: z.ZodOptional<z.ZodString>;
437
+ title: z.ZodOptional<z.ZodString>;
438
+ mimeType: z.ZodOptional<z.ZodString>;
439
+ blob: z.ZodBase64;
440
+ }, z.core.$loose>]>>;
441
+ }, z.core.$loose>;
442
+ type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
443
+ declare const ListPromptsResultSchema: z.ZodObject<{
444
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
445
+ nextCursor: z.ZodOptional<z.ZodString>;
446
+ prompts: z.ZodArray<z.ZodObject<{
447
+ name: z.ZodString;
448
+ title: z.ZodOptional<z.ZodString>;
449
+ description: z.ZodOptional<z.ZodString>;
450
+ arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
451
+ name: z.ZodString;
452
+ description: z.ZodOptional<z.ZodString>;
453
+ required: z.ZodOptional<z.ZodBoolean>;
454
+ }, z.core.$loose>>>;
455
+ }, z.core.$loose>>;
456
+ }, z.core.$loose>;
457
+ type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
458
+ declare const GetPromptResultSchema: z.ZodObject<{
459
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
460
+ description: z.ZodOptional<z.ZodString>;
461
+ messages: z.ZodArray<z.ZodObject<{
462
+ role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
463
+ content: z.ZodUnion<readonly [z.ZodObject<{
464
+ type: z.ZodLiteral<"text">;
465
+ text: z.ZodString;
466
+ }, z.core.$loose>, z.ZodObject<{
467
+ type: z.ZodLiteral<"image">;
468
+ data: z.ZodBase64;
469
+ mimeType: z.ZodString;
470
+ }, z.core.$loose>, z.ZodObject<{
471
+ type: z.ZodLiteral<"resource">;
472
+ resource: z.ZodUnion<readonly [z.ZodObject<{
473
+ uri: z.ZodString;
474
+ name: z.ZodOptional<z.ZodString>;
475
+ title: z.ZodOptional<z.ZodString>;
476
+ mimeType: z.ZodOptional<z.ZodString>;
477
+ text: z.ZodString;
478
+ }, z.core.$loose>, z.ZodObject<{
479
+ uri: z.ZodString;
480
+ name: z.ZodOptional<z.ZodString>;
481
+ title: z.ZodOptional<z.ZodString>;
482
+ mimeType: z.ZodOptional<z.ZodString>;
483
+ blob: z.ZodBase64;
484
+ }, z.core.$loose>]>;
485
+ }, z.core.$loose>, z.ZodObject<{
486
+ type: z.ZodLiteral<"resource_link">;
487
+ uri: z.ZodString;
488
+ name: z.ZodString;
489
+ description: z.ZodOptional<z.ZodString>;
490
+ mimeType: z.ZodOptional<z.ZodString>;
491
+ }, z.core.$loose>]>;
492
+ }, z.core.$loose>>;
493
+ }, z.core.$loose>;
494
+ type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
495
+ declare const ElicitationRequestSchema: z.ZodObject<{
496
+ method: z.ZodLiteral<"elicitation/create">;
497
+ params: z.ZodObject<{
498
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
499
+ message: z.ZodString;
500
+ requestedSchema: z.ZodUnknown;
501
+ }, z.core.$loose>;
502
+ }, z.core.$strip>;
503
+ type ElicitationRequest = z.infer<typeof ElicitationRequestSchema>;
504
+ declare const ElicitResultSchema: z.ZodObject<{
505
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
506
+ action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
507
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
508
+ }, z.core.$loose>;
509
+ type ElicitResult = z.infer<typeof ElicitResultSchema>;
21
510
 
22
- export interface MCPClientConfig {
23
- transport:
24
- | {
25
- type: "http" | "sse";
26
- url: string;
27
- headers?: Record<string, string> | undefined;
28
- }
29
- | unknown;
30
- onUncaughtError?: ((error: unknown) => void) | undefined;
31
- clientName?: string | undefined;
32
- name?: string | undefined;
33
- version?: string | undefined;
34
- capabilities?: unknown;
511
+ interface MCPClientConfig {
512
+ /** Transport configuration for connecting to the MCP server */
513
+ transport: MCPTransportConfig | MCPTransport;
514
+ /** Optional callback for uncaught errors */
515
+ onUncaughtError?: (error: unknown) => void;
516
+ /** Optional client name, defaults to 'ai-sdk-mcp-client' */
517
+ clientName?: string;
518
+ /**
519
+ * Optional client name, defaults to 'ai-sdk-mcp-client'
520
+ *
521
+ * @deprecated Use `clientName` instead.
522
+ */
523
+ name?: string;
524
+ /** Optional client version, defaults to '1.0.0' */
525
+ version?: string;
526
+ /**
527
+ * Optional client capabilities to advertise during initialization
528
+ *
529
+ * NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
530
+ */
531
+ capabilities?: ClientCapabilities;
35
532
  }
533
+ declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
534
+ interface MCPClient {
535
+ /**
536
+ * Information about the connected MCP server, as reported during initialization.
537
+ * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
538
+ */
539
+ readonly serverInfo: Configuration;
540
+ /**
541
+ * Optional instructions provided by the server during the initialize handshake.
542
+ *
543
+ * These describe how to use the server and its features, and can be used by clients
544
+ * to improve LLM interactions (e.g. by including them in the system prompt).
545
+ *
546
+ * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#initializeresult
547
+ */
548
+ readonly instructions?: string;
549
+ tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
550
+ schemas?: TOOL_SCHEMAS;
551
+ }): Promise<McpToolSet<TOOL_SCHEMAS>>;
552
+ /**
553
+ * Lists available tools from the MCP server.
554
+ */
555
+ listTools(options?: {
556
+ params?: PaginatedRequest['params'];
557
+ options?: RequestOptions;
558
+ }): Promise<ListToolsResult>;
559
+ /**
560
+ * Calls a tool on the MCP server.
561
+ */
562
+ callTool(args: {
563
+ name: string;
564
+ arguments?: Record<string, unknown>;
565
+ options?: RequestOptions;
566
+ }): Promise<CallToolResult>;
567
+ /**
568
+ * Creates AI SDK tools from tool definitions.
569
+ */
570
+ toolsFromDefinitions<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(definitions: ListToolsResult, options?: {
571
+ schemas?: TOOL_SCHEMAS;
572
+ }): McpToolSet<TOOL_SCHEMAS>;
573
+ listResources(options?: {
574
+ params?: PaginatedRequest['params'];
575
+ options?: RequestOptions;
576
+ }): Promise<ListResourcesResult>;
577
+ readResource(args: {
578
+ uri: string;
579
+ options?: RequestOptions;
580
+ }): Promise<ReadResourceResult>;
581
+ listResourceTemplates(options?: {
582
+ options?: RequestOptions;
583
+ }): Promise<ListResourceTemplatesResult>;
584
+ experimental_listPrompts(options?: {
585
+ params?: PaginatedRequest['params'];
586
+ options?: RequestOptions;
587
+ }): Promise<ListPromptsResult>;
588
+ experimental_getPrompt(args: {
589
+ name: string;
590
+ arguments?: Record<string, unknown>;
591
+ options?: RequestOptions;
592
+ }): Promise<GetPromptResult>;
593
+ onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
594
+ close: () => Promise<void>;
595
+ }
596
+
597
+ /**
598
+ * MIME type for HTML resources that are meant to be rendered as MCP Apps.
599
+ */
600
+ declare const MCP_APP_MIME_TYPE: "text/html;profile=mcp-app";
601
+ /**
602
+ * Client capabilities to pass to `createMCPClient` when the host supports MCP Apps.
603
+ */
604
+ declare const mcpAppClientCapabilities: {
605
+ readonly extensions: {
606
+ readonly "io.modelcontextprotocol/ui": {
607
+ readonly mimeTypes: readonly ["text/html;profile=mcp-app"];
608
+ };
609
+ };
610
+ };
611
+ /**
612
+ * Content security policy metadata requested by an MCP App resource.
613
+ */
614
+ type MCPAppResourceCSP = {
615
+ connectDomains?: string[];
616
+ resourceDomains?: string[];
617
+ frameDomains?: string[];
618
+ [key: string]: unknown;
619
+ };
620
+ /**
621
+ * Host rendering metadata from an MCP App resource.
622
+ */
623
+ type MCPAppResourceMeta = {
624
+ prefersBorder?: boolean;
625
+ csp?: MCPAppResourceCSP;
626
+ permissions?: Record<string, unknown>;
627
+ [key: string]: unknown;
628
+ };
629
+ /**
630
+ * HTML and metadata needed by a host to render an MCP App.
631
+ */
632
+ type MCPAppResource = {
633
+ uri: string;
634
+ mimeType: typeof MCP_APP_MIME_TYPE;
635
+ html: string;
636
+ meta?: MCPAppResourceMeta;
637
+ };
638
+ /**
639
+ * Splits tool definitions into model-visible tools and app-visible tools.
640
+ */
641
+ declare function splitMCPAppTools(definitions: ListToolsResult): {
642
+ modelVisible: ListToolsResult;
643
+ appVisible: ListToolsResult;
644
+ };
645
+ /**
646
+ * Reads a `ui://` resource from an MCP server and normalizes it for rendering.
647
+ */
648
+ declare function readMCPAppResource({ client, uri, options, }: {
649
+ client: Pick<MCPClient, 'readResource'>;
650
+ uri: string;
651
+ options?: RequestOptions;
652
+ }): Promise<MCPAppResource>;
36
653
 
37
- export declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
654
+ export { type CallToolResult, type Configuration, type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPAppResource, type MCPAppResourceCSP, type MCPAppResourceMeta, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, MCP_APP_MIME_TYPE, type McpProviderMetadata, type OAuthAuthorizationServerInformation, 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, mcpAppClientCapabilities, readMCPAppResource, splitMCPAppTools };