@dudko.dev/agent-web-react 0.0.29 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.js CHANGED
@@ -1,10 +1,93 @@
1
+ import {
2
+ createElicitationQueue,
3
+ elicitationConnectOptions,
4
+ elicitationSettings,
5
+ elicitationTimeoutOf
6
+ } from "./chunk-VMCWL6VH.js";
7
+
1
8
  // src/hooks/use-mcp.ts
2
- import { useCallback, useEffect, useRef, useState } from "react";
9
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
10
+ var mcpSkillsSettingOf = (value) => {
11
+ if (value === true) return true;
12
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
13
+ const { consent, dynamic } = value;
14
+ const known = consent === "ask" || consent === "once-per-skill" || consent === "never";
15
+ if (!known && consent !== void 0) return void 0;
16
+ if (dynamic !== void 0 && typeof dynamic !== "boolean") return void 0;
17
+ if (!known && dynamic !== true) return true;
18
+ return {
19
+ ...known ? { consent } : {},
20
+ ...dynamic === true ? { dynamic: true } : {}
21
+ };
22
+ };
23
+ var mcpAppsRouter = (connectionOf) => {
24
+ const appsOf = (server) => connectionOf(server)?.apps;
25
+ const notConnected = (server) => new Error(`the server \u201C${server}\u201D is not connected`);
26
+ return {
27
+ readUiResource: (server, uri, options) => {
28
+ const apps = appsOf(server);
29
+ return apps ? apps.readUiResource(server, uri, options) : Promise.reject(notConnected(server));
30
+ },
31
+ appTool: (server, name) => appsOf(server)?.appTool(server, name),
32
+ readResource: (server, uri, options) => {
33
+ const apps = appsOf(server);
34
+ if (!apps) return Promise.reject(notConnected(server));
35
+ if (!apps.readResource) {
36
+ return Promise.reject(new Error("this version of the core cannot read a linked file"));
37
+ }
38
+ return apps.readResource(server, uri, options);
39
+ },
40
+ callAppTool: (server, name, args, options) => {
41
+ const apps = appsOf(server);
42
+ return apps ? apps.callAppTool(server, name, args, options) : Promise.reject(notConnected(server));
43
+ }
44
+ };
45
+ };
3
46
  var mcpInstructionsOf = (connection, name) => {
4
47
  const list = Array.isArray(connection.instructions) ? connection.instructions : [];
5
48
  const text = list.find((i) => i?.server === name)?.instructions;
6
49
  return typeof text === "string" && text.trim() ? text : void 0;
7
50
  };
51
+ var mcpProtocolOf = (connection, name) => {
52
+ const list = Array.isArray(connection.protocols) ? connection.protocols : [];
53
+ const found = list.find((p) => p?.server === name);
54
+ return found && typeof found.version === "string" ? { server: name, version: found.version, era: found.era } : void 0;
55
+ };
56
+ var useElicitationQueue = (optionsRef) => {
57
+ const [pendingElicitations, setPending] = useState([]);
58
+ const mountedRef = useRef(true);
59
+ const queueRef = useRef(void 0);
60
+ queueRef.current ??= createElicitationQueue({
61
+ timeoutMs: () => {
62
+ const settings = elicitationSettings(optionsRef.current.elicitation);
63
+ return settings ? elicitationTimeoutOf(settings) : void 0;
64
+ },
65
+ onChange: (pending) => {
66
+ if (mountedRef.current) setPending(pending);
67
+ }
68
+ });
69
+ const queue = queueRef.current;
70
+ const handler = useCallback(
71
+ (request, ctx) => mountedRef.current ? queue.handler(request, ctx) : { action: "cancel" },
72
+ [queue]
73
+ );
74
+ const answerElicitation = useCallback(
75
+ (id, result) => queue.answer(id, result),
76
+ [queue]
77
+ );
78
+ const cancel = useCallback(
79
+ (server) => queue.cancel(server === void 0 ? void 0 : (request) => request.server === server),
80
+ [queue]
81
+ );
82
+ useEffect(() => {
83
+ mountedRef.current = true;
84
+ return () => {
85
+ mountedRef.current = false;
86
+ queue.cancel();
87
+ };
88
+ }, [queue]);
89
+ return { pendingElicitations, answerElicitation, handler, cancel };
90
+ };
8
91
  var OAUTH_UNSUPPORTED = "The installed @dudko.dev/agent-web has no MCP OAuth support. Upgrade the core to a version exporting BrowserOAuthProvider, or use a static Authorization header.";
9
92
  var PENDING_KEY = "agent-web-react:mcp:pending";
10
93
  var OAUTH_KEY = "agent-web-react:mcp:oauth";
@@ -98,9 +181,44 @@ var mcpOAuthProviderOptions = (serverUrl, oauth = {}, defaults = {}) => {
98
181
  clientName: oauth.clientName ?? defaults.clientName,
99
182
  scope: oauth.scope,
100
183
  // Left out when unset: a provider built without it keeps registering dynamically.
101
- ...clientMetadataUrl !== void 0 ? { clientMetadataUrl } : {}
184
+ ...clientMetadataUrl !== void 0 ? { clientMetadataUrl } : {},
185
+ // Left out when unset, too: the core's default is 'auto'.
186
+ ...oauth.registration !== void 0 ? { registration: oauth.registration } : {}
102
187
  };
103
188
  };
189
+ var mcpOAuthRecordOf = (resolved) => ({
190
+ redirectUrl: resolved.redirectUrl,
191
+ scope: resolved.scope,
192
+ clientName: resolved.clientName,
193
+ clientMetadataUrl: resolved.clientMetadataUrl,
194
+ ...resolved.registration !== void 0 ? { registration: resolved.registration } : {}
195
+ });
196
+ var mcpOAuthOptionsOfRecord = (record) => ({
197
+ redirectUrl: record.redirectUrl,
198
+ scope: record.scope,
199
+ clientName: record.clientName,
200
+ clientMetadataUrl: record.clientMetadataUrl,
201
+ ...record.registration !== void 0 ? { registration: record.registration } : {}
202
+ });
203
+ var registrationUnsupported = (registration) => `The installed @dudko.dev/agent-web does not support oauth.registration ('${registration}'): it would register as it always did. Upgrade the core, or leave registration out.`;
204
+ var newMcpOAuthProvider = (mod, options) => {
205
+ if (!mod.BrowserOAuthProvider) throw new Error(OAUTH_UNSUPPORTED);
206
+ const provider = new mod.BrowserOAuthProvider(options);
207
+ const asked = options.registration;
208
+ if (asked !== void 0 && asked !== "auto" && provider.registration !== asked) {
209
+ throw new Error(registrationUnsupported(asked));
210
+ }
211
+ return provider;
212
+ };
213
+ var mcpOAuthRegistrationOf = async (provider) => {
214
+ if (typeof provider?.registrationKind !== "function") return void 0;
215
+ try {
216
+ const kind = await provider.registrationKind();
217
+ return kind === "cimd" || kind === "dcr" ? kind : void 0;
218
+ } catch {
219
+ return void 0;
220
+ }
221
+ };
104
222
  var isUnauthorizedError = (err, mod) => {
105
223
  if (!(err instanceof Error)) return false;
106
224
  if (mod?.UnauthorizedError && err instanceof mod.UnauthorizedError) return true;
@@ -136,8 +254,12 @@ var useMcp = (options = {}) => {
136
254
  const [tools, setTools] = useState(void 0);
137
255
  const [catalog, setCatalog] = useState([]);
138
256
  const [instructions, setInstructions] = useState(void 0);
257
+ const [protocol, setProtocol] = useState(void 0);
139
258
  const [error, setError] = useState(void 0);
140
259
  const [authorizationUrl, setAuthorizationUrl] = useState(void 0);
260
+ const [oauthRegistration, setOauthRegistration] = useState(
261
+ void 0
262
+ );
141
263
  const [oauthSupported, setOauthSupported] = useState(void 0);
142
264
  const [completingAuthorization, setCompletingAuthorization] = useState(
143
265
  () => readCallbackParams() !== void 0
@@ -147,12 +269,15 @@ var useMcp = (options = {}) => {
147
269
  const epochRef = useRef(0);
148
270
  const optionsRef = useRef(options);
149
271
  optionsRef.current = options;
272
+ const elicitation = useElicitationQueue(optionsRef);
273
+ const cancelElicitations = elicitation.cancel;
150
274
  const closeConnection = useCallback(async () => {
151
275
  const open = connectionRef.current;
152
276
  connectionRef.current = void 0;
277
+ cancelElicitations();
153
278
  if (open) await open.close().catch(() => {
154
279
  });
155
- }, []);
280
+ }, [cancelElicitations]);
156
281
  const checkOAuthSupport = useCallback(async () => {
157
282
  try {
158
283
  const mod = await loadMcp();
@@ -173,9 +298,11 @@ var useMcp = (options = {}) => {
173
298
  setStatus("connecting");
174
299
  setError(void 0);
175
300
  setAuthorizationUrl(void 0);
301
+ setOauthRegistration(void 0);
176
302
  setTools(void 0);
177
303
  setCatalog([]);
178
304
  setInstructions(void 0);
305
+ setProtocol(void 0);
179
306
  try {
180
307
  const mod = await loadMcp();
181
308
  setOauthSupported(typeof mod.BrowserOAuthProvider === "function");
@@ -191,13 +318,12 @@ var useMcp = (options = {}) => {
191
318
  const record = {
192
319
  url: opts.url,
193
320
  name,
194
- redirectUrl: providerOptions.redirectUrl,
195
- scope: providerOptions.scope,
196
- clientName: providerOptions.clientName,
197
- clientMetadataUrl: providerOptions.clientMetadataUrl,
321
+ ...mcpOAuthRecordOf(providerOptions),
322
+ ...opts.protocol ? { protocol: opts.protocol } : {},
323
+ ...mcpSkillsSettingOf(opts.skills) ? { skills: mcpSkillsSettingOf(opts.skills) } : {},
198
324
  startedAt: Date.now()
199
325
  };
200
- authProvider = new mod.BrowserOAuthProvider(providerOptions);
326
+ authProvider = newMcpOAuthProvider(mod, providerOptions);
201
327
  providerRef.current = authProvider;
202
328
  writeRecord(PENDING_KEY, record);
203
329
  writeRecord(OAUTH_KEY, record);
@@ -209,10 +335,19 @@ var useMcp = (options = {}) => {
209
335
  [name]: {
210
336
  url: opts.url,
211
337
  headers: opts.oauth ? void 0 : opts.headers,
212
- authProvider
338
+ authProvider,
339
+ // Only when asked for: without it the connection is built as it always was.
340
+ ...opts.protocol ? { protocol: opts.protocol } : {},
341
+ ...mcpSkillsSettingOf(opts.skills) ? { skills: mcpSkillsSettingOf(opts.skills) } : {}
213
342
  }
214
343
  },
215
- { clientName: optionsRef.current.clientName, onLog: optionsRef.current.onLog }
344
+ {
345
+ clientName: optionsRef.current.clientName,
346
+ onLog: optionsRef.current.onLog,
347
+ ...optionsRef.current.apps ? { apps: true } : {},
348
+ // Off: neither key is passed, so the core declares no capability.
349
+ ...elicitationConnectOptions(optionsRef.current.elicitation, elicitation.handler)
350
+ }
216
351
  );
217
352
  if (!current()) {
218
353
  await connection.close().catch(() => {
@@ -243,6 +378,10 @@ var useMcp = (options = {}) => {
243
378
  );
244
379
  setCatalog(connection.catalog);
245
380
  setInstructions(mcpInstructionsOf(connection, name));
381
+ setProtocol(mcpProtocolOf(connection, name));
382
+ const registered = await mcpOAuthRegistrationOf(authProvider);
383
+ if (!current()) return;
384
+ setOauthRegistration(registered);
246
385
  setStatus("connected");
247
386
  } catch (err) {
248
387
  if (!current()) return;
@@ -250,7 +389,7 @@ var useMcp = (options = {}) => {
250
389
  setStatus("error");
251
390
  }
252
391
  },
253
- [closeConnection]
392
+ [closeConnection, elicitation.handler]
254
393
  );
255
394
  const disconnect = useCallback(async () => {
256
395
  epochRef.current++;
@@ -258,7 +397,9 @@ var useMcp = (options = {}) => {
258
397
  setTools(void 0);
259
398
  setCatalog([]);
260
399
  setInstructions(void 0);
400
+ setProtocol(void 0);
261
401
  setAuthorizationUrl(void 0);
402
+ setOauthRegistration(void 0);
262
403
  setError(void 0);
263
404
  setStatus("idle");
264
405
  }, [closeConnection]);
@@ -311,7 +452,8 @@ var useMcp = (options = {}) => {
311
452
  const mod = await loadMcp();
312
453
  setOauthSupported(typeof mod.BrowserOAuthProvider === "function");
313
454
  if (!mod.BrowserOAuthProvider || !mod.finishMcpOAuth) throw new Error(OAUTH_UNSUPPORTED);
314
- const provider = new mod.BrowserOAuthProvider(mcpOAuthProviderOptions(pending.url, pending));
455
+ const oauth = mcpOAuthOptionsOfRecord(pending);
456
+ const provider = newMcpOAuthProvider(mod, mcpOAuthProviderOptions(pending.url, oauth));
315
457
  providerRef.current = provider;
316
458
  await mod.finishMcpOAuth(provider, callback);
317
459
  writeRecord(PENDING_KEY, void 0);
@@ -319,12 +461,9 @@ var useMcp = (options = {}) => {
319
461
  await connect({
320
462
  url: pending.url,
321
463
  name: pending.name,
322
- oauth: {
323
- redirectUrl: pending.redirectUrl,
324
- scope: pending.scope,
325
- clientName: pending.clientName,
326
- clientMetadataUrl: pending.clientMetadataUrl
327
- }
464
+ oauth,
465
+ ...pending.protocol ? { protocol: pending.protocol } : {},
466
+ ...mcpSkillsSettingOf(pending.skills) ? { skills: mcpSkillsSettingOf(pending.skills) } : {}
328
467
  });
329
468
  } catch (err) {
330
469
  writeRecord(PENDING_KEY, void 0);
@@ -342,15 +481,25 @@ var useMcp = (options = {}) => {
342
481
  },
343
482
  [closeConnection]
344
483
  );
484
+ const appsOn = options.apps === true;
485
+ const apps = useMemo(
486
+ () => appsOn ? mcpAppsRouter(() => connectionRef.current) : void 0,
487
+ [appsOn]
488
+ );
345
489
  return {
490
+ apps,
346
491
  status,
347
492
  tools,
348
493
  catalog,
349
494
  instructions,
495
+ protocol,
350
496
  error,
351
497
  authorizationUrl,
498
+ oauthRegistration,
352
499
  oauthSupported,
353
500
  completingAuthorization,
501
+ pendingElicitations: elicitation.pendingElicitations,
502
+ answerElicitation: elicitation.answerElicitation,
354
503
  connect,
355
504
  disconnect,
356
505
  authorize,
@@ -360,13 +509,17 @@ var useMcp = (options = {}) => {
360
509
  };
361
510
 
362
511
  // src/hooks/use-mcp-servers.ts
363
- import { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
512
+ import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
364
513
  var DEFAULT_KEY = "agent-web-react:mcp-servers";
365
514
  var sanitize = (s) => s.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 32) || "mcp";
515
+ var isProtocolMode = (value) => value === "legacy" || value === "auto" || value === "modern";
366
516
  var view = (s, patch = {}) => ({
367
517
  name: s.name,
368
518
  url: s.url,
369
519
  auth: s.auth,
520
+ ...isProtocolMode(s.protocol) ? { protocolMode: s.protocol } : {},
521
+ ...mcpSkillsSettingOf(s.skills) ? { skills: mcpSkillsSettingOf(s.skills) } : {},
522
+ ...typeof s.apps === "boolean" ? { apps: s.apps } : {},
370
523
  status: "idle",
371
524
  catalog: [],
372
525
  ...patch
@@ -393,13 +546,18 @@ var useMcpServers = (options = {}) => {
393
546
  name: s.name,
394
547
  url: s.url,
395
548
  auth: s.auth,
396
- ...oauth && typeof oauth === "object" ? { oauth } : {}
549
+ ...oauth && typeof oauth === "object" ? { oauth } : {},
550
+ ...s.protocolMode ? { protocol: s.protocolMode } : {},
551
+ ...mcpSkillsSettingOf(s.skills) ? { skills: mcpSkillsSettingOf(s.skills) } : {},
552
+ ...typeof s.apps === "boolean" ? { apps: s.apps } : {}
397
553
  });
398
554
  }
399
555
  }
400
556
  const optionsRef = useRef2(options);
401
557
  optionsRef.current = options;
402
558
  const unmountedRef = useRef2(false);
559
+ const elicitation = useElicitationQueue(optionsRef);
560
+ const cancelElicitations = elicitation.cancel;
403
561
  const saveList = useCallback2(() => {
404
562
  if (!persist) return;
405
563
  writeRecord(storageKey, [...specsRef.current.values()]);
@@ -426,15 +584,11 @@ var useMcpServers = (options = {}) => {
426
584
  l.tools = void 0;
427
585
  setToolsVersion((v) => v + 1);
428
586
  }
587
+ cancelElicitations(name);
429
588
  if (open) await open.close().catch(() => {
430
589
  });
431
590
  }, []);
432
- const providerFor = (mod, spec) => {
433
- if (!mod.BrowserOAuthProvider) throw new Error(OAUTH_UNSUPPORTED);
434
- return new mod.BrowserOAuthProvider(
435
- mcpOAuthProviderOptions(spec.url, spec.oauth, optionsRef.current)
436
- );
437
- };
591
+ const providerFor = (mod, spec) => newMcpOAuthProvider(mod, mcpOAuthProviderOptions(spec.url, spec.oauth, optionsRef.current));
438
592
  const connectServer = useCallback2(
439
593
  async (name) => {
440
594
  const spec = specsRef.current.get(name);
@@ -451,8 +605,10 @@ var useMcpServers = (options = {}) => {
451
605
  status: "connecting",
452
606
  error: void 0,
453
607
  authorizationUrl: void 0,
608
+ oauthRegistration: void 0,
454
609
  catalog: [],
455
- instructions: void 0
610
+ instructions: void 0,
611
+ protocol: void 0
456
612
  });
457
613
  try {
458
614
  const mod = await loadMcp();
@@ -468,13 +624,21 @@ var useMcpServers = (options = {}) => {
468
624
  url: spec.url,
469
625
  headers: spec.auth === "bearer" && l.token ? { Authorization: `Bearer ${l.token}` } : void 0,
470
626
  authProvider: provider,
471
- connectTimeoutMs: optionsRef.current.connectTimeoutMs
627
+ connectTimeoutMs: optionsRef.current.connectTimeoutMs,
628
+ // Only when asked for: without it the connection is built as it always was.
629
+ ...spec.protocol ? { protocol: spec.protocol } : {},
630
+ ...mcpSkillsSettingOf(spec.skills) ? { skills: mcpSkillsSettingOf(spec.skills) } : {},
631
+ // Only when given: without it the hook's `apps` decides, as before.
632
+ ...typeof spec.apps === "boolean" ? { apps: spec.apps } : {}
472
633
  }
473
634
  },
474
635
  {
475
636
  clientName: optionsRef.current.clientName,
476
637
  onLog: optionsRef.current.onLog,
477
- connectTimeoutMs: optionsRef.current.connectTimeoutMs
638
+ connectTimeoutMs: optionsRef.current.connectTimeoutMs,
639
+ ...optionsRef.current.apps ? { apps: true } : {},
640
+ // Off: neither key is passed, so the core declares no capability.
641
+ ...elicitationConnectOptions(optionsRef.current.elicitation, elicitation.handler)
478
642
  }
479
643
  );
480
644
  if (!current()) {
@@ -506,10 +670,15 @@ var useMcpServers = (options = {}) => {
506
670
  });
507
671
  });
508
672
  setToolsVersion((v) => v + 1);
673
+ const negotiated = mcpProtocolOf(connection, name);
674
+ const oauthRegistration = await mcpOAuthRegistrationOf(provider);
675
+ if (!current()) return;
509
676
  patch(name, {
510
677
  status: "connected",
678
+ oauthRegistration,
511
679
  catalog: connection.catalog,
512
- instructions: mcpInstructionsOf(connection, name)
680
+ instructions: mcpInstructionsOf(connection, name),
681
+ protocol: negotiated ? { version: negotiated.version, era: negotiated.era } : void 0
513
682
  });
514
683
  } catch (err) {
515
684
  if (!current()) return;
@@ -532,7 +701,10 @@ var useMcpServers = (options = {}) => {
532
701
  name,
533
702
  url: input.url,
534
703
  auth: input.auth ?? "none",
535
- ...input.oauth ? { oauth: input.oauth } : {}
704
+ ...input.oauth ? { oauth: input.oauth } : {},
705
+ ...isProtocolMode(input.protocol) ? { protocol: input.protocol } : {},
706
+ ...mcpSkillsSettingOf(input.skills) ? { skills: mcpSkillsSettingOf(input.skills) } : {},
707
+ ...typeof input.apps === "boolean" ? { apps: input.apps } : {}
536
708
  };
537
709
  specsRef.current.set(name, spec);
538
710
  live(name).token = input.auth === "bearer" ? input.token : void 0;
@@ -570,10 +742,7 @@ var useMcpServers = (options = {}) => {
570
742
  const pending = {
571
743
  name,
572
744
  url: spec.url,
573
- redirectUrl: spec.oauth?.redirectUrl ?? defaultRedirectUrl(),
574
- scope: spec.oauth?.scope,
575
- clientName: spec.oauth?.clientName ?? optionsRef.current.clientName,
576
- clientMetadataUrl: spec.oauth?.clientMetadataUrl ?? optionsRef.current.clientMetadataUrl,
745
+ ...mcpOAuthRecordOf(mcpOAuthProviderOptions(spec.url, spec.oauth, optionsRef.current)),
577
746
  startedAt: Date.now()
578
747
  };
579
748
  writeRecord(pendingKey, pending);
@@ -604,8 +773,10 @@ var useMcpServers = (options = {}) => {
604
773
  patch(name, {
605
774
  status: "idle",
606
775
  authorizationUrl: void 0,
776
+ oauthRegistration: void 0,
607
777
  catalog: [],
608
778
  instructions: void 0,
779
+ protocol: void 0,
609
780
  error: void 0
610
781
  });
611
782
  },
@@ -650,15 +821,7 @@ var useMcpServers = (options = {}) => {
650
821
  setServers((list) => [...list, view(spec)]);
651
822
  saveList();
652
823
  }
653
- const provider = providerFor(mod, {
654
- ...spec,
655
- oauth: {
656
- redirectUrl: pending.redirectUrl,
657
- scope: pending.scope,
658
- clientName: pending.clientName,
659
- clientMetadataUrl: pending.clientMetadataUrl
660
- }
661
- });
824
+ const provider = providerFor(mod, { ...spec, oauth: mcpOAuthOptionsOfRecord(pending) });
662
825
  live(spec.name).provider = provider;
663
826
  await mod.finishMcpOAuth(provider, callback);
664
827
  writeRecord(pendingKey, void 0);
@@ -682,19 +845,39 @@ var useMcpServers = (options = {}) => {
682
845
  for (const name of liveRef.current.keys()) void closeServer(name);
683
846
  };
684
847
  }, []);
685
- const tools = useMemo(() => {
848
+ const tools = useMemo2(() => {
686
849
  const merged = {};
687
850
  for (const l of liveRef.current.values()) if (l.tools) Object.assign(merged, l.tools);
688
851
  return merged;
689
852
  }, [toolsVersion]);
690
- const catalog = useMemo(
853
+ const catalog = useMemo2(
691
854
  () => servers.filter((s) => s.status === "connected").flatMap((s) => s.catalog),
692
855
  [servers]
693
856
  );
857
+ const appsOn = options.apps === true || servers.some((s) => s.apps === true);
858
+ const hookApps = options.apps === true;
859
+ const apps = useMemo2(
860
+ () => appsOn ? mcpAppsRouter((server) => {
861
+ const spec = specsRef.current.get(server);
862
+ if (!spec || (spec.apps ?? hookApps) !== true) return void 0;
863
+ return liveRef.current.get(server)?.connection;
864
+ }) : void 0,
865
+ [appsOn, hookApps]
866
+ );
867
+ const protocols = useMemo2(
868
+ () => servers.flatMap(
869
+ (s) => s.status === "connected" && s.protocol ? [{ server: s.name, ...s.protocol }] : []
870
+ ),
871
+ [servers]
872
+ );
694
873
  return {
874
+ apps,
695
875
  servers,
696
876
  tools,
697
877
  catalog,
878
+ protocols,
879
+ pendingElicitations: elicitation.pendingElicitations,
880
+ answerElicitation: elicitation.answerElicitation,
698
881
  connectedCount: servers.filter((s) => s.status === "connected").length,
699
882
  completingAuthorization,
700
883
  oauthSupported,
@@ -708,10 +891,21 @@ var useMcpServers = (options = {}) => {
708
891
  };
709
892
  export {
710
893
  claimOAuthCallback,
894
+ createElicitationQueue,
711
895
  describeMcpResult,
896
+ elicitationConnectOptions,
897
+ elicitationSettings,
898
+ elicitationTimeoutOf,
712
899
  isUnauthorizedError,
900
+ mcpAppsRouter,
713
901
  mcpInstructionsOf,
902
+ mcpOAuthOptionsOfRecord,
714
903
  mcpOAuthProviderOptions,
904
+ mcpOAuthRecordOf,
905
+ mcpOAuthRegistrationOf,
906
+ mcpProtocolOf,
907
+ mcpSkillsSettingOf,
908
+ newMcpOAuthProvider,
715
909
  readCallbackParams,
716
910
  stripOAuthParams,
717
911
  useMcp,