eve 0.13.8 → 0.14.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.
- package/CHANGELOG.md +16 -0
- package/dist/src/channel/routes.d.ts +5 -0
- package/dist/src/channel/send.js +1 -1
- package/dist/src/channel/types.d.ts +5 -0
- package/dist/src/compiled/.vendor-stamp.json +12 -8
- package/dist/src/compiled/@ai-sdk/anthropic/index.d.ts +2 -2
- package/dist/src/compiled/@ai-sdk/anthropic/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/google/index.d.ts +25 -3
- package/dist/src/compiled/@ai-sdk/google/index.js +6 -6
- package/dist/src/compiled/@ai-sdk/mcp/index.d.ts +647 -30
- package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
- package/dist/src/compiled/@ai-sdk/openai/index.d.ts +8 -2
- package/dist/src/compiled/@ai-sdk/openai/index.js +2 -2
- package/dist/src/compiled/@ai-sdk/otel/index.d.ts +165 -28
- package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
- package/dist/src/compiled/@ai-sdk/provider/index.d.ts +10 -2
- package/dist/src/compiled/@ai-sdk/provider-utils/index.d.ts +2362 -0
- package/dist/src/compiled/@ai-sdk/provider-utils/index.js +1 -0
- package/dist/src/compiled/@workflow/serde/LICENSE.md +3 -0
- package/dist/src/compiled/@workflow/serde/index.d.ts +30 -0
- package/dist/src/compiled/@workflow/serde/index.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{dist-C9PV_vnE.js → dist-D7CzPkf8.js} +1 -1
- package/dist/src/compiled/eventsource-parser/stream/LICENSE +21 -0
- package/dist/src/compiled/eventsource-parser/stream/index.d.ts +121 -0
- package/dist/src/compiled/eventsource-parser/stream/index.js +1 -0
- package/dist/src/compiled/experimental-ai-sdk-code-mode/approval-continuation.d.ts +7 -7
- package/dist/src/compiled/experimental-ai-sdk-code-mode/continuation-capability.d.ts +15 -4
- package/dist/src/compiled/experimental-ai-sdk-code-mode/index.d.ts +1 -1
- package/dist/src/compiled/experimental-ai-sdk-code-mode/index.js +15 -15
- package/dist/src/compiled/experimental-ai-sdk-code-mode/interrupt-continuation.d.ts +5 -5
- package/dist/src/compiled/experimental-ai-sdk-code-mode/runtime/protocol.d.ts +13 -2
- package/dist/src/compiled/experimental-ai-sdk-code-mode/types.d.ts +26 -0
- package/dist/src/compiled/json-schema/LICENSE +21 -0
- package/dist/src/compiled/json-schema/index.d.ts +749 -0
- package/dist/src/compiled/json-schema/index.js +1 -0
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/context/keys.d.ts +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +12 -0
- package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -0
- package/dist/src/execution/next-driver-action.d.ts +1 -1
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/session.js +3 -3
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +2 -11
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/action-result-helpers.d.ts +2 -2
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +2 -2
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/tools.d.ts +4 -6
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/harness/types.d.ts +4 -10
- package/dist/src/harness/workflow-continuation-security.d.ts +4 -0
- package/dist/src/harness/workflow-continuation-security.js +1 -0
- package/dist/src/harness/workflow-interrupt-state.d.ts +14 -0
- package/dist/src/harness/workflow-interrupt-state.js +1 -0
- package/dist/src/harness/workflow-lifecycle.d.ts +13 -0
- package/dist/src/harness/workflow-lifecycle.js +1 -0
- package/dist/src/harness/workflow-runtime-action-state.d.ts +9 -0
- package/dist/src/harness/workflow-runtime-action-state.js +1 -0
- package/dist/src/harness/workflow-sandbox.d.ts +22 -0
- package/dist/src/harness/workflow-sandbox.js +2 -0
- package/dist/src/harness/workflow-tool-description.d.ts +2 -2
- package/dist/src/harness/workflow-tool-description.js +16 -4
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.d.ts +1 -0
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/workflow/runtime.d.ts +1 -0
- package/dist/src/public/channels/slack/attachments.js +1 -1
- package/dist/src/public/channels/slack/auth.d.ts +2 -0
- package/dist/src/public/channels/slack/auth.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +2 -2
- package/dist/src/public/channels/slack/inbound.d.ts +4 -11
- package/dist/src/public/channels/slack/inbound.js +1 -2
- package/dist/src/public/channels/slack/model-context.d.ts +28 -0
- package/dist/src/public/channels/slack/model-context.js +3 -0
- package/dist/src/public/channels/slack/slackChannel.d.ts +8 -0
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/connections/index.d.ts +1 -1
- package/dist/src/public/definitions/agent.d.ts +1 -1
- package/dist/src/public/definitions/approval.d.ts +40 -0
- package/dist/src/public/definitions/approval.js +1 -0
- package/dist/src/public/definitions/connections/mcp.d.ts +11 -9
- package/dist/src/public/definitions/connections/mcp.js +1 -1
- package/dist/src/public/definitions/connections/openapi.d.ts +9 -7
- package/dist/src/public/definitions/connections/openapi.js +1 -1
- package/dist/src/public/definitions/tool.d.ts +7 -20
- package/dist/src/public/index.d.ts +1 -1
- package/dist/src/public/tools/approval/approval-helpers.d.ts +7 -7
- package/dist/src/public/tools/approval/approval-helpers.js +1 -1
- package/dist/src/public/tools/approval/index.d.ts +1 -1
- package/dist/src/public/tools/index.d.ts +2 -1
- package/dist/src/public/tools/internal.js +1 -1
- package/dist/src/runtime/agent/bootstrap.d.ts +1 -0
- package/dist/src/runtime/agent/bootstrap.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +2 -3
- package/dist/src/runtime/connections/mcp-client.d.ts +3 -3
- package/dist/src/runtime/connections/mcp-client.js +1 -1
- package/dist/src/runtime/connections/registry.d.ts +2 -2
- package/dist/src/runtime/connections/resolve-authorization.d.ts +11 -0
- package/dist/src/runtime/connections/resolve-authorization.js +1 -0
- package/dist/src/runtime/connections/types.d.ts +27 -11
- package/dist/src/runtime/framework-tools/connection-search-dynamic.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-connection.js +1 -1
- package/dist/src/runtime/resolve-tool.d.ts +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/types.d.ts +8 -7
- package/dist/src/setup/primitives/pm/pnpm.js +6 -5
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/shared/agent-definition.d.ts +11 -13
- package/dist/src/shared/dynamic-tool-definition.d.ts +3 -3
- package/dist/src/shared/tool-definition.d.ts +1 -2
- package/dist/src/shared/workflow-sandbox.d.ts +37 -0
- package/dist/src/shared/workflow-sandbox.js +1 -0
- package/docs/agent-config.md +30 -10
- package/docs/channels/custom.mdx +2 -2
- package/docs/channels/slack.mdx +7 -13
- package/docs/connections/mcp.mdx +2 -2
- package/docs/connections/openapi.mdx +37 -2
- package/docs/connections/overview.mdx +32 -0
- package/docs/guides/deployment.md +2 -2
- package/docs/guides/dynamic-workflows.md +1 -7
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-vue.mdx +1 -1
- package/docs/guides/session-context.md +2 -1
- package/docs/reference/typescript-api.md +2 -2
- package/docs/subagents.mdx +2 -2
- package/docs/tools/human-in-the-loop.md +43 -6
- package/docs/tools/overview.mdx +3 -3
- package/docs/tutorial/first-agent.mdx +1 -1
- package/docs/tutorial/guard-the-spend.mdx +4 -3
- package/docs/tutorial/ship-it.mdx +1 -1
- package/package.json +14 -11
- package/dist/src/compiled/@ai-sdk/anthropic/_provider-utils.d.ts +0 -15
- package/dist/src/compiled/@ai-sdk/google/_provider-utils.d.ts +0 -11
- package/dist/src/compiled/@ai-sdk/openai/_provider-utils.d.ts +0 -15
- package/dist/src/compiled/@ai-sdk/provider/_json-schema.d.ts +0 -5
- package/dist/src/execution/dispatch-code-mode-runtime-actions-step.d.ts +0 -21
- package/dist/src/execution/dispatch-code-mode-runtime-actions-step.js +0 -1
- package/dist/src/harness/code-mode-interrupt-state.d.ts +0 -26
- package/dist/src/harness/code-mode-interrupt-state.js +0 -1
- package/dist/src/harness/code-mode-lifecycle.d.ts +0 -16
- package/dist/src/harness/code-mode-lifecycle.js +0 -1
- package/dist/src/harness/code-mode-runtime-action-state.d.ts +0 -6
- package/dist/src/harness/code-mode-runtime-action-state.js +0 -1
- package/dist/src/harness/code-mode.d.ts +0 -26
- package/dist/src/harness/code-mode.js +0 -1
- package/dist/src/harness/sandbox-surface.d.ts +0 -68
- package/dist/src/harness/sandbox-surface.js +0 -1
- package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.d.ts +0 -1
- package/dist/src/internal/nitro/host/code-mode-runtime-dependency-plugin.js +0 -1
- package/dist/src/runtime/framework-tools/code-mode-connection-auth.d.ts +0 -29
- package/dist/src/runtime/framework-tools/code-mode-connection-auth.js +0 -1
- package/dist/src/shared/code-mode.d.ts +0 -29
- package/dist/src/shared/code-mode.js +0 -1
|
@@ -1,37 +1,654 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
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 };
|