@dudko.dev/agent-web-react 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +345 -19
- package/dist/{chunk-UUB7CE6N.js → chunk-EMF7DTGS.js} +69 -1
- package/dist/chunk-EMF7DTGS.js.map +1 -0
- package/dist/chunk-FXHQXIOU.js +94 -0
- package/dist/chunk-FXHQXIOU.js.map +1 -0
- package/dist/chunk-VMCWL6VH.js +294 -0
- package/dist/chunk-VMCWL6VH.js.map +1 -0
- package/dist/elicitation-CcZe5-EK.d.cts +1535 -0
- package/dist/elicitation-CcZe5-EK.d.ts +1535 -0
- package/dist/index.cjs +4360 -618
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +705 -433
- package/dist/index.d.ts +705 -433
- package/dist/index.js +4029 -628
- package/dist/index.js.map +1 -1
- package/dist/mcp-app-policy-DIUmGPJP.d.cts +55 -0
- package/dist/mcp-app-policy-DIUmGPJP.d.ts +55 -0
- package/dist/mcp-app-sandbox.cjs +313 -0
- package/dist/mcp-app-sandbox.cjs.map +1 -0
- package/dist/mcp-app-sandbox.d.cts +65 -0
- package/dist/mcp-app-sandbox.d.ts +65 -0
- package/dist/mcp-app-sandbox.js +201 -0
- package/dist/mcp-app-sandbox.js.map +1 -0
- package/dist/mcp.cjs +315 -42
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +182 -96
- package/dist/mcp.d.ts +182 -96
- package/dist/mcp.js +233 -46
- package/dist/mcp.js.map +1 -1
- package/dist/pipeline.cjs.map +1 -1
- package/dist/pipeline.js +1 -1
- package/dist/styles.css +1139 -0
- package/package.json +13 -3
- package/dist/chunk-UUB7CE6N.js.map +0 -1
package/dist/mcp.d.ts
CHANGED
|
@@ -1,94 +1,7 @@
|
|
|
1
|
-
import { AgentToolSet } from '@dudko.dev/agent-web';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* The subpath is loaded with a dynamic import and typed here rather than
|
|
7
|
-
* imported, for two reasons: it drags in `@modelcontextprotocol/client` (an
|
|
8
|
-
* optional peer of the core, which apps without MCP must not have to install),
|
|
9
|
-
* and the OAuth half only exists in newer cores while this package supports
|
|
10
|
-
* `@dudko.dev/agent-web >= 0.0.6`. `useMcp` feature-detects at runtime and
|
|
11
|
-
* reports `oauthSupported: false` on an older core instead of crashing.
|
|
12
|
-
*/
|
|
13
|
-
interface McpCatalogEntry {
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
server: string;
|
|
17
|
-
/** The server marked the tool read-only (newer cores). */
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
}
|
|
20
|
-
interface McpServerResult {
|
|
21
|
-
name: string;
|
|
22
|
-
connected: boolean;
|
|
23
|
-
error?: string;
|
|
24
|
-
needsAuthorization?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/** The `instructions` one connected server returned in its `initialize` result. */
|
|
27
|
-
interface McpServerInstructions {
|
|
28
|
-
/** The server's name: its key in the configuration. */
|
|
29
|
-
server: string;
|
|
30
|
-
instructions: string;
|
|
31
|
-
}
|
|
32
|
-
interface ConnectedMcp {
|
|
33
|
-
tools: AgentToolSet;
|
|
34
|
-
catalog: McpCatalogEntry[];
|
|
35
|
-
results: McpServerResult[];
|
|
36
|
-
/**
|
|
37
|
-
* What each connected server told the agent in its handshake (newer cores; absent on older
|
|
38
|
-
* ones). THIRD-PARTY text: the core puts it in the system prompt of an agent that uses the
|
|
39
|
-
* server's tools, so a host should let the user see it.
|
|
40
|
-
*/
|
|
41
|
-
instructions?: McpServerInstructions[];
|
|
42
|
-
refreshServer?: (name: string) => Promise<void>;
|
|
43
|
-
close: () => Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
interface McpHttpServerConfig {
|
|
46
|
-
url: string;
|
|
47
|
-
headers?: Record<string, string>;
|
|
48
|
-
authProvider?: unknown;
|
|
49
|
-
/** Per-server connect deadline (newer cores; ignored by older ones). */
|
|
50
|
-
connectTimeoutMs?: number;
|
|
51
|
-
}
|
|
52
|
-
interface McpOAuthCallback {
|
|
53
|
-
code?: string;
|
|
54
|
-
state?: string;
|
|
55
|
-
/** The `iss` parameter of the response (RFC 9207); the core checks it. */
|
|
56
|
-
iss?: string;
|
|
57
|
-
error?: string;
|
|
58
|
-
errorDescription?: string;
|
|
59
|
-
}
|
|
60
|
-
interface BrowserOAuthProvider {
|
|
61
|
-
serverUrl: string;
|
|
62
|
-
authorizationUrl?: URL;
|
|
63
|
-
isAuthorized(): Promise<boolean>;
|
|
64
|
-
reset(): Promise<void>;
|
|
65
|
-
}
|
|
66
|
-
interface BrowserOAuthProviderOptions {
|
|
67
|
-
serverUrl: string;
|
|
68
|
-
redirectUrl: string;
|
|
69
|
-
clientName?: string;
|
|
70
|
-
scope?: string;
|
|
71
|
-
/** Client ID metadata document URL (CIMD). Cores without it ignore the field. */
|
|
72
|
-
clientMetadataUrl?: string;
|
|
73
|
-
}
|
|
74
|
-
/** The shape of the subpath module, as far as this package uses it. */
|
|
75
|
-
interface McpModule {
|
|
76
|
-
connectMcpHttp: (servers: Record<string, McpHttpServerConfig>, opts?: {
|
|
77
|
-
clientName?: string;
|
|
78
|
-
onLog?: (level: string, message: string) => void;
|
|
79
|
-
connectTimeoutMs?: number;
|
|
80
|
-
}) => Promise<ConnectedMcp>;
|
|
81
|
-
BrowserOAuthProvider?: new (opts: BrowserOAuthProviderOptions) => BrowserOAuthProvider;
|
|
82
|
-
readOAuthCallback?: (input?: string | URL) => McpOAuthCallback | undefined;
|
|
83
|
-
finishMcpOAuth?: (provider: BrowserOAuthProvider, callback: McpOAuthCallback) => Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* The SDK's error class, re-exported by the core so an authorization failure
|
|
86
|
-
* can be recognised by identity (`@modelcontextprotocol/client` on a core on
|
|
87
|
-
* the 2.x MCP SDK, `@modelcontextprotocol/sdk` before). Absent on cores older
|
|
88
|
-
* than 0.0.12.
|
|
89
|
-
*/
|
|
90
|
-
UnauthorizedError?: new (message?: string) => Error;
|
|
91
|
-
}
|
|
1
|
+
import { McpSkillConsent, AgentToolSet } from '@dudko.dev/agent-web';
|
|
2
|
+
import { aW as McpOAuthRegistration, aX as McpProtocolMode, P as PendingElicitation, f as McpElicitationResult, aY as McpElicitationOptions, aZ as McpCatalogEntry, a_ as McpServerProtocol, a$ as McpOAuthRegistrationKind, b0 as McpOAuthCallback, b1 as McpServerResult, b2 as McpModule, b3 as ConnectedMcp, b4 as BrowserOAuthProviderOptions, b5 as BrowserOAuthProvider } from './elicitation-CcZe5-EK.js';
|
|
3
|
+
import { McpAppsConnectionLike } from './index.js';
|
|
4
|
+
export { b6 as ElicitationQueue, b7 as ElicitationQueueOptions, an as McpElicitationFieldSchema, b8 as McpElicitationHandler, ao as McpElicitationRequest, ap as McpElicitationSchema, b9 as McpServerInstructions, ba as createElicitationQueue, bb as elicitationConnectOptions, bc as elicitationSettings, bd as elicitationTimeoutOf } from './elicitation-CcZe5-EK.js';
|
|
92
5
|
|
|
93
6
|
type McpStatus = 'idle' | 'connecting' | 'connected' | 'needs-authorization' | 'error';
|
|
94
7
|
/** The OAuth details of one server. Everything is optional. */
|
|
@@ -110,6 +23,19 @@ interface McpOAuthOptions {
|
|
|
110
23
|
* ignores it and registers dynamically.
|
|
111
24
|
*/
|
|
112
25
|
clientMetadataUrl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* How the client is registered with the server's authorization server:
|
|
28
|
+
* `'auto'` (the default - the document where the server supports it, dynamic
|
|
29
|
+
* registration otherwise), `'cimd'` (the document only: needs a
|
|
30
|
+
* `clientMetadataUrl`, and a server without support ends in `status: 'error'`
|
|
31
|
+
* before anything is sent to its registration endpoint) or `'dcr'` (dynamic
|
|
32
|
+
* registration only, even with a `clientMetadataUrl`). Kept across the
|
|
33
|
+
* redirect, and with the server list of `useMcpServers`. Left out, nothing is
|
|
34
|
+
* passed. A core that does not know the option is refused for `'cimd'` /
|
|
35
|
+
* `'dcr'` (it would register as it always did). Which way was taken is in
|
|
36
|
+
* `oauthRegistration`.
|
|
37
|
+
*/
|
|
38
|
+
registration?: McpOAuthRegistration;
|
|
113
39
|
}
|
|
114
40
|
interface McpConnectOptions {
|
|
115
41
|
/** The server's StreamableHTTP endpoint. */
|
|
@@ -123,7 +49,38 @@ interface McpConnectOptions {
|
|
|
123
49
|
* that ships the OAuth provider; check `oauthSupported` before offering it.
|
|
124
50
|
*/
|
|
125
51
|
oauth?: boolean | McpOAuthOptions;
|
|
52
|
+
/**
|
|
53
|
+
* The MCP protocol revisions this connection may use: `'legacy'` the 2025 revisions,
|
|
54
|
+
* `'auto'` 2026-07-28 when the server offers it and the 2025 ones otherwise (one probe
|
|
55
|
+
* request; from a page the server's CORS must allow `Mcp-Method` and `Mcp-Name`, or the
|
|
56
|
+
* probe is blocked and the connection falls back with a warning), `'modern'` 2026-07-28 only.
|
|
57
|
+
* Left out, nothing is passed and the core decides (`'legacy'`). What was negotiated is in
|
|
58
|
+
* the hook's `protocol`.
|
|
59
|
+
*/
|
|
60
|
+
protocol?: McpProtocolMode;
|
|
61
|
+
/**
|
|
62
|
+
* EXPERIMENTAL (the MCP Skills extension is Beta): load the skills the server serves into the
|
|
63
|
+
* agent's skills catalog, as `<server>/<skill>` - they come with `tools`, so nothing else is
|
|
64
|
+
* wired. Needs `protocol: 'auto'` or `'modern'`. Third-party text: the core loads it as
|
|
65
|
+
* knowledge only, never policy, and - unless `{ consent: 'never' }` - only after a person
|
|
66
|
+
* allowed it (`useAgent().pendingApprovals`, a request with `skill`). `true` or `{ consent }`
|
|
67
|
+
* (see `McpSkillsSetting`). Left out, nothing is passed (off).
|
|
68
|
+
*/
|
|
69
|
+
skills?: McpSkillsSetting;
|
|
126
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* `skills` on a server, as the hooks pass it on and remember it: `true`, or `{ consent }` -
|
|
73
|
+
* `'once-per-skill'` (the core's default), `'ask'` or `'never'` (see the core's
|
|
74
|
+
* `McpHttpServerConfig.skills`).
|
|
75
|
+
*/
|
|
76
|
+
type McpSkillsSetting = true | {
|
|
77
|
+
consent?: McpSkillConsent;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A `skills` value as the hooks take it - also from storage, so anything else is dropped: `true`,
|
|
81
|
+
* an object with a known `consent` (or none: `true`), else `undefined` (off).
|
|
82
|
+
*/
|
|
83
|
+
declare const mcpSkillsSettingOf: (value: unknown) => McpSkillsSetting | undefined;
|
|
127
84
|
interface UseMcpOptions {
|
|
128
85
|
/** Client name reported to the MCP server during initialize. */
|
|
129
86
|
clientName?: string;
|
|
@@ -135,8 +92,45 @@ interface UseMcpOptions {
|
|
|
135
92
|
clientMetadataUrl?: string;
|
|
136
93
|
/** Called with connector log lines — handy while debugging a server. */
|
|
137
94
|
onLog?: (level: string, message: string) => void;
|
|
95
|
+
/**
|
|
96
|
+
* MCP Apps: declare the extension and read the tools' apps (default false). The hook then
|
|
97
|
+
* returns `apps` - pass it to `<AgentChat mcpApps>` - and a tool's results come with an app.
|
|
98
|
+
* A tool for its app only is then not in `tools`. Needs a core with MCP Apps.
|
|
99
|
+
*/
|
|
100
|
+
apps?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* MCP elicitation: let a server ask the USER for input in the middle of a tool call - a
|
|
103
|
+
* form, or (with `url: true`) a link to open. Off by default, and then nothing is passed to
|
|
104
|
+
* the core: no capability is declared and the wire is what it was. `true` turns it on with
|
|
105
|
+
* the core's defaults; an object is the core's `elicitation` settings (`url`, `timeoutMs`,
|
|
106
|
+
* `maxPerToolCall`, `maxPerRun`, `subagents`). Questions land in `pendingElicitations`; show
|
|
107
|
+
* them (`<ElicitationPrompt>`, or `<AgentChat elicitations>`) and answer with
|
|
108
|
+
* `answerElicitation`. Read when a server connects: changing it takes a reconnect.
|
|
109
|
+
*/
|
|
110
|
+
elicitation?: boolean | McpElicitationOptions;
|
|
138
111
|
}
|
|
139
|
-
|
|
112
|
+
/**
|
|
113
|
+
* A stable `McpAppsConnectionLike` for the hooks: each call reaches the connection the server is
|
|
114
|
+
* on NOW (or says it is not connected), so it can be handed to `<AgentChat>` once.
|
|
115
|
+
*/
|
|
116
|
+
declare const mcpAppsRouter: (connectionOf: (server: string) => ConnectedMcp | undefined) => McpAppsConnectionLike;
|
|
117
|
+
/** What both MCP hooks return for elicitation. */
|
|
118
|
+
interface McpElicitationControls {
|
|
119
|
+
/**
|
|
120
|
+
* Questions servers are waiting on, oldest first (empty unless `elicitation` is on). Every
|
|
121
|
+
* string in a request is the SERVER's text. A question leaves the list when it is answered,
|
|
122
|
+
* when the core stops waiting (its time ran out, the run stopped), when its server is
|
|
123
|
+
* disconnected and when the component unmounts - the last three answer `cancel`.
|
|
124
|
+
*/
|
|
125
|
+
pendingElicitations: PendingElicitation[];
|
|
126
|
+
/**
|
|
127
|
+
* Answer a pending question: `{ action: 'accept', content }` (a form's values; no content
|
|
128
|
+
* for a link), `{ action: 'decline' }` or `{ action: 'cancel' }`. The answer is handed to
|
|
129
|
+
* the core and kept nowhere. False when no such question is waiting any more.
|
|
130
|
+
*/
|
|
131
|
+
answerElicitation: (id: string, result: McpElicitationResult) => boolean;
|
|
132
|
+
}
|
|
133
|
+
interface UseMcpReturn extends McpElicitationControls {
|
|
140
134
|
status: McpStatus;
|
|
141
135
|
/** Merge into `BrowserAgentConfig.tools` once `status === 'connected'`. */
|
|
142
136
|
tools?: AgentToolSet;
|
|
@@ -147,9 +141,20 @@ interface UseMcpReturn {
|
|
|
147
141
|
* user as the server's words, never as your own.
|
|
148
142
|
*/
|
|
149
143
|
instructions?: string;
|
|
144
|
+
/**
|
|
145
|
+
* The protocol revision negotiated with the connected server (`version`, `era`); absent
|
|
146
|
+
* until it is connected, and on a core that does not report it.
|
|
147
|
+
*/
|
|
148
|
+
protocol?: McpServerProtocol;
|
|
150
149
|
error?: string;
|
|
151
150
|
/** Where to send the user when `status === 'needs-authorization'`. */
|
|
152
151
|
authorizationUrl?: string;
|
|
152
|
+
/**
|
|
153
|
+
* How the OAuth client of the connected server was registered - `'cimd'`
|
|
154
|
+
* (its client ID metadata document) or `'dcr'` (dynamic registration) - once
|
|
155
|
+
* it is connected with OAuth, on a core that reports it.
|
|
156
|
+
*/
|
|
157
|
+
oauthRegistration?: McpOAuthRegistrationKind;
|
|
153
158
|
/**
|
|
154
159
|
* Whether the installed core exposes the OAuth API. `undefined` until the
|
|
155
160
|
* optional subpath has been loaded once — call `checkOAuthSupport()` to
|
|
@@ -166,12 +171,28 @@ interface UseMcpReturn {
|
|
|
166
171
|
forgetAuthorization: () => Promise<void>;
|
|
167
172
|
/** Load the optional subpath and report whether it can do OAuth. */
|
|
168
173
|
checkOAuthSupport: () => Promise<boolean>;
|
|
174
|
+
/** MCP Apps of the connected server (with `apps: true`): pass it to `<AgentChat mcpApps>`. */
|
|
175
|
+
apps?: McpAppsConnectionLike;
|
|
169
176
|
}
|
|
170
177
|
/**
|
|
171
178
|
* The instructions the server `name` sent, or undefined when it sent none (or the core is too
|
|
172
179
|
* old to report them). The text is the server's, not the host's: show it as such.
|
|
173
180
|
*/
|
|
174
181
|
declare const mcpInstructionsOf: (connection: Pick<ConnectedMcp, "instructions">, name: string) => string | undefined;
|
|
182
|
+
/** What was negotiated with the server `name`, or undefined (not connected, or an older core). */
|
|
183
|
+
declare const mcpProtocolOf: (connection: Pick<ConnectedMcp, "protocols">, name: string) => McpServerProtocol | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* The OAuth details a redirect record keeps for one server - both hooks write one before the
|
|
186
|
+
* user leaves for the authorization server, and build the provider and the reconnect from it
|
|
187
|
+
* on the way back, so the client is the same both times.
|
|
188
|
+
*/
|
|
189
|
+
interface McpOAuthRecord {
|
|
190
|
+
redirectUrl: string;
|
|
191
|
+
scope?: string;
|
|
192
|
+
clientName?: string;
|
|
193
|
+
clientMetadataUrl?: string;
|
|
194
|
+
registration?: McpOAuthRegistration;
|
|
195
|
+
}
|
|
175
196
|
/** Map a single server's connect outcome onto the hook's status. Pure. */
|
|
176
197
|
declare const describeMcpResult: (result: McpServerResult | undefined) => {
|
|
177
198
|
status: McpStatus;
|
|
@@ -205,6 +226,29 @@ declare const claimOAuthCallback: (callback: McpOAuthCallback) => boolean;
|
|
|
205
226
|
* when forgetting, so the three always describe the same client.
|
|
206
227
|
*/
|
|
207
228
|
declare const mcpOAuthProviderOptions: (serverUrl: string, oauth?: McpOAuthOptions, defaults?: Pick<McpOAuthOptions, "clientName" | "clientMetadataUrl">) => BrowserOAuthProviderOptions;
|
|
229
|
+
/**
|
|
230
|
+
* What a redirect record keeps of the options `mcpOAuthProviderOptions` resolved (the server's
|
|
231
|
+
* URL is kept beside it). Pure; written as JSON, so an unset field is simply absent.
|
|
232
|
+
*/
|
|
233
|
+
declare const mcpOAuthRecordOf: (resolved: BrowserOAuthProviderOptions) => McpOAuthRecord;
|
|
234
|
+
/**
|
|
235
|
+
* The OAuth details read back from a redirect record on the way in: what the provider and the
|
|
236
|
+
* reconnect are built with. Pure. `registration` is passed on as it was stored - a value the
|
|
237
|
+
* core does not know is refused by the core, never read as "auto".
|
|
238
|
+
*/
|
|
239
|
+
declare const mcpOAuthOptionsOfRecord: (record: McpOAuthRecord) => McpOAuthOptions;
|
|
240
|
+
/**
|
|
241
|
+
* The core's OAuth provider for one server. A `registration` other than `'auto'` needs a core
|
|
242
|
+
* that knows it - an older one would ignore it and register the old way (a document under
|
|
243
|
+
* `'dcr'`, a dynamic registration under `'cimd'`) - so that is refused here, before any request.
|
|
244
|
+
*/
|
|
245
|
+
declare const newMcpOAuthProvider: (mod: McpModule, options: BrowserOAuthProviderOptions) => BrowserOAuthProvider;
|
|
246
|
+
/**
|
|
247
|
+
* How the provider's stored client was registered (`'cimd'` / `'dcr'`), read after a sign-in;
|
|
248
|
+
* undefined without a provider, on a core that does not report it, or when the read fails.
|
|
249
|
+
* Never throws: it is what the UI shows, not a check.
|
|
250
|
+
*/
|
|
251
|
+
declare const mcpOAuthRegistrationOf: (provider: BrowserOAuthProvider | undefined) => Promise<McpOAuthRegistrationKind | undefined>;
|
|
208
252
|
/**
|
|
209
253
|
* Did this error come from the server refusing our authorization?
|
|
210
254
|
*
|
|
@@ -253,18 +297,53 @@ interface McpServerSpec {
|
|
|
253
297
|
auth?: McpAuthMode;
|
|
254
298
|
/** Bearer token for `auth: 'bearer'` — kept in memory only, never persisted. */
|
|
255
299
|
token?: string;
|
|
256
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* OAuth details for `auth: 'oauth'` (`clientMetadataUrl` for CIMD and `registration` among
|
|
302
|
+
* them). Remembered with the server.
|
|
303
|
+
*/
|
|
257
304
|
oauth?: McpOAuthOptions;
|
|
305
|
+
/**
|
|
306
|
+
* The MCP protocol revisions this connection may use (`'legacy'` / `'auto'` / `'modern'`,
|
|
307
|
+
* see `McpConnectOptions.protocol`). Remembered with the server. Left out, nothing is passed
|
|
308
|
+
* and the core decides (`'legacy'`).
|
|
309
|
+
*/
|
|
310
|
+
protocol?: McpProtocolMode;
|
|
311
|
+
/**
|
|
312
|
+
* EXPERIMENTAL: load the server's skills into the agent's catalog, as `<server>/<skill>` (see
|
|
313
|
+
* `McpConnectOptions.skills`; needs `protocol: 'auto'` or `'modern'`): `true`, or
|
|
314
|
+
* `{ consent }`. Remembered with the server. Left out, nothing is passed (off).
|
|
315
|
+
*/
|
|
316
|
+
skills?: McpSkillsSetting;
|
|
317
|
+
/**
|
|
318
|
+
* MCP Apps for this server: `false` keeps its apps off while other servers' are shown (nothing
|
|
319
|
+
* is declared to it, no app of it is read, its app-only tools are hidden from everyone and its
|
|
320
|
+
* other tools are the model's, as plain tools); `true` shows them even when the hook's `apps`
|
|
321
|
+
* is off. Remembered with the server. Left out, the hook's `apps` decides.
|
|
322
|
+
*/
|
|
323
|
+
apps?: boolean;
|
|
258
324
|
}
|
|
259
325
|
/** A server's live state. */
|
|
260
326
|
interface McpServerView {
|
|
261
327
|
name: string;
|
|
262
328
|
url: string;
|
|
263
329
|
auth: McpAuthMode;
|
|
330
|
+
/** The protocol revisions the server was added with, when it was given any. */
|
|
331
|
+
protocolMode?: McpProtocolMode;
|
|
332
|
+
/** It was added with `skills` (as given): its skills (if it serves any) are in the catalog. */
|
|
333
|
+
skills?: McpSkillsSetting;
|
|
334
|
+
/** It was added with `apps` set (`false`: its apps are off; absent: the hook's `apps`). */
|
|
335
|
+
apps?: boolean;
|
|
336
|
+
/** What was negotiated (`version`, `era`), while it is connected and the core reports it. */
|
|
337
|
+
protocol?: Omit<McpServerProtocol, 'server'>;
|
|
264
338
|
status: McpStatus;
|
|
265
339
|
error?: string;
|
|
266
340
|
/** Where to send the user when `status === 'needs-authorization'`. */
|
|
267
341
|
authorizationUrl?: string;
|
|
342
|
+
/**
|
|
343
|
+
* How its OAuth client was registered - `'cimd'` (the client ID metadata document) or `'dcr'`
|
|
344
|
+
* (dynamic registration) - while it is connected with OAuth, on a core that reports it.
|
|
345
|
+
*/
|
|
346
|
+
oauthRegistration?: McpOAuthRegistrationKind;
|
|
268
347
|
catalog: McpCatalogEntry[];
|
|
269
348
|
/**
|
|
270
349
|
* What the server told the agent in its handshake (its MCP `instructions`), while it is
|
|
@@ -286,12 +365,14 @@ interface UseMcpServersOptions extends UseMcpOptions {
|
|
|
286
365
|
/** Per-server connect deadline in ms (default: the core's, 30 s). */
|
|
287
366
|
connectTimeoutMs?: number;
|
|
288
367
|
}
|
|
289
|
-
interface UseMcpServersReturn {
|
|
368
|
+
interface UseMcpServersReturn extends McpElicitationControls {
|
|
290
369
|
servers: McpServerView[];
|
|
291
370
|
/** Tools of every connected server, merged — pass to `BrowserAgentConfig.tools`. */
|
|
292
371
|
tools: AgentToolSet;
|
|
293
372
|
/** Catalogue of every connected server, merged. */
|
|
294
373
|
catalog: McpCatalogEntry[];
|
|
374
|
+
/** The protocol revision negotiated with each connected server (cores that report it). */
|
|
375
|
+
protocols: McpServerProtocol[];
|
|
295
376
|
connectedCount: number;
|
|
296
377
|
/** True while an OAuth redirect is being finished on mount. */
|
|
297
378
|
completingAuthorization: boolean;
|
|
@@ -308,6 +389,11 @@ interface UseMcpServersReturn {
|
|
|
308
389
|
authorize: (name: string) => void;
|
|
309
390
|
/** Drop a server's stored OAuth tokens and registration. */
|
|
310
391
|
forgetAuthorization: (name: string) => Promise<void>;
|
|
392
|
+
/**
|
|
393
|
+
* MCP Apps of every connected server (with `apps: true`): pass it to `<AgentChat mcpApps>`.
|
|
394
|
+
* Each call goes to the server it names, on the connection it has now.
|
|
395
|
+
*/
|
|
396
|
+
apps?: McpAppsConnectionLike;
|
|
311
397
|
}
|
|
312
398
|
/**
|
|
313
399
|
* Connect the browser agent to SEVERAL remote MCP servers at once, each with
|
|
@@ -329,5 +415,5 @@ interface UseMcpServersReturn {
|
|
|
329
415
|
*/
|
|
330
416
|
declare const useMcpServers: (options?: UseMcpServersOptions) => UseMcpServersReturn;
|
|
331
417
|
|
|
332
|
-
export { claimOAuthCallback, describeMcpResult, isUnauthorizedError, mcpInstructionsOf, mcpOAuthProviderOptions, readCallbackParams, stripOAuthParams, useMcp, useMcpServers };
|
|
333
|
-
export type {
|
|
418
|
+
export { BrowserOAuthProvider, BrowserOAuthProviderOptions, ConnectedMcp, McpCatalogEntry, McpElicitationOptions, McpElicitationResult, McpModule, McpOAuthCallback, McpOAuthRegistration, McpOAuthRegistrationKind, McpProtocolMode, McpServerProtocol, McpServerResult, PendingElicitation, claimOAuthCallback, describeMcpResult, isUnauthorizedError, mcpAppsRouter, mcpInstructionsOf, mcpOAuthOptionsOfRecord, mcpOAuthProviderOptions, mcpOAuthRecordOf, mcpOAuthRegistrationOf, mcpProtocolOf, mcpSkillsSettingOf, newMcpOAuthProvider, readCallbackParams, stripOAuthParams, useMcp, useMcpServers };
|
|
419
|
+
export type { McpAuthMode, McpConnectOptions, McpElicitationControls, McpOAuthOptions, McpOAuthRecord, McpServerSpec, McpServerView, McpSkillsSetting, McpStatus, UseMcpOptions, UseMcpReturn, UseMcpServersOptions, UseMcpServersReturn };
|