@mcp-use/inspector 20.0.0-beta.5 → 20.0.0-beta.7

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 (196) hide show
  1. package/dist/cdn/{AnimatePresence-Dcw-FOy8.js → AnimatePresence-D1bZ5_-l.js} +79 -78
  2. package/dist/cdn/{ChatTab-B255lH5i.js → ChatTab-DtUGK07C.js} +1628 -1561
  3. package/dist/cdn/CheckboxIndicator-BjF73mGX.js +252 -0
  4. package/dist/cdn/{ConnectionSettingsForm-DF-NS58d.js → ConnectionSettingsForm-CNuMa6jp.js} +202 -202
  5. package/dist/cdn/{ConnectionSettingsTab-dI-Cqe79.js → ConnectionSettingsTab-qSVQ1aIF.js} +36 -35
  6. package/dist/cdn/{ElicitationTab-CL1KJ0bz.js → ElicitationTab-PEmEDvC5.js} +47 -46
  7. package/dist/cdn/{FormContext-tmgN_Vdr.js → FormContext-NtUiZclE.js} +26 -26
  8. package/dist/cdn/{InspectorContext-UjtEbNod.js → InspectorContext-BBKCdfmK.js} +1 -1
  9. package/dist/cdn/{JSONDisplay-BFxf5oEu.js → JSONDisplay-BJqMz7Ny.js} +22 -22
  10. package/dist/cdn/{ListTabHeader-Cv-GmtGF.js → ListTabHeader-DzmTtN1e.js} +20 -19
  11. package/dist/cdn/{WidgetWrapper-B4H3Fek7.js → MCPAppsDebugControls-BpP-Ifap.js} +514 -550
  12. package/dist/cdn/{ManufactOAuthCallback-B98kSYCj.js → ManufactOAuthCallback-ChbbjFIT.js} +2 -2
  13. package/dist/cdn/{MarkdownRenderer-Ba7nA4Ie.js → MarkdownRenderer-bX1BrKgI.js} +23 -23
  14. package/dist/cdn/McpAppsViewPanel-jlsYQ7uS.js +56 -0
  15. package/dist/cdn/{NotificationsTab-CeImSrhx.js → NotificationsTab-B7uebqMV.js} +21 -21
  16. package/dist/cdn/{OAuthCallback-Blc2Asxc.js → OAuthCallback--NZdLoWx.js} +3 -3
  17. package/dist/cdn/PromptsTab-BlXDcau3.js +902 -0
  18. package/dist/cdn/{ResourcesTab-BGualKW-.js → ResourcesTab-D45_JojP.js} +116 -114
  19. package/dist/cdn/{SamplingTab-BeZBUeni.js → SamplingTab-r7tImM6L.js} +34 -33
  20. package/dist/cdn/{ServerMetadataTab-CvrKX8fz.js → ServerMetadataTab-BM3VhSLf.js} +9 -9
  21. package/dist/cdn/{StatusIcon-D0-ARyOh.js → StatusIcon-Q3n3YRtE.js} +10 -11
  22. package/dist/cdn/{ToolsTab-j6n4O_3s.js → ToolsTab-DOAO8HnS.js} +664 -652
  23. package/dist/cdn/{ViewPreview-DihyG6Qd.js → ViewPreview-CBhrVdwx.js} +3 -3
  24. package/dist/cdn/{WidgetDebugContext-D4usL_MA.js → WidgetDebugContext-B6yoOVVV.js} +1 -11
  25. package/dist/cdn/WidgetWrapper-BlbQAh_X.js +12 -0
  26. package/dist/cdn/{bell-CGjAO_0s.js → bell-GrTZcnD2.js} +1 -1
  27. package/dist/cdn/{browser-CbQIH4w2.js → browser-DG2Z8392.js} +1 -1
  28. package/dist/cdn/{brush-B_mKhyxG.js → brush-CelVvMGp.js} +1 -1
  29. package/dist/cdn/button-CB4uOoUV.js +2509 -0
  30. package/dist/cdn/card-BA-DQk-G.js +41 -0
  31. package/dist/cdn/{checkbox-By0FklhG.js → checkbox-kwVa4gRX.js} +7 -7
  32. package/dist/cdn/{clock-CmUbSx_B.js → clock-YMF8Gtw5.js} +1 -1
  33. package/dist/cdn/{code-V_0nf5rg.js → code-C8sN2OGR.js} +1 -1
  34. package/dist/cdn/{jsx-runtime-CIxvMpEo.js → createLucideIcon-BONxC1L5.js} +57 -24
  35. package/dist/cdn/{dialog-BsDpuJd3.js → dialog-CJGnC5Ag.js} +171 -171
  36. package/dist/cdn/{dist-DaMB0Su9.js → dist-CTJnCYmk.js} +1 -1
  37. package/dist/cdn/{dist-DbX5yidW.js → dist-SxRsB1iS.js} +5 -4
  38. package/dist/cdn/{external-link-CjmfT6rW.js → external-link-Bo4lQxr1.js} +1 -1
  39. package/dist/cdn/{eye-B7H96av8.js → eye-pSGG7nvf.js} +1 -1
  40. package/dist/cdn/{folder-open-B3lu2rG_.js → folder-open-aM8CPtBO.js} +1 -1
  41. package/dist/cdn/{hash-BVQnWi7q.js → hash-DDs2vE1k.js} +1 -1
  42. package/dist/cdn/{history-Csw4rb44.js → history-BfUFpL1d.js} +1 -1
  43. package/dist/cdn/{index-browser-DkQOzkvX.js → index-browser-Dm3R1Mfe.js} +1 -1
  44. package/dist/cdn/{info-CNiOwqkf.js → info-BMkB68mB.js} +1 -1
  45. package/dist/cdn/{input-C2OBd4PJ.js → input-BCpgLXU1.js} +2993 -5499
  46. package/dist/cdn/inspector.css +1 -1
  47. package/dist/cdn/inspector.js +7106 -7140
  48. package/dist/cdn/{label-B9Jmm9be.js → label-A0UGV8FE.js} +9 -9
  49. package/dist/cdn/{loader-circle-BLy9A_pp.js → loader-circle-BKRHJEB7.js} +1 -1
  50. package/dist/cdn/{maximize-2-CH5Lq90B.js → maximize-2-DdrB_spi.js} +1 -1
  51. package/dist/cdn/{maximize-BALCV_ep.js → maximize-hSOCz133.js} +1 -1
  52. package/dist/cdn/{message-square-BnxdpJxZ.js → message-square-D3tKB3uJ.js} +1 -1
  53. package/dist/cdn/{not-found-DEtSM_Wd.js → not-found-BajFyZpp.js} +9 -11
  54. package/dist/cdn/{play-vuZ5PLnI.js → play-B1leulYf.js} +1 -1
  55. package/dist/cdn/providerMeta-CjGU4rID.js +436 -0
  56. package/dist/cdn/{react-BajV-X4P.js → react-Bl-hSkvn.js} +628 -571
  57. package/dist/cdn/{refresh-cw-BXY-Pa0U.js → refresh-cw-CyvXrS91.js} +1 -1
  58. package/dist/cdn/{save-Tgil_AJZ.js → save-CmdEPUAm.js} +1 -1
  59. package/dist/cdn/{select-DDdiIPR2.js → select-CCFHjOGk.js} +808 -807
  60. package/dist/cdn/{servers-Dm72iTpY.js → servers-Dd0Vcp81.js} +5 -1
  61. package/dist/cdn/{shared-DaILIQPP.js → shared-CJVHJhag.js} +36 -36
  62. package/dist/cdn/{sheet-Br_l2kry.js → sheet-oyq1mIyg.js} +620 -619
  63. package/dist/cdn/{sparkles-BntO2rDR.js → sparkles-CxeZpVtX.js} +1 -1
  64. package/dist/cdn/spinner-Be1GlSGX.js +15 -0
  65. package/dist/cdn/{square-check-big-BvwQ17Bl.js → square-check-big-C_4wbfwF.js} +1 -1
  66. package/dist/cdn/{switch-C3IyQuid.js → switch-DHXEA_N5.js} +190 -189
  67. package/dist/cdn/{tabs-subtle-CkdI6Mac.js → tabs-subtle-Dubd6Kj8.js} +269 -268
  68. package/dist/cdn/{telemetry-DabTAQ8x.js → telemetry-TwPKZlFf.js} +2 -2
  69. package/dist/cdn/{textarea-DSbwcFVt.js → textarea-CwmI8_uI.js} +6 -6
  70. package/dist/cdn/{trash-2-RwpJY5SL.js → trash-2-BhumJAFE.js} +1 -1
  71. package/dist/cdn/{useAriaLabelledBy-DqAdnppm.js → useAriaLabelledBy-Cra6w3YY.js} +2 -1
  72. package/dist/cdn/{useCompositeItem-BRqEzYh-.js → useCompositeItem-Dhnm-7el.js} +3 -3
  73. package/dist/cdn/{useConfig-Btmh8wjJ.js → useConfig-leHVjdjl.js} +2 -2
  74. package/dist/cdn/{useSavedRequests-Ci2I919u.js → useSavedRequests-mSIsDd4c.js} +1 -1
  75. package/dist/cdn/{useViewHostProps-B6SKeeH9.js → useViewHostProps-CDOm2w6u.js} +124 -109
  76. package/dist/cdn/{wrench-DzGmCfnb.js → wrench-DvK20LUT.js} +1 -1
  77. package/dist/cdn/{x-C3vRQIYu.js → x-EilKPiCX.js} +1 -1
  78. package/dist/cdn/{zap-Mb-pbw2X.js → zap-0Wr9QO7N.js} +1 -1
  79. package/dist/cli.js +1 -1
  80. package/dist/client/components/ChatTab.d.ts.map +1 -1
  81. package/dist/client/components/MCPAppsDebugControls.d.ts.map +1 -1
  82. package/dist/client/components/ToolsTab.d.ts.map +1 -1
  83. package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
  84. package/dist/client/components/chat/MessageList.d.ts +1 -0
  85. package/dist/client/components/chat/MessageList.d.ts.map +1 -1
  86. package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
  87. package/dist/client/components/chat/partialToolArgs.d.ts +10 -0
  88. package/dist/client/components/chat/partialToolArgs.d.ts.map +1 -0
  89. package/dist/client/components/chat/types.d.ts +1 -0
  90. package/dist/client/components/chat/types.d.ts.map +1 -1
  91. package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
  92. package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
  93. package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts +29 -0
  94. package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts.map +1 -0
  95. package/dist/client/components/tools/ToolExecutionPanel.d.ts.map +1 -1
  96. package/dist/client/components/tools/ToolResultDisplay.d.ts +2 -1
  97. package/dist/client/components/tools/ToolResultDisplay.d.ts.map +1 -1
  98. package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
  99. package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -1
  100. package/dist/client/components/ui/mesh-animation-pause.d.ts +14 -0
  101. package/dist/client/components/ui/mesh-animation-pause.d.ts.map +1 -0
  102. package/dist/client/components/ui/mesh-gradient-colors.d.ts +6 -0
  103. package/dist/client/components/ui/mesh-gradient-colors.d.ts.map +1 -0
  104. package/dist/client/components/ui/mesh-tab-background.d.ts +1 -1
  105. package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
  106. package/dist/client/components/ui/not-found.d.ts.map +1 -1
  107. package/dist/client/context/WidgetDebugContext.d.ts +1 -11
  108. package/dist/client/context/WidgetDebugContext.d.ts.map +1 -1
  109. package/dist/client/hooks/useDeviceViewport.d.ts +1 -5
  110. package/dist/client/hooks/useDeviceViewport.d.ts.map +1 -1
  111. package/dist/client/hooks/useViewHostProps.d.ts +1 -1
  112. package/dist/client/hooks/useViewHostProps.d.ts.map +1 -1
  113. package/dist/client/index.js +2238 -1935
  114. package/dist/client/utils/servers.d.ts +5 -0
  115. package/dist/client/utils/servers.d.ts.map +1 -1
  116. package/dist/server/cdn-shell.js +2 -2
  117. package/dist/server/{chunk-ZCGLU5T7.js → chunk-5GVQGIAX.js} +1 -1
  118. package/dist/server/{chunk-DSTNUYWX.js → chunk-UZZDBVKF.js} +1 -1
  119. package/dist/server/{chunk-SQ4XNMLT.js → chunk-VFVFLXKP.js} +1 -1
  120. package/dist/server/cli.js +2 -2
  121. package/dist/server/index.js +3 -3
  122. package/dist/server/middleware.js +3 -3
  123. package/dist/server/version.js +1 -1
  124. package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +9 -0
  125. package/dist/web/assets/ChatTab-B6ubLbeA.js +18 -0
  126. package/dist/web/assets/ConnectionSettingsTab-Cb2eDgEu.js +1 -0
  127. package/dist/web/assets/ElicitationTab-CbnCrmu9.js +1 -0
  128. package/dist/web/assets/FormContext-sV-yByKz.js +1 -0
  129. package/dist/web/assets/ListTabHeader-CrGae306.js +1 -0
  130. package/dist/web/assets/MCPAppsDebugControls-sRglMhat.js +34 -0
  131. package/dist/web/assets/{ManufactOAuthCallback-CS3ydSZg.js → ManufactOAuthCallback-D4uYGigW.js} +1 -1
  132. package/dist/web/assets/{MarkdownRenderer-BeeBfQhv.js → MarkdownRenderer-Cwxp9fLj.js} +2 -2
  133. package/dist/web/assets/McpAppsViewPanel-jQYFoZNX.js +1 -0
  134. package/dist/web/assets/{NotificationsTab-Uj0_DrmK.js → NotificationsTab-DuSm762_.js} +1 -1
  135. package/dist/web/assets/{OAuthCallback-C0ljgCiw.js → OAuthCallback-VLHlUe2c.js} +1 -1
  136. package/dist/web/assets/PromptsTab-DK6XZxR8.js +15 -0
  137. package/dist/web/assets/ResourcesTab-CUE4MAtJ.js +2 -0
  138. package/dist/web/assets/SamplingTab-BYNkVCTu.js +1 -0
  139. package/dist/web/assets/ServerMetadataTab-DWjNFMbq.js +1 -0
  140. package/dist/web/assets/ToolsTab-BisWWY2p.js +8 -0
  141. package/dist/web/assets/{ViewPreview-Ba1Ec5uA.js → ViewPreview-COrmPpRr.js} +1 -1
  142. package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +1 -0
  143. package/dist/web/assets/{brush--0LobUi4.js → brush-DX0UZ_pI.js} +1 -1
  144. package/dist/web/assets/button-C8Xa2k4x.js +1 -0
  145. package/dist/web/assets/checkbox-B6dtF73d.js +1 -0
  146. package/dist/web/assets/code-B14rVdNt.js +1 -0
  147. package/dist/web/assets/createLucideIcon-BEHeJH0M.js +1 -0
  148. package/dist/web/assets/{dist-C5JjLJN9.js → dist-9Oy7e0v8.js} +5 -5
  149. package/dist/web/assets/index-BMaSsizY.js +499 -0
  150. package/dist/web/assets/index-D7TVTIt9.css +1 -0
  151. package/dist/web/assets/input-C0OQCUZy.js +1 -0
  152. package/dist/web/assets/{label-Cdim77Jw.js → label-CI7JWQOo.js} +1 -1
  153. package/dist/web/assets/{maximize-2-BTT9QQU9.js → maximize-2-Br1WQzT2.js} +1 -1
  154. package/dist/web/assets/{maximize-_O55kFcr.js → maximize-CJNgRe6S.js} +1 -1
  155. package/dist/web/assets/{refresh-cw-C9wQl8_d.js → refresh-cw-B5iaAZKn.js} +1 -1
  156. package/dist/web/assets/{save-B-MsgxX9.js → save-TM6fvNrt.js} +1 -1
  157. package/dist/web/assets/select-D6jzbLJn.js +1 -0
  158. package/dist/web/assets/shared-CFs9CZfB.js +1 -0
  159. package/dist/web/assets/{sparkles-2OAsc1aP.js → sparkles-BGYTDThM.js} +1 -1
  160. package/dist/web/assets/tabs-subtle-D2XkWhLL.js +1 -0
  161. package/dist/web/assets/textarea-CRTXuRmE.js +1 -0
  162. package/dist/web/assets/{useConfig-BAgALiZg.js → useConfig-B6tXvJOb.js} +1 -1
  163. package/dist/web/assets/useViewHostProps-DZqOwiAm.js +1 -0
  164. package/dist/web/assets/{zap-Du2Uc5pa.js → zap-BDWHCVHU.js} +1 -1
  165. package/dist/web/index.html +10 -10
  166. package/package.json +4 -4
  167. package/dist/cdn/CheckboxIndicator-Bt4IICtv.js +0 -251
  168. package/dist/cdn/PromptsTab-BYKnY7Rp.js +0 -901
  169. package/dist/cdn/card-DgiYnSg-.js +0 -41
  170. package/dist/cdn/createLucideIcon-C5fZZ6oB.js +0 -38
  171. package/dist/cdn/providerMeta-BQIfHuNL.js +0 -379
  172. package/dist/cdn/spinner-jQtC7EBj.js +0 -15
  173. package/dist/web/assets/AnimatePresence-C5p0yiY1.js +0 -9
  174. package/dist/web/assets/ChatTab-BCobuZDc.js +0 -18
  175. package/dist/web/assets/ConnectionSettingsTab-BjGkLwVu.js +0 -1
  176. package/dist/web/assets/ElicitationTab-D3ZUKHND.js +0 -1
  177. package/dist/web/assets/FormContext-DH2caWKO.js +0 -1
  178. package/dist/web/assets/ListTabHeader-R17w_JsB.js +0 -1
  179. package/dist/web/assets/PromptsTab-Bns2u0G-.js +0 -15
  180. package/dist/web/assets/ResourcesTab-CO24312V.js +0 -2
  181. package/dist/web/assets/SamplingTab-7gtN7FwU.js +0 -1
  182. package/dist/web/assets/ServerMetadataTab-CQwqYSjL.js +0 -1
  183. package/dist/web/assets/ToolsTab-bDdRxI1b.js +0 -8
  184. package/dist/web/assets/WidgetWrapper-CYHfzrtb.js +0 -34
  185. package/dist/web/assets/checkbox-CzBkaNKa.js +0 -1
  186. package/dist/web/assets/code-tME-5H6D.js +0 -1
  187. package/dist/web/assets/createLucideIcon-B3b8EU0b.js +0 -1
  188. package/dist/web/assets/index-TQ5V7cM9.js +0 -492
  189. package/dist/web/assets/index-fBX3akc8.css +0 -1
  190. package/dist/web/assets/input-CLYhA7PK.js +0 -1
  191. package/dist/web/assets/jsx-runtime-Cjj9sGSy.js +0 -1
  192. package/dist/web/assets/select-CJ57-Bor.js +0 -1
  193. package/dist/web/assets/shared-BF0rJNdE.js +0 -1
  194. package/dist/web/assets/tabs-subtle-6D79T1xd.js +0 -1
  195. package/dist/web/assets/textarea-DLAmNVf_.js +0 -1
  196. package/dist/web/assets/useViewHostProps-BYitt_6K.js +0 -1
@@ -1,36 +1,36 @@
1
1
  import { a as e, s as t, t as n } from "./react-BIs9pQ3H.js";
2
- import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as re, p as T, r as E, s as ie, t as D, v as O, w as k, x as ae, y as A } from "./cfWorker-Bxcs9rNe.js";
2
+ import { A as r, C as i, D as a, E as o, I as s, M as c, N as l, O as u, P as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as ee, g as te, h as y, i as b, j as x, k as S, l as C, m as ne, n as w, o as re, p as T, r as E, s as ie, t as ae, v as D, w as O, x as oe, y as k } from "./cfWorker-Bxcs9rNe.js";
3
3
  //#region ../../node_modules/.pnpm/@modelcontextprotocol+core@2.0.0-beta.4/node_modules/@modelcontextprotocol/core/dist/auth-DFgbUATV.mjs
4
- var j = /* @__PURE__ */ t(n(), 1), oe = "io.modelcontextprotocol/related-task", M = "io.modelcontextprotocol/subscriptionId", N = ae(() => x([
4
+ var A = /* @__PURE__ */ t(n(), 1), se = "io.modelcontextprotocol/related-task", j = "io.modelcontextprotocol/subscriptionId", M = oe(() => x([
5
5
  r(),
6
6
  p(),
7
- O(),
7
+ D(),
8
8
  ne(),
9
- S(r(), N),
10
- m(N)
11
- ])), P = S(r(), N);
12
- m(N);
13
- var se = x([r(), p().int()]), F = r(), ce = o({ ttl: p().optional() }), le = o({ taskId: r() }), ue = i({
14
- progressToken: se.optional(),
15
- [oe]: le.optional()
16
- }), I = o({ _meta: ue.optional() }), de = I.extend({ task: ce.optional() }), L = o({
9
+ S(r(), M),
10
+ m(M)
11
+ ])), N = S(r(), M);
12
+ m(M);
13
+ var P = x([r(), p().int()]), ce = r(), le = o({ ttl: p().optional() }), ue = o({ taskId: r() }), F = i({
14
+ progressToken: P.optional(),
15
+ [se]: ue.optional()
16
+ }), I = o({ _meta: F.optional() }), de = I.extend({ task: le.optional() }), L = o({
17
17
  method: r(),
18
18
  params: I.loose().optional()
19
- }), R = o({ _meta: ue.optional() }), z = o({
19
+ }), R = o({ _meta: F.optional() }), z = o({
20
20
  method: r(),
21
21
  params: R.loose().optional()
22
- }), B = i({ _meta: ue.optional() }), fe = x([r(), p().int()]), pe = o({
22
+ }), B = i({ _meta: F.optional() }), fe = x([r(), p().int()]), V = o({
23
23
  jsonrpc: f("2.0"),
24
24
  id: fe,
25
25
  ...L.shape
26
- }).strict(), me = o({
26
+ }).strict(), pe = o({
27
27
  jsonrpc: f("2.0"),
28
28
  ...z.shape
29
- }).strict(), he = o({
29
+ }).strict(), me = o({
30
30
  jsonrpc: f("2.0"),
31
31
  id: fe,
32
32
  result: B
33
- }).strict(), ge = o({
33
+ }).strict(), he = o({
34
34
  jsonrpc: f("2.0"),
35
35
  id: fe.optional(),
36
36
  error: o({
@@ -38,141 +38,141 @@ var se = x([r(), p().int()]), F = r(), ce = o({ ttl: p().optional() }), le = o({
38
38
  message: r(),
39
39
  data: c().optional()
40
40
  })
41
- }).strict(), _e = x([
41
+ }).strict(), ge = x([
42
+ V,
42
43
  pe,
43
44
  me,
44
- he,
45
- ge
45
+ he
46
46
  ]);
47
- x([he, ge]);
48
- var ve = B.strict(), ye = R.extend({
47
+ x([me, he]);
48
+ var _e = B.strict(), ve = R.extend({
49
49
  requestId: fe.optional(),
50
50
  reason: r().optional()
51
- }), be = z.extend({
51
+ }), ye = z.extend({
52
52
  method: f("notifications/cancelled"),
53
- params: ye
54
- }), xe = o({ icons: m(o({
53
+ params: ve
54
+ }), be = o({ icons: m(o({
55
55
  src: r(),
56
56
  mimeType: r().optional(),
57
57
  sizes: m(r()).optional(),
58
58
  theme: T(["light", "dark"]).optional()
59
- })).optional() }), V = o({
59
+ })).optional() }), xe = o({
60
60
  name: r(),
61
61
  title: r().optional()
62
- }), Se = V.extend({
63
- ...V.shape,
62
+ }), Se = xe.extend({
64
63
  ...xe.shape,
64
+ ...be.shape,
65
65
  version: r(),
66
66
  websiteUrl: r().optional(),
67
67
  description: r().optional()
68
68
  }), Ce = u((e) => e && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0 ? { form: {} } : e, g(o({
69
- form: g(o({ applyDefaults: O().optional() }), P).optional(),
70
- url: P.optional()
71
- }), P.optional())), we = i({
72
- list: P.optional(),
73
- cancel: P.optional(),
69
+ form: g(o({ applyDefaults: D().optional() }), N).optional(),
70
+ url: N.optional()
71
+ }), N.optional())), we = i({
72
+ list: N.optional(),
73
+ cancel: N.optional(),
74
74
  requests: i({
75
- sampling: i({ createMessage: P.optional() }).optional(),
76
- elicitation: i({ create: P.optional() }).optional()
75
+ sampling: i({ createMessage: N.optional() }).optional(),
76
+ elicitation: i({ create: N.optional() }).optional()
77
77
  }).optional()
78
78
  }), Te = i({
79
- list: P.optional(),
80
- cancel: P.optional(),
81
- requests: i({ tools: i({ call: P.optional() }).optional() }).optional()
82
- }), Ee = o({
83
- experimental: S(r(), P).optional(),
79
+ list: N.optional(),
80
+ cancel: N.optional(),
81
+ requests: i({ tools: i({ call: N.optional() }).optional() }).optional()
82
+ }), H = o({
83
+ experimental: S(r(), N).optional(),
84
84
  sampling: o({
85
- context: P.optional(),
86
- tools: P.optional()
85
+ context: N.optional(),
86
+ tools: N.optional()
87
87
  }).optional(),
88
88
  elicitation: Ce.optional(),
89
- roots: o({ listChanged: O().optional() }).optional(),
89
+ roots: o({ listChanged: D().optional() }).optional(),
90
90
  tasks: we.optional(),
91
- extensions: S(r(), P).optional()
92
- }), De = I.extend({
91
+ extensions: S(r(), N).optional()
92
+ }), Ee = I.extend({
93
93
  protocolVersion: r(),
94
- capabilities: Ee,
94
+ capabilities: H,
95
95
  clientInfo: Se
96
- }), Oe = L.extend({
96
+ }), De = L.extend({
97
97
  method: f("initialize"),
98
- params: De
99
- }), ke = o({
100
- experimental: S(r(), P).optional(),
101
- logging: P.optional(),
102
- completions: P.optional(),
103
- prompts: o({ listChanged: O().optional() }).optional(),
98
+ params: Ee
99
+ }), Oe = o({
100
+ experimental: S(r(), N).optional(),
101
+ logging: N.optional(),
102
+ completions: N.optional(),
103
+ prompts: o({ listChanged: D().optional() }).optional(),
104
104
  resources: o({
105
- subscribe: O().optional(),
106
- listChanged: O().optional()
105
+ subscribe: D().optional(),
106
+ listChanged: D().optional()
107
107
  }).optional(),
108
- tools: o({ listChanged: O().optional() }).optional(),
108
+ tools: o({ listChanged: D().optional() }).optional(),
109
109
  tasks: Te.optional(),
110
- extensions: S(r(), P).optional()
111
- }), Ae = B.extend({
110
+ extensions: S(r(), N).optional()
111
+ }), ke = B.extend({
112
112
  protocolVersion: r(),
113
- capabilities: ke,
113
+ capabilities: Oe,
114
114
  serverInfo: Se,
115
115
  instructions: r().optional()
116
- }), je = z.extend({
116
+ }), Ae = z.extend({
117
117
  method: f("notifications/initialized"),
118
118
  params: R.optional()
119
- }), Me = L.extend({
119
+ }), je = L.extend({
120
120
  method: f("server/discover"),
121
121
  params: I.optional()
122
- }), Ne = B.extend({
122
+ }), Me = B.extend({
123
123
  supportedVersions: m(r()),
124
- capabilities: ke,
124
+ capabilities: Oe,
125
125
  serverInfo: Se,
126
126
  instructions: r().optional()
127
- }), Pe = L.extend({
127
+ }), Ne = L.extend({
128
128
  method: f("ping"),
129
129
  params: I.optional()
130
- }), Fe = o({
130
+ }), Pe = o({
131
131
  progress: p(),
132
132
  total: a(p()),
133
133
  message: a(r())
134
- }), H = o({
134
+ }), U = o({
135
135
  ...R.shape,
136
- ...Fe.shape,
137
- progressToken: se
138
- }), Ie = z.extend({
136
+ ...Pe.shape,
137
+ progressToken: P
138
+ }), Fe = z.extend({
139
139
  method: f("notifications/progress"),
140
- params: H
141
- }), Le = I.extend({ cursor: F.optional() }), U = L.extend({ params: Le.optional() }), Re = B.extend({ nextCursor: F.optional() }), W = o({
140
+ params: U
141
+ }), Ie = I.extend({ cursor: ce.optional() }), W = L.extend({ params: Ie.optional() }), Le = B.extend({ nextCursor: ce.optional() }), G = o({
142
142
  uri: r(),
143
143
  mimeType: a(r()),
144
144
  _meta: S(r(), c()).optional()
145
- }), ze = W.extend({ text: r() }), G = r().refine((e) => {
145
+ }), Re = G.extend({ text: r() }), K = r().refine((e) => {
146
146
  try {
147
147
  return atob(e), !0;
148
148
  } catch {
149
149
  return !1;
150
150
  }
151
- }, { message: "Invalid Base64 string" }), K = W.extend({ blob: G }), Be = T(["user", "assistant"]), Ve = o({
152
- audience: m(Be).optional(),
151
+ }, { message: "Invalid Base64 string" }), q = G.extend({ blob: K }), ze = T(["user", "assistant"]), Be = o({
152
+ audience: m(ze).optional(),
153
153
  priority: p().min(0).max(1).optional(),
154
154
  lastModified: d({ offset: !0 }).optional()
155
- }), He = o({
156
- ...V.shape,
155
+ }), Ve = o({
157
156
  ...xe.shape,
157
+ ...be.shape,
158
158
  uri: r(),
159
159
  description: a(r()),
160
160
  mimeType: a(r()),
161
161
  size: a(p()),
162
- annotations: Ve.optional(),
162
+ annotations: Be.optional(),
163
163
  _meta: a(i({}))
164
- }), Ue = o({
165
- ...V.shape,
164
+ }), He = o({
166
165
  ...xe.shape,
166
+ ...be.shape,
167
167
  uriTemplate: r(),
168
168
  description: a(r()),
169
169
  mimeType: a(r()),
170
- annotations: Ve.optional(),
170
+ annotations: Be.optional(),
171
171
  _meta: a(i({}))
172
- }), We = U.extend({ method: f("resources/list") }), q = Re.extend({ resources: m(He) }), Ge = U.extend({ method: f("resources/templates/list") }), Ke = Re.extend({ resourceTemplates: m(Ue) }), qe = I.extend({ uri: r() }), Je = qe, Ye = L.extend({
172
+ }), Ue = W.extend({ method: f("resources/list") }), We = Le.extend({ resources: m(Ve) }), Ge = W.extend({ method: f("resources/templates/list") }), Ke = Le.extend({ resourceTemplates: m(He) }), qe = I.extend({ uri: r() }), Je = qe, Ye = L.extend({
173
173
  method: f("resources/read"),
174
174
  params: Je
175
- }), Xe = B.extend({ contents: m(x([ze, K])) }), Ze = z.extend({
175
+ }), Xe = B.extend({ contents: m(x([Re, q])) }), Ze = z.extend({
176
176
  method: f("notifications/resources/list_changed"),
177
177
  params: R.optional()
178
178
  }), Qe = qe, $e = L.extend({
@@ -182,9 +182,9 @@ var ve = B.strict(), ye = R.extend({
182
182
  method: f("resources/unsubscribe"),
183
183
  params: et
184
184
  }), nt = o({
185
- toolsListChanged: O().optional(),
186
- promptsListChanged: O().optional(),
187
- resourcesListChanged: O().optional(),
185
+ toolsListChanged: D().optional(),
186
+ promptsListChanged: D().optional(),
187
+ resourcesListChanged: D().optional(),
188
188
  resourceSubscriptions: m(r()).optional()
189
189
  }), J = I.extend({ notifications: nt }), rt = L.extend({
190
190
  method: f("subscriptions/listen"),
@@ -192,20 +192,20 @@ var ve = B.strict(), ye = R.extend({
192
192
  }), it = R.extend({ notifications: nt }), Y = z.extend({
193
193
  method: f("notifications/subscriptions/acknowledged"),
194
194
  params: it
195
- }), at = i({ [M]: fe }), ot = B.extend({ _meta: at }), st = R.extend({ uri: r() }), ct = z.extend({
195
+ }), at = i({ [j]: fe }), ot = B.extend({ _meta: at }), st = R.extend({ uri: r() }), ct = z.extend({
196
196
  method: f("notifications/resources/updated"),
197
197
  params: st
198
198
  }), lt = o({
199
199
  name: r(),
200
200
  description: a(r()),
201
- required: a(O())
201
+ required: a(D())
202
202
  }), ut = o({
203
- ...V.shape,
204
203
  ...xe.shape,
204
+ ...be.shape,
205
205
  description: a(r()),
206
206
  arguments: a(m(lt)),
207
207
  _meta: a(i({}))
208
- }), dt = U.extend({ method: f("prompts/list") }), ft = Re.extend({ prompts: m(ut) }), pt = I.extend({
208
+ }), dt = W.extend({ method: f("prompts/list") }), ft = Le.extend({ prompts: m(ut) }), pt = I.extend({
209
209
  name: r(),
210
210
  arguments: S(r(), r()).optional()
211
211
  }), mt = L.extend({
@@ -214,19 +214,19 @@ var ve = B.strict(), ye = R.extend({
214
214
  }), ht = o({
215
215
  type: f("text"),
216
216
  text: r(),
217
- annotations: Ve.optional(),
217
+ annotations: Be.optional(),
218
218
  _meta: S(r(), c()).optional()
219
219
  }), gt = o({
220
220
  type: f("image"),
221
- data: G,
221
+ data: K,
222
222
  mimeType: r(),
223
- annotations: Ve.optional(),
223
+ annotations: Be.optional(),
224
224
  _meta: S(r(), c()).optional()
225
225
  }), _t = o({
226
226
  type: f("audio"),
227
- data: G,
227
+ data: K,
228
228
  mimeType: r(),
229
- annotations: Ve.optional(),
229
+ annotations: Be.optional(),
230
230
  _meta: S(r(), c()).optional()
231
231
  }), vt = o({
232
232
  type: f("tool_use"),
@@ -236,17 +236,17 @@ var ve = B.strict(), ye = R.extend({
236
236
  _meta: S(r(), c()).optional()
237
237
  }), yt = o({
238
238
  type: f("resource"),
239
- resource: x([ze, K]),
240
- annotations: Ve.optional(),
239
+ resource: x([Re, q]),
240
+ annotations: Be.optional(),
241
241
  _meta: S(r(), c()).optional()
242
- }), bt = He.extend({ type: f("resource_link") }), xt = x([
242
+ }), bt = Ve.extend({ type: f("resource_link") }), xt = x([
243
243
  ht,
244
244
  gt,
245
245
  _t,
246
246
  bt,
247
247
  yt
248
248
  ]), St = o({
249
- role: Be,
249
+ role: ze,
250
250
  content: xt
251
251
  }), Ct = B.extend({
252
252
  description: r().optional(),
@@ -256,31 +256,31 @@ var ve = B.strict(), ye = R.extend({
256
256
  params: R.optional()
257
257
  }), Tt = o({
258
258
  title: r().optional(),
259
- readOnlyHint: O().optional(),
260
- destructiveHint: O().optional(),
261
- idempotentHint: O().optional(),
262
- openWorldHint: O().optional()
259
+ readOnlyHint: D().optional(),
260
+ destructiveHint: D().optional(),
261
+ idempotentHint: D().optional(),
262
+ openWorldHint: D().optional()
263
263
  }), Et = o({ taskSupport: T([
264
264
  "required",
265
265
  "optional",
266
266
  "forbidden"
267
267
  ]).optional() }), Dt = o({
268
- ...V.shape,
269
268
  ...xe.shape,
269
+ ...be.shape,
270
270
  description: r().optional(),
271
271
  inputSchema: o({
272
272
  type: f("object"),
273
- properties: S(r(), N).optional(),
273
+ properties: S(r(), M).optional(),
274
274
  required: m(r()).optional()
275
275
  }).catchall(c()),
276
276
  outputSchema: i({ $schema: r().optional() }).optional(),
277
277
  annotations: Tt.optional(),
278
278
  execution: Et.optional(),
279
279
  _meta: S(r(), c()).optional()
280
- }), Ot = U.extend({ method: f("tools/list") }), kt = Re.extend({ tools: m(Dt) }), At = B.extend({
280
+ }), Ot = W.extend({ method: f("tools/list") }), kt = Le.extend({ tools: m(Dt) }), At = B.extend({
281
281
  content: m(xt).default([]),
282
282
  structuredContent: c().optional(),
283
- isError: O().optional()
283
+ isError: D().optional()
284
284
  });
285
285
  At.or(B.extend({ toolResult: c() }));
286
286
  var jt = de.extend({
@@ -294,7 +294,7 @@ var jt = de.extend({
294
294
  params: R.optional()
295
295
  });
296
296
  o({
297
- autoRefresh: O().default(!0),
297
+ autoRefresh: D().default(!0),
298
298
  debounceMs: p().int().nonnegative().default(300)
299
299
  });
300
300
  var Pt = T([
@@ -330,20 +330,20 @@ var Pt = T([
330
330
  toolUseId: r().describe("The unique identifier for the corresponding tool call."),
331
331
  content: m(xt),
332
332
  structuredContent: c().optional(),
333
- isError: O().optional(),
333
+ isError: D().optional(),
334
334
  _meta: S(r(), c()).optional()
335
- }), Ht = A("type", [
335
+ }), Ht = k("type", [
336
336
  ht,
337
337
  gt,
338
338
  _t
339
- ]), Ut = A("type", [
339
+ ]), Ut = k("type", [
340
340
  ht,
341
341
  gt,
342
342
  _t,
343
343
  vt,
344
344
  Vt
345
345
  ]), Wt = o({
346
- role: Be,
346
+ role: ze,
347
347
  content: x([Ut, m(Ut)]),
348
348
  _meta: S(r(), c()).optional()
349
349
  }), Gt = de.extend({
@@ -358,7 +358,7 @@ var Pt = T([
358
358
  temperature: p().optional(),
359
359
  maxTokens: p().int(),
360
360
  stopSequences: m(r()).optional(),
361
- metadata: P.optional(),
361
+ metadata: N.optional(),
362
362
  tools: m(Dt).optional(),
363
363
  toolChoice: Bt.optional()
364
364
  }), Kt = L.extend({
@@ -371,7 +371,7 @@ var Pt = T([
371
371
  "stopSequence",
372
372
  "maxTokens"
373
373
  ]).or(r())),
374
- role: Be,
374
+ role: ze,
375
375
  content: Ht
376
376
  }), Jt = B.extend({
377
377
  model: r(),
@@ -381,13 +381,13 @@ var Pt = T([
381
381
  "maxTokens",
382
382
  "toolUse"
383
383
  ]).or(r())),
384
- role: Be,
384
+ role: ze,
385
385
  content: x([Ut, m(Ut)])
386
386
  }), Yt = o({
387
387
  type: f("boolean"),
388
388
  title: r().optional(),
389
389
  description: r().optional(),
390
- default: O().optional()
390
+ default: D().optional()
391
391
  }), Xt = o({
392
392
  type: f("string"),
393
393
  title: r().optional(),
@@ -489,7 +489,7 @@ var Pt = T([
489
489
  content: u((e) => e === null ? void 0 : e, S(r(), x([
490
490
  r(),
491
491
  p(),
492
- O(),
492
+ D(),
493
493
  m(r())
494
494
  ])).optional())
495
495
  }), sn = o({
@@ -511,7 +511,7 @@ var Pt = T([
511
511
  }), dn = B.extend({ completion: i({
512
512
  values: m(r()).max(100),
513
513
  total: a(p().int()),
514
- hasMore: a(O())
514
+ hasMore: a(D())
515
515
  }) }), fn = o({
516
516
  uri: r().startsWith("file://"),
517
517
  name: r().optional(),
@@ -553,18 +553,18 @@ z.extend({
553
553
  }), B.merge(_n), L.extend({
554
554
  method: f("tasks/result"),
555
555
  params: I.extend({ taskId: r() })
556
- }), B.loose(), U.extend({ method: f("tasks/list") }), Re.extend({ tasks: m(_n) }), L.extend({
556
+ }), B.loose(), W.extend({ method: f("tasks/list") }), Le.extend({ tasks: m(_n) }), L.extend({
557
557
  method: f("tasks/cancel"),
558
558
  params: I.extend({ taskId: r() })
559
559
  }), B.merge(_n), x([
560
- Pe,
561
- Oe,
562
- Me,
560
+ Ne,
561
+ De,
562
+ je,
563
563
  un,
564
564
  It,
565
565
  mt,
566
566
  dt,
567
- We,
567
+ Ue,
568
568
  Ge,
569
569
  Ye,
570
570
  $e,
@@ -573,24 +573,24 @@ z.extend({
573
573
  Mt,
574
574
  Ot
575
575
  ]), x([
576
- be,
577
- Ie,
578
- je,
576
+ ye,
577
+ Fe,
578
+ Ae,
579
579
  hn
580
580
  ]), x([
581
- ve,
581
+ _e,
582
582
  qt,
583
583
  Jt,
584
584
  on,
585
585
  mn
586
586
  ]), x([
587
- Pe,
587
+ Ne,
588
588
  Kt,
589
589
  nn,
590
590
  pn
591
591
  ]), x([
592
- be,
593
- Ie,
592
+ ye,
593
+ Fe,
594
594
  Rt,
595
595
  ct,
596
596
  Ze,
@@ -599,13 +599,13 @@ z.extend({
599
599
  Y,
600
600
  an
601
601
  ]), x([
602
- ve,
603
- Ae,
604
- Ne,
602
+ _e,
603
+ ke,
604
+ Me,
605
605
  dn,
606
606
  Ct,
607
607
  ft,
608
- q,
608
+ We,
609
609
  Ke,
610
610
  Xe,
611
611
  At,
@@ -633,10 +633,10 @@ i({
633
633
  resource_documentation: r().optional(),
634
634
  resource_policy_uri: r().url().optional(),
635
635
  resource_tos_uri: r().url().optional(),
636
- tls_client_certificate_bound_access_tokens: O().optional(),
636
+ tls_client_certificate_bound_access_tokens: D().optional(),
637
637
  authorization_details_types_supported: m(r()).optional(),
638
638
  dpop_signing_alg_values_supported: m(r()).optional(),
639
- dpop_bound_access_tokens_required: O().optional()
639
+ dpop_bound_access_tokens_required: D().optional()
640
640
  });
641
641
  var yn = i({
642
642
  issuer: r(),
@@ -657,8 +657,8 @@ var yn = i({
657
657
  introspection_endpoint_auth_methods_supported: m(r()).optional(),
658
658
  introspection_endpoint_auth_signing_alg_values_supported: m(r()).optional(),
659
659
  code_challenge_methods_supported: m(r()).optional(),
660
- client_id_metadata_document_supported: O().optional(),
661
- authorization_response_iss_parameter_supported: O().optional().catch(void 0)
660
+ client_id_metadata_document_supported: D().optional(),
661
+ authorization_response_iss_parameter_supported: D().optional().catch(void 0)
662
662
  });
663
663
  o({
664
664
  ...i({
@@ -691,14 +691,14 @@ o({
691
691
  service_documentation: r().optional(),
692
692
  claims_locales_supported: m(r()).optional(),
693
693
  ui_locales_supported: m(r()).optional(),
694
- claims_parameter_supported: O().optional(),
695
- request_parameter_supported: O().optional(),
696
- request_uri_parameter_supported: O().optional(),
697
- require_request_uri_registration: O().optional(),
694
+ claims_parameter_supported: D().optional(),
695
+ request_parameter_supported: D().optional(),
696
+ request_uri_parameter_supported: D().optional(),
697
+ require_request_uri_registration: D().optional(),
698
698
  op_policy_uri: X.optional(),
699
699
  op_tos_uri: X.optional(),
700
- client_id_metadata_document_supported: O().optional(),
701
- authorization_response_iss_parameter_supported: O().optional().catch(void 0)
700
+ client_id_metadata_document_supported: D().optional(),
701
+ authorization_response_iss_parameter_supported: D().optional().catch(void 0)
702
702
  }).shape,
703
703
  ...yn.pick({ code_challenge_methods_supported: !0 }).shape
704
704
  }), o({
@@ -868,7 +868,7 @@ var Cn = class {
868
868
  ]).describe("CSS variable keys available to MCP apps for theming.").describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."), x([r(), y()]).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation.")).describe("Style variables for theming MCP apps.\n\nIndividual style keys are optional - hosts may provide any subset of these values.\nValues are strings containing CSS values (colors, sizes, font stacks, etc.).\n\nNote: This type uses `Record<K, string | undefined>` rather than `Partial<Record<K, string>>`\nfor compatibility with Zod schema generation. Both are functionally equivalent for validation."), On = o({
869
869
  method: f("ui/open-link"),
870
870
  params: o({ url: r().describe("URL to open in the host's browser") })
871
- }), kn = o({ isError: O().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), An = o({ isError: O().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), jn = o({ isError: O().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), Mn = o({
871
+ }), kn = o({ isError: D().optional().describe("True if the host failed to open the URL (e.g., due to security policy).") }).passthrough(), An = o({ isError: D().optional().describe("True if the download failed (e.g., user cancelled or host denied).") }).passthrough(), jn = o({ isError: D().optional().describe("True if the host rejected or failed to deliver the message.") }).passthrough(), Mn = o({
872
872
  method: f("ui/notifications/sandbox-proxy-ready"),
873
873
  params: o({})
874
874
  }), Nn = o({
@@ -920,8 +920,8 @@ var Rn = S(r(), c()), zn = o({
920
920
  experimental: o({}).optional().describe("Experimental features (structure TBD)."),
921
921
  openLinks: o({}).optional().describe("Host supports opening external URLs."),
922
922
  downloadFile: o({}).optional().describe("Host supports file downloads via ui/download-file."),
923
- serverTools: o({ listChanged: O().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."),
924
- serverResources: o({ listChanged: O().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
923
+ serverTools: o({ listChanged: D().optional().describe("Host supports tools/list_changed notifications.") }).optional().describe("Host can proxy tool calls to the MCP server."),
924
+ serverResources: o({ listChanged: D().optional().describe("Host supports resources/list_changed notifications.") }).optional().describe("Host can proxy resource reads to the MCP server."),
925
925
  logging: o({}).optional().describe("Host accepts log messages."),
926
926
  sandbox: o({
927
927
  permissions: Pn.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),
@@ -932,7 +932,7 @@ var Rn = S(r(), c()), zn = o({
932
932
  sampling: o({ tools: o({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.") }).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")
933
933
  }), Hn = o({
934
934
  experimental: o({}).optional().describe("Experimental features (structure TBD)."),
935
- tools: o({ listChanged: O().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
935
+ tools: o({ listChanged: D().optional().describe("App supports tools/list_changed notifications.") }).optional().describe("App exposes MCP-style tools that the host can call."),
936
936
  availableDisplayModes: m(En).optional().describe("Display modes the app supports.")
937
937
  }), Un = o({
938
938
  method: f("ui/notifications/initialized"),
@@ -942,7 +942,7 @@ o({
942
942
  csp: Nn.optional().describe("Content Security Policy configuration for UI resources."),
943
943
  permissions: Pn.optional().describe("Sandbox permissions requested by the UI resource."),
944
944
  domain: r().optional().describe("Dedicated origin for view sandbox.\n\nUseful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.\n\n**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:\n- Hash-based subdomains (e.g., `{hash}.claudemcpcontent.com`)\n- URL-derived subdomains (e.g., `www-example-com.oaiusercontent.com`)\n\nIf omitted, host uses default sandbox origin (typically per-conversation)."),
945
- prefersBorder: O().optional().describe("Visual boundary preference - true if view prefers a visible border.\n\nBoolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.\n\n- `true`: request visible border + background\n- `false`: request no visible border + background\n- omitted: host decides border")
945
+ prefersBorder: D().optional().describe("Visual boundary preference - true if view prefers a visible border.\n\nBoolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.\n\n- `true`: request visible border + background\n- `false`: request no visible border + background\n- omitted: host decides border")
946
946
  });
947
947
  var Wn = o({
948
948
  method: f("ui/request-display-mode"),
@@ -951,8 +951,8 @@ var Wn = o({
951
951
  o({
952
952
  resourceUri: r().optional(),
953
953
  visibility: m(Kn).optional().describe("Who can access this tool. Default: [\"model\", \"app\"]\n- \"model\": Tool visible to and callable by the agent\n- \"app\": Tool callable by the app from this server only"),
954
- csp: k().optional(),
955
- permissions: k().optional()
954
+ csp: O().optional(),
955
+ permissions: O().optional()
956
956
  }), o({ mimeTypes: m(r()).optional().describe("Array of supported MIME types for UI resources.\nMust include `\"text/html;profile=mcp-app\"` for MCP Apps support.") });
957
957
  var qn = o({
958
958
  method: f("ui/download-file"),
@@ -995,8 +995,8 @@ var Yn = o({
995
995
  f("mobile")
996
996
  ]).optional().describe("Platform type for responsive design decisions."),
997
997
  deviceCapabilities: o({
998
- touch: O().optional().describe("Whether the device supports touch input."),
999
- hover: O().optional().describe("Whether the device supports hover interactions.")
998
+ touch: D().optional().describe("Whether the device supports touch input."),
999
+ hover: D().optional().describe("Whether the device supports hover interactions.")
1000
1000
  }).optional().describe("Device input capabilities."),
1001
1001
  safeAreaInsets: o({
1002
1002
  top: p().describe("Top safe area inset in pixels."),
@@ -1037,7 +1037,7 @@ var Xn = o({
1037
1037
  console.debug("Ignoring message from unknown source", e);
1038
1038
  return;
1039
1039
  }
1040
- let n = _e.safeParse(e.data);
1040
+ let n = ge.safeParse(e.data);
1041
1041
  n.success ? (console.debug("Parsed message", n.data), this.onmessage?.(n.data)) : e.data?.jsonrpc === "2.0" ? (console.error("Failed to parse message", n.error.message, e), this.onerror?.(Error("Invalid JSON-RPC message received: " + n.error.message))) : console.debug("Ignoring non-JSON-RPC message", n.error.message, e);
1042
1042
  };
1043
1043
  }
@@ -1219,7 +1219,7 @@ var nr = [wn], rr = class extends ie {
1219
1219
  set onupdatemodelcontext(e) {
1220
1220
  this.warnIfRequestHandlerReplaced("onupdatemodelcontext", this._onupdatemodelcontext, e), this._onupdatemodelcontext = e, this.setRequestHandler("ui/update-model-context", {
1221
1221
  params: Xn.shape.params,
1222
- result: ve
1222
+ result: _e
1223
1223
  }, async (e, t) => {
1224
1224
  if (!this._onupdatemodelcontext) throw Error("No onupdatemodelcontext handler set");
1225
1225
  return this._onupdatemodelcontext(e, t);
@@ -2135,7 +2135,7 @@ var Vr = class extends Rr {
2135
2135
  a = this.opts.wrapTransport(a, e);
2136
2136
  }
2137
2137
  let o = this.buildClientOptions();
2138
- Z.debug("Creating Client with capabilities:", JSON.stringify(o.capabilities, null, 2)), this.client = new D(this.clientInfo, o), this.setupRootsHandler(), this.setupSamplingHandler(), this.setupElicitationHandler(), Z.debug("Roots/sampling/elicitation handlers registered before connect");
2138
+ Z.debug("Creating Client with capabilities:", JSON.stringify(o.capabilities, null, 2)), this.client = new ae(this.clientInfo, o), this.setupRootsHandler(), this.setupSamplingHandler(), this.setupElicitationHandler(), Z.debug("Roots/sampling/elicitation handlers registered before connect");
2139
2139
  try {
2140
2140
  let e;
2141
2141
  if (await Promise.race([this.client.connect(a), new Promise((t, n) => {
@@ -2198,7 +2198,7 @@ var Vr = class extends Rr {
2198
2198
  }
2199
2199
  await super.cleanupResources();
2200
2200
  }
2201
- }, Hr = "2.0.0-beta.3";
2201
+ }, Hr = "2.0.0-beta.4";
2202
2202
  function Ur() {
2203
2203
  return Hr;
2204
2204
  }
@@ -3577,7 +3577,7 @@ function la(e, t) {
3577
3577
  return n;
3578
3578
  }
3579
3579
  function ua(e) {
3580
- let t = (0, j.useCallback)(async (t, n, r) => {
3580
+ let t = (0, A.useCallback)(async (t, n, r) => {
3581
3581
  let i = la(e, `call tool "${t}"`);
3582
3582
  e.addLog("info", `Calling tool: ${t}`, n);
3583
3583
  let a = Date.now();
@@ -3596,12 +3596,12 @@ function ua(e) {
3596
3596
  executionTimeMs: Date.now() - a
3597
3597
  }).catch(() => {}), n;
3598
3598
  }
3599
- }, [e.addLog]), n = (0, j.useCallback)(async () => {
3599
+ }, [e.addLog]), n = (0, A.useCallback)(async () => {
3600
3600
  let t = la(e, "list resources");
3601
3601
  e.addLog("info", "Listing resources");
3602
3602
  let n = await t.listAllResources();
3603
3603
  e.setResources(n.resources || []);
3604
- }, [e.addLog]), r = (0, j.useCallback)(async (t) => {
3604
+ }, [e.addLog]), r = (0, A.useCallback)(async (t) => {
3605
3605
  let n = la(e, "read resource");
3606
3606
  e.addLog("info", `Reading resource: ${t}`);
3607
3607
  try {
@@ -3617,32 +3617,32 @@ function ua(e) {
3617
3617
  errorType: e instanceof Error ? e.name : "UnknownError"
3618
3618
  }).catch(() => {}), e;
3619
3619
  }
3620
- }, [e.addLog]), i = (0, j.useCallback)(async () => {
3620
+ }, [e.addLog]), i = (0, A.useCallback)(async () => {
3621
3621
  let t = la(e, "list prompts");
3622
3622
  e.addLog("info", "Listing prompts");
3623
3623
  let n = await t.listPrompts();
3624
3624
  e.setPrompts(n.prompts || []);
3625
- }, [e.addLog]), a = (0, j.useCallback)(async () => {
3625
+ }, [e.addLog]), a = (0, A.useCallback)(async () => {
3626
3626
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3627
3627
  e.setTools(await e.connectionRef.current.listTools() || []);
3628
3628
  } catch (t) {
3629
3629
  e.addLog("error", "Failed to refresh tools:", t);
3630
3630
  }
3631
- }, [e.addLog]), o = (0, j.useCallback)(async () => {
3631
+ }, [e.addLog]), o = (0, A.useCallback)(async () => {
3632
3632
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3633
3633
  let t = await e.connectionRef.current.listAllResources();
3634
3634
  e.setResources(t.resources || []);
3635
3635
  } catch (t) {
3636
3636
  e.addLog("warn", "Failed to refresh resources:", t);
3637
3637
  }
3638
- }, [e.addLog]), s = (0, j.useCallback)(async () => {
3638
+ }, [e.addLog]), s = (0, A.useCallback)(async () => {
3639
3639
  if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
3640
3640
  let t = await e.connectionRef.current.listPrompts();
3641
3641
  e.setPrompts(t.prompts || []);
3642
3642
  } catch (t) {
3643
3643
  e.addLog("warn", "Failed to refresh prompts:", t);
3644
3644
  }
3645
- }, [e.addLog]), c = (0, j.useCallback)(async () => {
3645
+ }, [e.addLog]), c = (0, A.useCallback)(async () => {
3646
3646
  let t = await la(e, "refresh resource templates").listResourceTemplates();
3647
3647
  e.isMounted() && e.setResourceTemplates(t.resourceTemplates || []);
3648
3648
  }, [e.addLog]);
@@ -3655,7 +3655,7 @@ function ua(e) {
3655
3655
  refreshResources: o,
3656
3656
  refreshPrompts: s,
3657
3657
  refreshResourceTemplates: c,
3658
- refreshAll: (0, j.useCallback)(() => Promise.all([
3658
+ refreshAll: (0, A.useCallback)(() => Promise.all([
3659
3659
  a(),
3660
3660
  o(),
3661
3661
  c(),
@@ -3666,26 +3666,26 @@ function ua(e) {
3666
3666
  c,
3667
3667
  s
3668
3668
  ]),
3669
- getPrompt: (0, j.useCallback)(async (t, n) => la(e, "get prompt").getPrompt(t, n || {}), [e.addLog]),
3670
- complete: (0, j.useCallback)(async (t) => la(e, "request completion").complete(t), [e.addLog])
3669
+ getPrompt: (0, A.useCallback)(async (t, n) => la(e, "get prompt").getPrompt(t, n || {}), [e.addLog]),
3670
+ complete: (0, A.useCallback)(async (t) => la(e, "request completion").complete(t), [e.addLog])
3671
3671
  };
3672
3672
  }
3673
3673
  var da = 3e3, fa = 5e3;
3674
3674
  function pa(e) {
3675
- let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, re = "http", T = w?.clientId?.trim() || void 0, E = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, D = (0, j.useMemo)(() => T ? { client_id: T } : void 0, [T]), O = (0, j.useMemo)(() => {
3675
+ let { url: t, enabled: n = !0, callbackUrl: r = typeof window < "u" ? Yr(new URL("/oauth/callback", window.location.origin).toString()) : "/oauth/callback", storageKeyPrefix: i = "mcp:auth", authProvider: a, headers: o, proxyConfig: s, oauthProxyUrl: c, autoProxyFallback: l = !1, logLevel: u = "silent", autoRetry: d = !1, autoReconnect: f = !0, reconnectionOptions: p, preventAutoAuth: m = !0, useRedirectFlow: h = !1, onPopupWindow: g, timeout: _ = 3e4, wrapTransport: v, serverId: ee, fetch: te, clientOptions: y, protocolNegotiation: x, onNotification: S, onSampling: C, onElicitation: ne, oauth: w } = e, re = "http", T = w?.clientId?.trim() || void 0, E = w?.clientMetadataUrl?.trim() || void 0, ie = w?.scope?.trim() || void 0, ae = (0, A.useMemo)(() => T ? { client_id: T } : void 0, [T]), D = (0, A.useMemo)(() => {
3676
3676
  let e = `useMcp:${t || "no-url"}`, n = pr.get(e);
3677
3677
  return u && (n.level = u), n;
3678
- }, [t, u]), k = o ?? {}, ae = (0, j.useMemo)(() => Jr(y), [y]), A = C, oe = ne, M = (0, j.useMemo)(() => ({
3678
+ }, [t, u]), O = o ?? {}, oe = (0, A.useMemo)(() => Jr(y), [y]), k = C, se = ne, j = (0, A.useMemo)(() => ({
3679
3679
  name: "mcp-use",
3680
3680
  title: "mcp-use",
3681
3681
  version: Ur(),
3682
3682
  description: "mcp-use is a complete TypeScript framework for building and using MCP",
3683
3683
  icons: [{ src: "https://mcp-use.com/logo.png" }],
3684
3684
  websiteUrl: "https://mcp-use.com"
3685
- }), []), N = (0, j.useMemo)(() => e.clientInfo ? {
3686
- ...M,
3685
+ }), []), M = (0, A.useMemo)(() => e.clientInfo ? {
3686
+ ...j,
3687
3687
  ...e.clientInfo
3688
- } : M, [e.clientInfo, M]), P = (0, j.useMemo)(() => ia(N), [N]), se = (0, j.useMemo)(() => {
3688
+ } : j, [e.clientInfo, j]), N = (0, A.useMemo)(() => ia(M), [M]), P = (0, A.useMemo)(() => {
3689
3689
  if (!l) return {
3690
3690
  enabled: !1,
3691
3691
  proxyAddress: void 0
@@ -3702,7 +3702,7 @@ function pa(e) {
3702
3702
  enabled: l.enabled !== !1 && !!e,
3703
3703
  proxyAddress: e
3704
3704
  };
3705
- }, [l, s]), F = (0, j.useMemo)(() => f === !1 ? {
3705
+ }, [l, s]), ce = (0, A.useMemo)(() => f === !1 ? {
3706
3706
  enabled: !1,
3707
3707
  initialDelay: 0,
3708
3708
  healthCheckInterval: !1,
@@ -3722,93 +3722,93 @@ function pa(e) {
3722
3722
  initialDelay: f.initialDelay ?? da,
3723
3723
  healthCheckInterval: f.healthCheckInterval ?? 1e4,
3724
3724
  healthCheckTimeout: f.healthCheckTimeout ?? 3e4
3725
- }, [f]), [ce, le] = (0, j.useState)(void 0);
3726
- (0, j.useEffect)(() => {
3727
- le(void 0);
3725
+ }, [f]), [le, ue] = (0, A.useState)(void 0);
3726
+ (0, A.useEffect)(() => {
3727
+ ue(void 0);
3728
3728
  }, [t, s]);
3729
- let ue = (0, j.useMemo)(() => {
3730
- if (!ce?.proxyAddress) return s;
3729
+ let F = (0, A.useMemo)(() => {
3730
+ if (!le?.proxyAddress) return s;
3731
3731
  let e = s?.headers ?? {};
3732
3732
  return {
3733
- ...ce,
3733
+ ...le,
3734
3734
  headers: {
3735
3735
  ...e,
3736
- ...ce.headers ?? {}
3736
+ ...le.headers ?? {}
3737
3737
  }
3738
3738
  };
3739
- }, [ce, s]), I = ue?.proxyAddress, de = ue?.headers ?? {}, L = (0, j.useMemo)(() => t || "", [t]), R = (0, j.useMemo)(() => ({
3739
+ }, [le, s]), I = F?.proxyAddress, de = F?.headers ?? {}, L = (0, A.useMemo)(() => t || "", [t]), R = (0, A.useMemo)(() => ({
3740
3740
  ...de,
3741
- ...k
3742
- }), [de, k]), [z, B] = (0, j.useState)("discovering"), [fe, pe] = (0, j.useState)([]), [me, he] = (0, j.useState)([]), [ge, _e] = (0, j.useState)([]), [ve, ye] = (0, j.useState)([]), [be, xe] = (0, j.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [V, Se] = (0, j.useState)(), [Ce, we] = (0, j.useState)(void 0), [Te, Ee] = (0, j.useState)(void 0), [De, Oe] = (0, j.useState)(), [ke, Ae] = (0, j.useState)({}), [je, Me] = (0, j.useState)(void 0), [Ne, Pe] = (0, j.useState)([]), [Fe, H] = (0, j.useState)(void 0), [Ie, Le] = (0, j.useState)(void 0), U = (0, j.useRef)(null), Re = (0, j.useRef)(null), W = (0, j.useRef)(a ?? null), ze = (0, j.useRef)(null), G = (0, j.useRef)(!1), K = (0, j.useRef)(!0), Be = (0, j.useRef)(0), Ve = (0, j.useRef)(0), He = (0, j.useRef)(null), Ue = (0, j.useRef)(!1), We = (0, j.useRef)(!1), q = (0, j.useRef)(z), Ge = (0, j.useRef)(f), Ke = (0, j.useRef)(null), qe = (0, j.useRef)(null), Je = (0, j.useRef)(null), Ye = (0, j.useRef)(A), Xe = (0, j.useRef)(oe), Ze = (0, j.useRef)(A !== void 0), Qe = (0, j.useRef)(oe !== void 0), $e = (0, j.useRef)(S);
3743
- A !== void 0 && (Ye.current = A), oe !== void 0 && (Xe.current = oe), Ze.current = A !== void 0, Qe.current = oe !== void 0, $e.current = S;
3744
- let et = (0, j.useCallback)(async (e) => Ye.current(e), []), tt = (0, j.useCallback)(async (e) => Xe.current(e), []), nt = (0, j.useCallback)((e) => {
3741
+ ...O
3742
+ }), [de, O]), [z, B] = (0, A.useState)("discovering"), [fe, V] = (0, A.useState)([]), [pe, me] = (0, A.useState)([]), [he, ge] = (0, A.useState)([]), [_e, ve] = (0, A.useState)([]), [ye, be] = (0, A.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [xe, Se] = (0, A.useState)(), [Ce, we] = (0, A.useState)(void 0), [Te, H] = (0, A.useState)(void 0), [Ee, De] = (0, A.useState)(), [Oe, ke] = (0, A.useState)({}), [Ae, je] = (0, A.useState)(void 0), [Me, Ne] = (0, A.useState)([]), [Pe, U] = (0, A.useState)(void 0), [Fe, Ie] = (0, A.useState)(void 0), W = (0, A.useRef)(null), Le = (0, A.useRef)(null), G = (0, A.useRef)(a ?? null), Re = (0, A.useRef)(null), K = (0, A.useRef)(!1), q = (0, A.useRef)(!0), ze = (0, A.useRef)(0), Be = (0, A.useRef)(0), Ve = (0, A.useRef)(null), He = (0, A.useRef)(!1), Ue = (0, A.useRef)(!1), We = (0, A.useRef)(z), Ge = (0, A.useRef)(f), Ke = (0, A.useRef)(null), qe = (0, A.useRef)(null), Je = (0, A.useRef)(null), Ye = (0, A.useRef)(k), Xe = (0, A.useRef)(se), Ze = (0, A.useRef)(k !== void 0), Qe = (0, A.useRef)(se !== void 0), $e = (0, A.useRef)(S);
3743
+ k !== void 0 && (Ye.current = k), se !== void 0 && (Xe.current = se), Ze.current = k !== void 0, Qe.current = se !== void 0, $e.current = S;
3744
+ let et = (0, A.useCallback)(async (e) => Ye.current(e), []), tt = (0, A.useCallback)(async (e) => Xe.current(e), []), nt = (0, A.useCallback)((e) => {
3745
3745
  $e.current?.(e);
3746
3746
  }, []);
3747
- (0, j.useEffect)(() => {
3748
- q.current = z, Ge.current = f;
3749
- }, [z, f]), (0, j.useEffect)(() => {
3750
- W.current = a ?? null;
3747
+ (0, A.useEffect)(() => {
3748
+ We.current = z, Ge.current = f;
3749
+ }, [z, f]), (0, A.useEffect)(() => {
3750
+ G.current = a ?? null;
3751
3751
  }, [a]);
3752
- let J = (0, j.useCallback)((e, t, ...n) => {
3752
+ let J = (0, A.useCallback)((e, t, ...n) => {
3753
3753
  let r = n.length > 0 ? `${t} ${n.map((e) => JSON.stringify(e)).join(" ")}` : t, i = `[useMcp] ${r}`;
3754
3754
  switch (e) {
3755
3755
  case "error":
3756
- O.error(i);
3756
+ D.error(i);
3757
3757
  break;
3758
3758
  case "warn":
3759
- O.warn(i);
3759
+ D.warn(i);
3760
3760
  break;
3761
3761
  case "info":
3762
- O.info(i);
3762
+ D.info(i);
3763
3763
  break;
3764
3764
  case "debug":
3765
- O.debug(i);
3765
+ D.debug(i);
3766
3766
  break;
3767
- default: O.info(i);
3767
+ default: D.info(i);
3768
3768
  }
3769
- K.current && Pe((t) => [...t.slice(-100), {
3769
+ q.current && Ne((t) => [...t.slice(-100), {
3770
3770
  level: e,
3771
3771
  message: r,
3772
3772
  timestamp: Date.now()
3773
3773
  }]);
3774
- }, [O]), rt = ua({
3775
- stateRef: q,
3776
- connectionRef: Re,
3777
- hasClient: () => U.current !== null,
3778
- isMounted: () => K.current,
3779
- setTools: pe,
3780
- setResources: he,
3781
- setResourceTemplates: _e,
3782
- setPrompts: ye,
3774
+ }, [D]), rt = ua({
3775
+ stateRef: We,
3776
+ connectionRef: Le,
3777
+ hasClient: () => W.current !== null,
3778
+ isMounted: () => q.current,
3779
+ setTools: V,
3780
+ setResources: me,
3781
+ setResourceTemplates: ge,
3782
+ setPrompts: ve,
3783
3783
  addLog: J
3784
- }), it = (0, j.useCallback)(async (e = !1) => {
3785
- e || J("info", "Disconnecting..."), G.current = !1, He.current && clearTimeout(He.current), He.current = null;
3786
- let t = Ve.current, n = U.current;
3784
+ }), it = (0, A.useCallback)(async (e = !1) => {
3785
+ e || J("info", "Disconnecting..."), K.current = !1, Ve.current && clearTimeout(Ve.current), Ve.current = null;
3786
+ let t = Be.current, n = W.current;
3787
3787
  if (n) try {
3788
- let e = ea, t = n === U.current ? Re.current : null;
3788
+ let e = ea, t = n === W.current ? Le.current : null;
3789
3789
  t && t._healthCheckCleanup && (t._healthCheckCleanup(), t._healthCheckCleanup = null), t && await n.closeSession(e);
3790
3790
  } catch (t) {
3791
3791
  e || J("warn", "Error closing connection:", t);
3792
3792
  }
3793
- let r = Ve.current !== t;
3794
- U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (B("discovering"), pe([]), he([]), _e([]), ye([]), Me(void 0), H(void 0), Le(void 0), xe(void 0), Se(void 0), we(void 0), Ee(void 0), Oe(void 0), Ae({}));
3795
- }, [J]), Y = (0, j.useCallback)((e, n) => {
3793
+ let r = Be.current !== t;
3794
+ W.current === n && !r && (W.current = null, Le.current = null), q.current && !e && !r && (B("discovering"), V([]), me([]), ge([]), ve([]), je(void 0), U(void 0), Ie(void 0), be(void 0), Se(void 0), we(void 0), H(void 0), De(void 0), ke({}));
3795
+ }, [J]), Y = (0, A.useCallback)((e, n) => {
3796
3796
  J("error", e, n ?? "");
3797
- let r = n && "code" in n ? n.code : void 0, i = se.enabled && !ue?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
- if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), U.current = null, a || (W.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), le({ proxyAddress: se.proxyAddress }), K.current && B("discovering"), setTimeout(() => {
3799
- K.current && qe.current?.();
3797
+ let r = n && "code" in n ? n.code : void 0, i = P.enabled && !F?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
3798
+ if (i && (o || s || typeof r == "number" && r >= 404 && r < 500) && !(r === 401 || r === 403)) return J("info", `Direct connection failed with ${o ? "CORS error" : s ? "HTTP 400 (Bad Request)" : "HTTP 4xx error"}. Trying with proxy...`), W.current = null, a || (G.current = null), J("debug", "Cleared client and auth provider for proxy fallback"), ue({ proxyAddress: P.proxyAddress }), q.current && B("discovering"), setTimeout(() => {
3799
+ q.current && qe.current?.();
3800
3800
  }, 1e3), !0;
3801
- if (K.current) {
3802
- J("info", "Setting state to FAILED:", e), B("failed"), Me(e);
3803
- let t = W.current?.getLastAttemptedAuthUrl?.();
3804
- t && (H(t), J("info", "Manual authentication URL may be available.", t));
3801
+ if (q.current) {
3802
+ J("info", "Setting state to FAILED:", e), B("failed"), je(e);
3803
+ let t = G.current?.getLastAttemptedAuthUrl?.();
3804
+ t && (U(t), J("info", "Manual authentication URL may be available.", t));
3805
3805
  }
3806
- return G.current = !1, t && Pi.getInstance().trackUseMcpConnection({
3806
+ return K.current = !1, t && Pi.getInstance().trackUseMcpConnection({
3807
3807
  url: t,
3808
3808
  transportType: re,
3809
3809
  success: !1,
3810
3810
  errorType: n?.name || "UnknownError",
3811
- hasOAuth: !!W.current,
3811
+ hasOAuth: !!G.current,
3812
3812
  hasSampling: Ze.current,
3813
3813
  hasElicitation: Qe.current
3814
3814
  }).catch(() => {}), !1;
@@ -3816,27 +3816,27 @@ function pa(e) {
3816
3816
  J,
3817
3817
  t,
3818
3818
  re,
3819
- se,
3820
- ue,
3819
+ P,
3820
+ F,
3821
3821
  a
3822
- ]), at = (0, j.useCallback)(async () => {
3822
+ ]), at = (0, A.useCallback)(async () => {
3823
3823
  if (!n || !t) {
3824
3824
  J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag.");
3825
3825
  return;
3826
3826
  }
3827
- if (G.current) {
3827
+ if (K.current) {
3828
3828
  J("debug", "Connection attempt already in progress.");
3829
3829
  return;
3830
3830
  }
3831
- if (!K.current) {
3831
+ if (!q.current) {
3832
3832
  J("debug", "Connect called after unmount, aborting.");
3833
3833
  return;
3834
3834
  }
3835
- if (G.current = !0, Ve.current += 1, Be.current += 1, Me(void 0), H(void 0), Ke.current = null, B("discovering"), pe([]), he([]), _e([]), ye([]), xe(void 0), Se(void 0), we(void 0), Ee(void 0), Oe(void 0), Ae({}), J("info", `Connecting attempt #${Be.current} to ${t}...`), !W.current) {
3835
+ if (K.current = !0, Be.current += 1, ze.current += 1, je(void 0), U(void 0), Ke.current = null, B("discovering"), V([]), me([]), ge([]), ve([]), be(void 0), Se(void 0), we(void 0), H(void 0), De(void 0), ke({}), J("info", `Connecting attempt #${ze.current} to ${t}...`), !G.current) {
3836
3836
  let { provider: e, oauthProxyUrl: t } = sa({
3837
3837
  effectiveOAuthUrl: L,
3838
3838
  storageKeyPrefix: i,
3839
- oauthClientConfig: P,
3839
+ oauthClientConfig: N,
3840
3840
  callbackUrl: r,
3841
3841
  preventAutoAuth: m,
3842
3842
  useRedirectFlow: h,
@@ -3844,37 +3844,37 @@ function pa(e) {
3844
3844
  oauthProxyUrl: c,
3845
3845
  onPopupWindow: g,
3846
3846
  proxyOAuthRequests: !0,
3847
- staticClientInfo: D,
3847
+ staticClientInfo: ae,
3848
3848
  clientMetadataUrl: E,
3849
3849
  scope: ie
3850
3850
  });
3851
- W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
3851
+ G.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
3852
3852
  }
3853
- U.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (U.current = new Ki(), J("debug", "BrowserMCPClient initialized in connect."));
3853
+ W.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (W.current = new Ki(), J("debug", "BrowserMCPClient initialized in connect."));
3854
3854
  let e = async (n) => {
3855
- if (!K.current) return J("debug", "Connection attempt aborted - component unmounted"), "failed";
3856
- J("info", `Attempting connection with transport: ${n}`), J("debug", `Client ref status at start of tryConnectWithTransport: ${U.current ? "initialized" : "NULL"}`);
3855
+ if (!q.current) return J("debug", "Connection attempt aborted - component unmounted"), "failed";
3856
+ J("info", `Attempting connection with transport: ${n}`), J("debug", `Client ref status at start of tryConnectWithTransport: ${W.current ? "initialized" : "NULL"}`);
3857
3857
  try {
3858
3858
  let e = ea, r = {
3859
3859
  url: t,
3860
3860
  timeout: _,
3861
- clientInfo: N,
3861
+ clientInfo: M,
3862
3862
  ...(() => {
3863
- let e = W.current?.getProxyFetch?.(te) ?? te;
3863
+ let e = G.current?.getProxyFetch?.(te) ?? te;
3864
3864
  return e ? { fetch: e } : {};
3865
3865
  })(),
3866
- ...ae && { clientOptions: ae },
3866
+ ...oe && { clientOptions: oe },
3867
3867
  ...x !== void 0 && { protocolNegotiation: x },
3868
3868
  ...p ? { reconnectionOptions: p } : f === !1 ? { reconnectionOptions: { maxRetries: 0 } } : {}
3869
3869
  };
3870
- if (I && (r.gatewayUrl = I, J("debug", `Using proxy gateway: ${I} for target: ${t}`)), R && Object.keys(R).length > 0 && (r.headers = R), !U.current) {
3871
- if (!K.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
3870
+ if (I && (r.gatewayUrl = I, J("debug", `Using proxy gateway: ${I} for target: ${t}`)), R && Object.keys(R).length > 0 && (r.headers = R), !W.current) {
3871
+ if (!q.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
3872
3872
  let e = /* @__PURE__ */ Error("Client not initialized - this is a bug in the connection flow");
3873
3873
  throw J("error", "Client ref is null in tryConnectWithTransport but component is still mounted"), e;
3874
3874
  }
3875
- U.current.addServer(e, {
3875
+ W.current.addServer(e, {
3876
3876
  ...r,
3877
- authProvider: W.current,
3877
+ authProvider: G.current,
3878
3878
  onSampling: Ze.current ? et : void 0,
3879
3879
  onElicitation: Qe.current ? tt : void 0,
3880
3880
  onNotification: (e) => {
@@ -3882,15 +3882,15 @@ function pa(e) {
3882
3882
  },
3883
3883
  wrapTransport: v ? (n) => (J("debug", "Applying transport wrapper for server:", e, "url:", t), v(n, ee ?? t)) : void 0
3884
3884
  });
3885
- let i = await U.current.connect(e);
3886
- if (Re.current = i, !K.current) return J("debug", "Connection aborted after connection creation - component unmounted"), "failed";
3887
- J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), F.enabled && F.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3885
+ let i = await W.current.connect(e);
3886
+ if (Le.current = i, !q.current) return J("debug", "Connection aborted after connection creation - component unmounted"), "failed";
3887
+ J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), ce.enabled && ce.healthCheckInterval !== !1 && (i._healthCheckCleanup = ca({
3888
3888
  gatewayUrl: I,
3889
3889
  url: t,
3890
3890
  allHeaders: R,
3891
3891
  getAuthHeaders: async () => {
3892
3892
  try {
3893
- let e = await W.current?.tokens?.();
3893
+ let e = await G.current?.tokens?.();
3894
3894
  if (e?.access_token) {
3895
3895
  let t = e.token_type || "bearer";
3896
3896
  return { Authorization: `${t.charAt(0).toUpperCase() + t.slice(1)} ${e.access_token}` };
@@ -3898,62 +3898,62 @@ function pa(e) {
3898
3898
  } catch {}
3899
3899
  return {};
3900
3900
  },
3901
- isMountedRef: K,
3902
- stateRef: q,
3901
+ isMountedRef: q,
3902
+ stateRef: We,
3903
3903
  autoReconnectRef: Ge,
3904
3904
  setState: B,
3905
3905
  addLog: J,
3906
3906
  connect: at,
3907
- defaultReconnectDelay: F.initialDelay,
3908
- healthCheckIntervalMs: F.healthCheckInterval,
3909
- healthCheckTimeoutMs: F.healthCheckTimeout
3907
+ defaultReconnectDelay: ce.initialDelay,
3908
+ healthCheckIntervalMs: ce.healthCheckInterval,
3909
+ healthCheckTimeoutMs: ce.healthCheckTimeout
3910
3910
  })), Pi.getInstance().trackUseMcpConnection({
3911
3911
  url: t,
3912
3912
  transportType: n,
3913
3913
  success: !0,
3914
- hasOAuth: !!W.current,
3914
+ hasOAuth: !!G.current,
3915
3915
  hasSampling: Ze.current,
3916
3916
  hasElicitation: Qe.current
3917
- }).catch(() => {}), pe(i.tools || []);
3917
+ }).catch(() => {}), V(i.tools || []);
3918
3918
  let [a, o, s] = await Promise.all([
3919
3919
  i.listAllResources(),
3920
3920
  i.listPrompts(),
3921
3921
  i.supports("resources") ? i.listResourceTemplates() : Promise.resolve({ resourceTemplates: [] })
3922
3922
  ]);
3923
- if (!K.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
3924
- he(a.resources || []), ye(o.prompts || []), _e(s.resourceTemplates || []);
3923
+ if (!q.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
3924
+ me(a.resources || []), ve(o.prompts || []), ge(s.resourceTemplates || []);
3925
3925
  let { server: c, capabilities: l, protocolEra: u, protocolVersion: d, instructions: m, extensions: h } = i.info;
3926
- if (K.current && (we(u), Ee(d), Oe(m), Ae(h)), c) {
3927
- if (J("debug", "Server info:", c), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3928
- xe(c), ze.current = na({
3926
+ if (q.current && (we(u), H(d), De(m), ke(h)), c) {
3927
+ if (J("debug", "Server info:", c), !q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3928
+ be(c), Re.current = na({
3929
3929
  serverInfo: c,
3930
3930
  url: t,
3931
- isMounted: () => K.current,
3932
- setServerInfo: xe,
3931
+ isMounted: () => q.current,
3932
+ setServerInfo: be,
3933
3933
  addLog: J
3934
3934
  });
3935
3935
  }
3936
3936
  if (l) {
3937
- if (J("debug", "Server capabilities:", l), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3937
+ if (J("debug", "Server capabilities:", l), !q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3938
3938
  Se(l);
3939
3939
  }
3940
- if (W.current) {
3941
- let e = await W.current.tokens?.();
3942
- if (!K.current) return J("debug", "Connection aborted after token fetch for auth tokens - component unmounted"), "failed";
3940
+ if (G.current) {
3941
+ let e = await G.current.tokens?.();
3942
+ if (!q.current) return J("debug", "Connection aborted after token fetch for auth tokens - component unmounted"), "failed";
3943
3943
  if (e?.access_token) {
3944
3944
  let t = e.expires_in ? Date.now() + e.expires_in * 1e3 : void 0, n = null, r = null;
3945
3945
  try {
3946
- n = await W.current.getTokenEndpoint?.() ?? null;
3946
+ n = await G.current.getTokenEndpoint?.() ?? null;
3947
3947
  } catch {
3948
3948
  n = null;
3949
3949
  }
3950
3950
  try {
3951
- r = await W.current.getClientCredentials?.() ?? null;
3951
+ r = await G.current.getClientCredentials?.() ?? null;
3952
3952
  } catch {
3953
3953
  r = null;
3954
3954
  }
3955
- if (!K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3956
- Le({
3955
+ if (!q.current) return J("debug", "Skipping state update - component unmounted"), "failed";
3956
+ Ie({
3957
3957
  access_token: e.access_token,
3958
3958
  token_type: e.token_type || "Bearer",
3959
3959
  expires_at: t,
@@ -3967,33 +3967,33 @@ function pa(e) {
3967
3967
  }
3968
3968
  return Ke.current = n, B("ready"), "success";
3969
3969
  } catch (r) {
3970
- let i = r, a = i?.message || String(r), o = W.current?.getLastAttemptedAuthUrl?.();
3971
- if (o && W.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), K.current && (B("pending_auth"), H(o)), G.current = !1, "auth_redirect";
3970
+ let i = r, a = i?.message || String(r), o = G.current?.getLastAttemptedAuthUrl?.();
3971
+ if (o && G.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), q.current && (B("pending_auth"), U(o)), K.current = !1, "auth_redirect";
3972
3972
  let s = aa(r), c = Ii(r);
3973
- if (s && k && Object.keys(k).length > 0) return Y("Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct."), "failed";
3974
- if (s && (!k || Object.keys(k).length === 0)) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3973
+ if (s && O && Object.keys(O).length > 0) return Y("Authentication failed (HTTP 401). Server does not support OAuth. Check your Authorization header value is correct."), "failed";
3974
+ if (s && (!O || Object.keys(O).length === 0)) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3975
3975
  if (c) {
3976
3976
  if (s) return Y("Authentication required (HTTP 401). Server does not support OAuth. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed";
3977
- if (W.current) if (J("info", "Authentication required. OAuth provider available."), m) {
3978
- if (J("info", "Waiting for user to initiate authentication flow..."), K.current) {
3977
+ if (G.current) if (J("info", "Authentication required. OAuth provider available."), m) {
3978
+ if (J("info", "Waiting for user to initiate authentication flow..."), q.current) {
3979
3979
  B("pending_auth");
3980
- let e = W.current?.getLastAttemptedAuthUrl?.();
3981
- e && (H(e), J("info", "Retrieved stored auth URL for manual authentication"));
3980
+ let e = G.current?.getLastAttemptedAuthUrl?.();
3981
+ e && (U(e), J("info", "Retrieved stored auth URL for manual authentication"));
3982
3982
  }
3983
- return G.current = !1, "auth_redirect";
3983
+ return K.current = !1, "auth_redirect";
3984
3984
  } else {
3985
3985
  J("info", "Triggering automatic OAuth authentication flow...");
3986
3986
  try {
3987
- if (await b(W.current, {
3987
+ if (await b(G.current, {
3988
3988
  serverUrl: t,
3989
- fetchFn: W.current.getProxyFetch?.()
3989
+ fetchFn: G.current.getProxyFetch?.()
3990
3990
  }) === "REDIRECT") {
3991
- let e = await W.current.getAuthorizationCode?.();
3991
+ let e = await G.current.getAuthorizationCode?.();
3992
3992
  if (!e) throw Error("Authorization code not captured by headless provider");
3993
- await b(W.current, {
3993
+ await b(G.current, {
3994
3994
  serverUrl: t,
3995
3995
  authorizationCode: e,
3996
- fetchFn: W.current.getProxyFetch?.()
3996
+ fetchFn: G.current.getProxyFetch?.()
3997
3997
  });
3998
3998
  }
3999
3999
  return J("info", "OAuth flow completed, reconnecting..."), await e(n);
@@ -4001,12 +4001,12 @@ function pa(e) {
4001
4001
  return Y(`Automatic OAuth authentication failed: ${e instanceof Error ? e.message : String(e)}`, e instanceof Error ? e : Error(String(e))), "failed";
4002
4002
  }
4003
4003
  }
4004
- return k && Object.keys(k).length > 0 ? (Y("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."), "failed") : (Y("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed");
4004
+ return O && Object.keys(O).length > 0 ? (Y("Authentication failed: Server returned 401 Unauthorized. Check your Authorization header value is correct."), "failed") : (Y("Authentication required: Server returned 401 Unauthorized. Add an Authorization header in the Custom Headers section (e.g., Authorization: Bearer YOUR_API_KEY)."), "failed");
4005
4005
  }
4006
4006
  return Y(a, i instanceof Error ? i : Error(String(i))) ? "auth_redirect" : "failed";
4007
4007
  }
4008
4008
  }, a = "failed";
4009
- J("debug", "Connecting via streamable HTTP"), a = await e("http"), (a === "success" || a === "failed" || a === "auth_redirect") && (G.current = !1), J("debug", `Connection sequence finished with status: ${a}`);
4009
+ J("debug", "Connecting via streamable HTTP"), a = await e("http"), (a === "success" || a === "failed" || a === "auth_redirect") && (K.current = !1), J("debug", `Connection sequence finished with status: ${a}`);
4010
4010
  }, [
4011
4011
  J,
4012
4012
  Y,
@@ -4014,22 +4014,22 @@ function pa(e) {
4014
4014
  t,
4015
4015
  i,
4016
4016
  r,
4017
- P.name,
4018
- P.version,
4019
- P.uri,
4020
- P.logo_uri,
4021
- D,
4017
+ N.name,
4018
+ N.version,
4019
+ N.uri,
4020
+ N.logo_uri,
4021
+ ae,
4022
4022
  E,
4023
4023
  ie,
4024
- k,
4024
+ O,
4025
4025
  re,
4026
4026
  m,
4027
4027
  h,
4028
4028
  g,
4029
4029
  n,
4030
4030
  _,
4031
- N,
4032
- ae,
4031
+ M,
4032
+ oe,
4033
4033
  x,
4034
4034
  I,
4035
4035
  c,
@@ -4039,32 +4039,32 @@ function pa(e) {
4039
4039
  tt,
4040
4040
  nt
4041
4041
  ]);
4042
- (0, j.useEffect)(() => {
4042
+ (0, A.useEffect)(() => {
4043
4043
  qe.current = at, Je.current = Y;
4044
4044
  }, [at, Y]);
4045
- let ot = (0, j.useCallback)(() => {
4046
- q.current === "failed" ? (J("info", "Retry requested..."), qe.current?.()) : J("warn", `Retry called but state is not 'failed' (state: ${q.current}). Ignoring.`);
4047
- }, [J]), st = (0, j.useCallback)(async () => {
4045
+ let ot = (0, A.useCallback)(() => {
4046
+ We.current === "failed" ? (J("info", "Retry requested..."), qe.current?.()) : J("warn", `Retry called but state is not 'failed' (state: ${We.current}). Ignoring.`);
4047
+ }, [J]), st = (0, A.useCallback)(async () => {
4048
4048
  J("info", "Manual authentication requested...");
4049
- let e = q.current;
4049
+ let e = We.current;
4050
4050
  if (e === "failed") J("info", "Attempting to reconnect and authenticate via retry..."), ot();
4051
4051
  else if (e === "pending_auth") {
4052
4052
  J("info", "Proceeding with authentication from pending state...");
4053
4053
  try {
4054
- if (ta(W.current, "Auth Provider not available for manual auth"), ta(t, "Server URL is required for authentication"), a) {
4054
+ if (ta(G.current, "Auth Provider not available for manual auth"), ta(t, "Server URL is required for authentication"), a) {
4055
4055
  J("info", "Using provided authProvider for manual authentication");
4056
4056
  let e = new URL(t), n = e.origin + e.pathname.replace(/\/+$/, "");
4057
- await b(W.current, {
4057
+ await b(G.current, {
4058
4058
  serverUrl: n,
4059
- fetchFn: W.current.getProxyFetch?.()
4059
+ fetchFn: G.current.getProxyFetch?.()
4060
4060
  }), qe.current?.();
4061
4061
  return;
4062
4062
  }
4063
- J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), B("authenticating");
4063
+ J("info", `Cleared ${G.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), B("authenticating");
4064
4064
  let e = null, n = null, { provider: o, oauthProxyUrl: s } = sa({
4065
4065
  effectiveOAuthUrl: L,
4066
4066
  storageKeyPrefix: i,
4067
- oauthClientConfig: P,
4067
+ oauthClientConfig: N,
4068
4068
  callbackUrl: r,
4069
4069
  preventAutoAuth: !1,
4070
4070
  useRedirectFlow: h,
@@ -4078,11 +4078,11 @@ function pa(e) {
4078
4078
  g?.(t, r, i);
4079
4079
  },
4080
4080
  proxyOAuthRequests: !0,
4081
- staticClientInfo: D,
4081
+ staticClientInfo: ae,
4082
4082
  clientMetadataUrl: E,
4083
4083
  scope: ie
4084
4084
  });
4085
- s && J("info", "Scoped OAuth proxy fetch enabled for manual auth"), W.current = o, J("info", "Triggering fresh OAuth authorization...");
4085
+ s && J("info", "Scoped OAuth proxy fetch enabled for manual auth"), G.current = o, J("info", "Triggering fresh OAuth authorization...");
4086
4086
  let l = new URL(t), u = l.origin + l.pathname.replace(/\/+$/, "");
4087
4087
  try {
4088
4088
  await b(o, {
@@ -4093,7 +4093,7 @@ function pa(e) {
4093
4093
  J("info", "OAuth flow initiated (popup/redirect):", e instanceof Error ? e.message : "Redirecting...");
4094
4094
  }
4095
4095
  let d = o.getLastAttemptedAuthUrl?.();
4096
- if (d && (H(d), J("info", "Updated auth URL for fallback:", d), !n)) try {
4096
+ if (d && (U(d), J("info", "Updated auth URL for fallback:", d), !n)) try {
4097
4097
  n = new URL(d).searchParams.get("state");
4098
4098
  } catch {}
4099
4099
  if (h) return;
@@ -4102,7 +4102,7 @@ function pa(e) {
4102
4102
  J("warn", "Could not derive tokens storage key; relying on callback listener.");
4103
4103
  return;
4104
4104
  }
4105
- We.current = !0;
4105
+ Ue.current = !0;
4106
4106
  let p;
4107
4107
  try {
4108
4108
  p = await Or({
@@ -4111,12 +4111,12 @@ function pa(e) {
4111
4111
  tokensKey: f
4112
4112
  });
4113
4113
  } finally {
4114
- We.current = !1;
4114
+ Ue.current = !1;
4115
4115
  }
4116
- if (!K.current) return;
4116
+ if (!q.current) return;
4117
4117
  switch (p.kind) {
4118
4118
  case "success":
4119
- J("info", "Authentication succeeded; reconnecting to MCP server..."), G.current = !1, qe.current?.();
4119
+ J("info", "Authentication succeeded; reconnecting to MCP server..."), K.current = !1, qe.current?.();
4120
4120
  break;
4121
4121
  case "cancelled":
4122
4122
  J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), B("pending_auth");
@@ -4130,57 +4130,57 @@ function pa(e) {
4130
4130
  default: break;
4131
4131
  }
4132
4132
  } catch (e) {
4133
- if (!K.current) return;
4133
+ if (!q.current) return;
4134
4134
  B("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
4135
4135
  }
4136
4136
  } else if (e === "authenticating") {
4137
4137
  J("warn", "Already attempting authentication. Check for blocked popups or wait for timeout.");
4138
- let e = W.current?.getLastAttemptedAuthUrl?.();
4139
- e && !Fe && (H(e), J("info", "Manual authentication URL retrieved:", e));
4138
+ let e = G.current?.getLastAttemptedAuthUrl?.();
4139
+ e && !Pe && (U(e), J("info", "Manual authentication URL retrieved:", e));
4140
4140
  } else J("info", `Client not in a state requiring manual authentication trigger (state: ${e}). If needed, try disconnecting and reconnecting.`);
4141
4141
  }, [
4142
4142
  J,
4143
4143
  ot,
4144
4144
  Y,
4145
- Fe,
4145
+ Pe,
4146
4146
  t,
4147
4147
  h,
4148
4148
  g,
4149
4149
  i,
4150
- P.name,
4151
- P.uri,
4152
- P.logo_uri,
4153
- D,
4150
+ N.name,
4151
+ N.uri,
4152
+ N.logo_uri,
4153
+ ae,
4154
4154
  E,
4155
4155
  ie,
4156
4156
  r,
4157
- N,
4157
+ M,
4158
4158
  a
4159
- ]), ct = (0, j.useCallback)(() => {
4160
- W.current?.clearStorage ? (J("info", `Cleared ${W.current.clearStorage()} item(s) from localStorage for ${t}.`), H(void 0), it()) : J("warn", "Auth provider not initialized, cannot clear storage.");
4159
+ ]), ct = (0, A.useCallback)(() => {
4160
+ G.current?.clearStorage ? (J("info", `Cleared ${G.current.clearStorage()} item(s) from localStorage for ${t}.`), U(void 0), it()) : J("warn", "Auth provider not initialized, cannot clear storage.");
4161
4161
  }, [
4162
4162
  t,
4163
4163
  J,
4164
4164
  it
4165
4165
  ]);
4166
- (0, j.useEffect)(() => {
4166
+ (0, A.useEffect)(() => {
4167
4167
  if (typeof window > "u") return;
4168
4168
  let e = (e, t) => {
4169
- if (We.current) {
4169
+ if (Ue.current) {
4170
4170
  J("debug", `Ignoring auth callback via ${t}; manual popup flow owns this result.`);
4171
4171
  return;
4172
4172
  }
4173
- let n = W.current?.serverUrlHash;
4173
+ let n = G.current?.serverUrlHash;
4174
4174
  if (e?.serverUrlHash && n && e.serverUrlHash !== n) {
4175
4175
  J("debug", `Ignoring auth callback via ${t} for a different server.`);
4176
4176
  return;
4177
4177
  }
4178
- if (J("info", `Received auth callback via ${t}.`, e), He.current && clearTimeout(He.current), He.current = null, e?.success) J("info", "Authentication successful via popup. Reconnecting client..."), G.current && J("debug", "Connection attempt already in progress, resetting flag to allow reconnection."), G.current = !1, setTimeout(() => {
4179
- K.current && (J("debug", "Initiating reconnection after successful auth callback."), qe.current?.());
4178
+ if (J("info", `Received auth callback via ${t}.`, e), Ve.current && clearTimeout(Ve.current), Ve.current = null, e?.success) J("info", "Authentication successful via popup. Reconnecting client..."), K.current && J("debug", "Connection attempt already in progress, resetting flag to allow reconnection."), K.current = !1, setTimeout(() => {
4179
+ q.current && (J("debug", "Initiating reconnection after successful auth callback."), qe.current?.());
4180
4180
  }, 100);
4181
4181
  else {
4182
- if (q.current !== "authenticating" && q.current !== "pending_auth") {
4183
- J("debug", `Ignoring stale auth failure callback (state=${q.current}).`);
4182
+ if (We.current !== "authenticating" && We.current !== "pending_auth") {
4183
+ J("debug", `Ignoring stale auth failure callback (state=${We.current}).`);
4184
4184
  return;
4185
4185
  }
4186
4186
  Je.current?.(`Authentication failed in callback: ${e?.error || "Unknown reason."}`);
@@ -4204,18 +4204,18 @@ function pa(e) {
4204
4204
  } catch {}
4205
4205
  J("debug", "Auth callback BroadcastChannel listener removed.");
4206
4206
  }
4207
- He.current && clearTimeout(He.current);
4207
+ Ve.current && clearTimeout(Ve.current);
4208
4208
  };
4209
- }, [J]), (0, j.useEffect)(() => {
4210
- if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), B("discovering"), () => {
4211
- K.current = !1;
4209
+ }, [J]), (0, A.useEffect)(() => {
4210
+ if (q.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), B("discovering"), () => {
4211
+ q.current = !1;
4212
4212
  };
4213
- if (J("debug", "useMcp mounted, initiating connection."), Be.current = 0, a) W.current = a, J("debug", "Using externally provided authProvider");
4214
- else if (!W.current || W.current.serverUrl !== L) {
4213
+ if (J("debug", "useMcp mounted, initiating connection."), ze.current = 0, a) G.current = a, J("debug", "Using externally provided authProvider");
4214
+ else if (!G.current || G.current.serverUrl !== L) {
4215
4215
  let { provider: e, oauthProxyUrl: t } = sa({
4216
4216
  effectiveOAuthUrl: L,
4217
4217
  storageKeyPrefix: i,
4218
- oauthClientConfig: P,
4218
+ oauthClientConfig: N,
4219
4219
  callbackUrl: r,
4220
4220
  preventAutoAuth: m,
4221
4221
  useRedirectFlow: h,
@@ -4223,70 +4223,70 @@ function pa(e) {
4223
4223
  oauthProxyUrl: c,
4224
4224
  onPopupWindow: g,
4225
4225
  proxyOAuthRequests: !0,
4226
- staticClientInfo: D,
4226
+ staticClientInfo: ae,
4227
4227
  clientMetadataUrl: E,
4228
4228
  scope: ie
4229
4229
  });
4230
- W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
4230
+ G.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${L}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${I ? "enabled" : "disabled"}`);
4231
4231
  }
4232
4232
  return at(), () => {
4233
- K.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
4233
+ q.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
4234
4234
  };
4235
4235
  }, [
4236
4236
  t,
4237
4237
  n,
4238
4238
  i,
4239
4239
  r,
4240
- P.name,
4241
- P.version,
4242
- P.uri,
4243
- P.logo_uri,
4244
- D,
4240
+ N.name,
4241
+ N.version,
4242
+ N.uri,
4243
+ N.logo_uri,
4244
+ ae,
4245
4245
  E,
4246
4246
  ie,
4247
4247
  h,
4248
- N,
4248
+ M,
4249
4249
  L,
4250
4250
  s,
4251
4251
  a
4252
4252
  ]);
4253
- let lt = (0, j.useRef)(ot), ut = (0, j.useRef)(J);
4254
- (0, j.useEffect)(() => {
4253
+ let lt = (0, A.useRef)(ot), ut = (0, A.useRef)(J);
4254
+ (0, A.useEffect)(() => {
4255
4255
  lt.current = ot, ut.current = J;
4256
- }, [ot, J]), (0, j.useEffect)(() => {
4256
+ }, [ot, J]), (0, A.useEffect)(() => {
4257
4257
  let e = null;
4258
- if (z === "failed" && d && Be.current > 0) {
4259
- if (!Ue.current) {
4260
- Ue.current = !0;
4258
+ if (z === "failed" && d && ze.current > 0) {
4259
+ if (!He.current) {
4260
+ He.current = !0;
4261
4261
  let t = typeof d == "number" ? d : fa;
4262
4262
  ut.current("info", `Connection failed, auto-retrying in ${t}ms...`), e = setTimeout(() => {
4263
- Ue.current = !1, K.current && q.current === "failed" && lt.current();
4263
+ He.current = !1, q.current && We.current === "failed" && lt.current();
4264
4264
  }, t);
4265
4265
  }
4266
- } else z !== "failed" && (Ue.current = !1);
4266
+ } else z !== "failed" && (He.current = !1);
4267
4267
  return () => {
4268
- e && (clearTimeout(e), Ue.current = !1);
4268
+ e && (clearTimeout(e), He.current = !1);
4269
4269
  };
4270
4270
  }, [z, d]);
4271
- let dt = (0, j.useCallback)(async () => q.current === "ready" ? be?.icon ? be.icon : ze.current ? (J("debug", "Waiting for icon to finish loading..."), await ze.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [be, J]);
4271
+ let dt = (0, A.useCallback)(async () => We.current === "ready" ? ye?.icon ? ye.icon : Re.current ? (J("debug", "Waiting for icon to finish loading..."), await Re.current) : (J("debug", "No icon available and no loading in progress"), null) : (J("warn", "Cannot ensure icon loaded - not connected"), null), [ye, J]);
4272
4272
  return {
4273
4273
  state: z,
4274
- name: be?.name || t || "",
4274
+ name: ye?.name || t || "",
4275
4275
  tools: fe,
4276
- resources: me,
4277
- resourceTemplates: ge,
4278
- prompts: ve,
4279
- serverInfo: be,
4280
- capabilities: V,
4276
+ resources: pe,
4277
+ resourceTemplates: he,
4278
+ prompts: _e,
4279
+ serverInfo: ye,
4280
+ capabilities: xe,
4281
4281
  protocolEra: Ce,
4282
4282
  protocolVersion: Te,
4283
- instructions: De,
4284
- extensions: ke,
4285
- error: je,
4286
- log: Ne,
4287
- authUrl: Fe,
4288
- authTokens: Ie,
4289
- client: U.current,
4283
+ instructions: Ee,
4284
+ extensions: Oe,
4285
+ error: Ae,
4286
+ log: Me,
4287
+ authUrl: Pe,
4288
+ authTokens: Fe,
4289
+ client: W.current,
4290
4290
  ...rt,
4291
4291
  retry: ot,
4292
4292
  disconnect: it,
@@ -4459,14 +4459,14 @@ function Ea(e) {
4459
4459
  }
4460
4460
  var Da = 500, Oa = 5 * 6e4;
4461
4461
  function ka(e) {
4462
- let [t, n] = (0, j.useState)([]), [r, i] = (0, j.useState)([]), [a, o] = (0, j.useState)([]), s = (0, j.useRef)(0), c = (0, j.useRef)(0), l = (0, j.useRef)(/* @__PURE__ */ new Map()), u = (0, j.useRef)(/* @__PURE__ */ new Map()), d = (0, j.useCallback)((e) => {
4462
+ let [t, n] = (0, A.useState)([]), [r, i] = (0, A.useState)([]), [a, o] = (0, A.useState)([]), s = (0, A.useRef)(0), c = (0, A.useRef)(0), l = (0, A.useRef)(/* @__PURE__ */ new Map()), u = (0, A.useRef)(/* @__PURE__ */ new Map()), d = (0, A.useCallback)((e) => {
4463
4463
  for (let t of l.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
4464
4464
  l.current.clear();
4465
4465
  for (let t of u.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
4466
4466
  u.current.clear(), i([]), o([]);
4467
4467
  }, []);
4468
- (0, j.useEffect)(() => () => d("MCP server connection was removed"), [d]);
4469
- let f = (0, j.useCallback)((t) => {
4468
+ (0, A.useEffect)(() => () => d("MCP server connection was removed"), [d]);
4469
+ let f = (0, A.useCallback)((t) => {
4470
4470
  let r = {
4471
4471
  id: globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`,
4472
4472
  method: t.method,
@@ -4475,13 +4475,13 @@ function ka(e) {
4475
4475
  read: !1
4476
4476
  };
4477
4477
  n((e) => [r, ...e].slice(0, Da)), e.onNotificationReceived?.(r);
4478
- }, [e.onNotificationReceived]), p = (0, j.useCallback)((e, t) => {
4478
+ }, [e.onNotificationReceived]), p = (0, A.useCallback)((e, t) => {
4479
4479
  let n = l.current.get(e);
4480
4480
  n && (clearTimeout(n.timeout), l.current.delete(e), i((t) => t.filter((t) => t.id !== e)), n.resolve(t));
4481
- }, []), m = (0, j.useCallback)((e, t) => {
4481
+ }, []), m = (0, A.useCallback)((e, t) => {
4482
4482
  let n = l.current.get(e);
4483
4483
  n && (clearTimeout(n.timeout), l.current.delete(e), i((t) => t.filter((t) => t.id !== e)), n.reject(Error(t ?? "User rejected sampling request")));
4484
- }, []), h = (0, j.useCallback)((t) => new Promise((n, r) => {
4484
+ }, []), h = (0, A.useCallback)((t) => new Promise((n, r) => {
4485
4485
  let a = `sampling-${s.current++}`, o = {
4486
4486
  id: a,
4487
4487
  request: {
@@ -4500,13 +4500,13 @@ function ka(e) {
4500
4500
  p,
4501
4501
  e,
4502
4502
  m
4503
- ]), g = (0, j.useCallback)((e, t) => {
4503
+ ]), g = (0, A.useCallback)((e, t) => {
4504
4504
  let n = u.current.get(e);
4505
4505
  n && (clearTimeout(n.timeout), u.current.delete(e), o((t) => t.filter((t) => t.id !== e)), n.resolve(t));
4506
- }, []), _ = (0, j.useCallback)((e, t) => {
4506
+ }, []), _ = (0, A.useCallback)((e, t) => {
4507
4507
  let n = u.current.get(e);
4508
4508
  n && (clearTimeout(n.timeout), u.current.delete(e), o((t) => t.filter((t) => t.id !== e)), n.reject(Error(t ?? "User rejected elicitation request")));
4509
- }, []), v = (0, j.useCallback)((t) => new Promise((n, r) => {
4509
+ }, []), v = (0, A.useCallback)((t) => new Promise((n, r) => {
4510
4510
  let i = `elicitation-${c.current++}`, a = {
4511
4511
  id: i,
4512
4512
  request: t,
@@ -4522,15 +4522,15 @@ function ka(e) {
4522
4522
  g,
4523
4523
  e,
4524
4524
  _
4525
- ]), ee = (0, j.useCallback)((e) => {
4525
+ ]), ee = (0, A.useCallback)((e) => {
4526
4526
  n((t) => t.map((t) => t.id === e ? {
4527
4527
  ...t,
4528
4528
  read: !0
4529
4529
  } : t));
4530
- }, []), te = (0, j.useCallback)(() => n((e) => e.map((e) => ({
4530
+ }, []), te = (0, A.useCallback)(() => n((e) => e.map((e) => ({
4531
4531
  ...e,
4532
4532
  read: !0
4533
- }))), []), y = (0, j.useCallback)(() => n([]), []);
4533
+ }))), []), y = (0, A.useCallback)(() => n([]), []);
4534
4534
  return {
4535
4535
  notifications: t,
4536
4536
  pendingSamplingRequests: r,
@@ -4549,7 +4549,7 @@ function ka(e) {
4549
4549
  rejectAll: d
4550
4550
  };
4551
4551
  }
4552
- var Q = pr.get("McpClientProvider"), Aa = (0, j.createContext)(null);
4552
+ var Q = pr.get("McpClientProvider"), Aa = (0, A.createContext)(null);
4553
4553
  function $(e, t) {
4554
4554
  return JSON.stringify(e) === JSON.stringify(t);
4555
4555
  }
@@ -4557,7 +4557,7 @@ function ja(e, t) {
4557
4557
  return e.id === t.id && $(Ta(e), Ta(t)) && e.name === t.name && e.state === t.state && e.error === t.error && e.authUrl === t.authUrl && $(e.authTokens, t.authTokens) && e.protocolEra === t.protocolEra && e.protocolVersion === t.protocolVersion && $(e.serverInfo, t.serverInfo) && $(e.capabilities, t.capabilities) && e.instructions === t.instructions && $(e.extensions, t.extensions) && $(e.tools, t.tools) && $(e.resources, t.resources) && $(e.resourceTemplates, t.resourceTemplates) && $(e.prompts, t.prompts) && $(e.notifications, t.notifications) && e.unreadNotificationCount === t.unreadNotificationCount && $(e.pendingSamplingRequests, t.pendingSamplingRequests) && $(e.pendingElicitationRequests, t.pendingElicitationRequests) && e.client === t.client;
4558
4558
  }
4559
4559
  function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r, defaultProxyConfig: i, defaultAutoProxyFallback: a, clientInfo: o, cachedMetadata: s, onUpdate: c, onUpdateConfig: l, onUpdateDisplayName: u, onReconnect: d, rpcWrapTransport: f, onGlobalSamplingRequest: p, onGlobalElicitationRequest: m }) {
4560
- let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0, j.useMemo)(() => {
4560
+ let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0, A.useMemo)(() => {
4561
4561
  let { displayName: c, onSamplingRequest: l, onElicitationRequest: u, onNotificationReceived: d, wrapTransport: f, ...p } = t;
4562
4562
  return {
4563
4563
  ...p,
@@ -4580,7 +4580,7 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4580
4580
  a,
4581
4581
  o,
4582
4582
  s
4583
- ]), y = (0, j.useMemo)(() => {
4583
+ ]), y = (0, A.useMemo)(() => {
4584
4584
  if (!(!f && !ee)) return (t) => {
4585
4585
  let n = t;
4586
4586
  return f && (n = f(n, e)), ee && (n = ee(n, e)), n;
@@ -4604,10 +4604,10 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4604
4604
  onElicitation: b.onElicitation,
4605
4605
  wrapTransport: y
4606
4606
  });
4607
- (0, j.useEffect)(() => {
4607
+ (0, A.useEffect)(() => {
4608
4608
  x.state !== "ready" && b.rejectAll("MCP server connection is no longer active");
4609
4609
  }, [x.state, b.rejectAll]);
4610
- let S = (0, j.useCallback)((t) => l(e, t), [e, l]), C = (0, j.useCallback)((n) => {
4610
+ let S = (0, A.useCallback)((t) => l(e, t), [e, l]), C = (0, A.useCallback)((n) => {
4611
4611
  let r = t.proxyConfig?.proxyAddress?.trim();
4612
4612
  return t.connectionMode === "proxy" && r ? l(e, {
4613
4613
  proxyConfig: {
@@ -4622,10 +4622,10 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4622
4622
  t.connectionMode,
4623
4623
  t.proxyConfig,
4624
4624
  l
4625
- ]), ne = (0, j.useCallback)((t) => u(e, t), [e, u]), w = (0, j.useCallback)(() => d(e), [e, d]), re = (0, j.useRef)(c), T = (0, j.useRef)(null);
4626
- return (0, j.useEffect)(() => {
4625
+ ]), ne = (0, A.useCallback)((t) => u(e, t), [e, u]), w = (0, A.useCallback)(() => d(e), [e, d]), re = (0, A.useRef)(c), T = (0, A.useRef)(null);
4626
+ return (0, A.useEffect)(() => {
4627
4627
  re.current = c;
4628
- }, [c]), (0, j.useEffect)(() => {
4628
+ }, [c]), (0, A.useEffect)(() => {
4629
4629
  let n = {
4630
4630
  ...Ea(t),
4631
4631
  ...x,
@@ -4675,12 +4675,12 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
4675
4675
  ]), null;
4676
4676
  }
4677
4677
  function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r, defaultProxyConfig: i, defaultAutoProxyFallback: a = !1, defaultServerConfig: o, clientInfo: s, storageProvider: c, enableRpcLogging: l = !1, onServerAdded: u, onServerRemoved: d, onServerStateChange: f, onSamplingRequest: p, onElicitationRequest: m }) {
4678
- let [h, g] = (0, j.useState)([]), [_, v] = (0, j.useState)([]), [ee, te] = (0, j.useState)({}), [y, b] = (0, j.useState)(!1), x = (0, j.useRef)(!1), S = (0, j.useRef)([]);
4679
- (0, j.useEffect)(() => {
4678
+ let [h, g] = (0, A.useState)([]), [_, v] = (0, A.useState)([]), [ee, te] = (0, A.useState)({}), [y, b] = (0, A.useState)(!1), x = (0, A.useRef)(!1), S = (0, A.useRef)([]);
4679
+ (0, A.useEffect)(() => {
4680
4680
  S.current = _;
4681
4681
  }, [_]);
4682
- let C = (0, j.useRef)({}), [ne, w] = (0, j.useState)(void 0), [re, T] = (0, j.useState)(!1);
4683
- (0, j.useEffect)(() => {
4682
+ let C = (0, A.useRef)({}), [ne, w] = (0, A.useState)(void 0), [re, T] = (0, A.useState)(!1);
4683
+ (0, A.useEffect)(() => {
4684
4684
  if (!l || typeof window > "u") {
4685
4685
  w(void 0), T(!0);
4686
4686
  return;
@@ -4690,7 +4690,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4690
4690
  }).catch((e) => {
4691
4691
  Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), T(!0);
4692
4692
  });
4693
- }, [l]), (0, j.useEffect)(() => {
4693
+ }, [l]), (0, A.useEffect)(() => {
4694
4694
  if (!re) {
4695
4695
  Q.debug("[McpClientProvider] Waiting for RPC logging to be ready before loading servers");
4696
4696
  return;
@@ -4734,7 +4734,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4734
4734
  c,
4735
4735
  t,
4736
4736
  re
4737
- ]), (0, j.useEffect)(() => {
4737
+ ]), (0, A.useEffect)(() => {
4738
4738
  !c || !y || (async () => {
4739
4739
  try {
4740
4740
  let e = h.reduce((e, t) => (e[t.id] = Ea(t.options), e), {});
@@ -4748,7 +4748,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4748
4748
  c,
4749
4749
  y
4750
4750
  ]);
4751
- let E = (0, j.useCallback)((e) => {
4751
+ let E = (0, A.useCallback)((e) => {
4752
4752
  Q.debug(`[McpClientProvider] handleServerUpdate called for server ${e.id}`, {
4753
4753
  toolCount: e.tools.length,
4754
4754
  state: e.state
@@ -4786,12 +4786,12 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4786
4786
  u,
4787
4787
  f,
4788
4788
  c
4789
- ]), ie = (0, j.useCallback)((e, t) => {
4789
+ ]), ie = (0, A.useCallback)((e, t) => {
4790
4790
  g((n) => n.find((t) => t.id === e) ? n : (Q.debug("[McpClientProvider] Adding new server to configs:", e), [...n, {
4791
4791
  id: e,
4792
4792
  options: t
4793
4793
  }]));
4794
- }, []), D = (0, j.useCallback)(async (e, t) => {
4794
+ }, []), ae = (0, A.useCallback)(async (e, t) => {
4795
4795
  let n = S.current.find((t) => t.id === e);
4796
4796
  if (v((t) => t.filter((t) => t.id !== e)), g((t) => t.filter((t) => t.id !== e)), te((t) => {
4797
4797
  let { [e]: n, ...r } = t;
@@ -4801,7 +4801,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4801
4801
  t(e);
4802
4802
  }
4803
4803
  d?.(e);
4804
- }, [l, d]), O = (0, j.useCallback)(async (e, t) => {
4804
+ }, [l, d]), D = (0, A.useCallback)(async (e, t) => {
4805
4805
  let n = h.find((t) => t.id === e);
4806
4806
  if (!n) {
4807
4807
  Q.warn(`[McpClientProvider] Cannot update server "${e}" - not found`);
@@ -4818,7 +4818,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4818
4818
  ...t,
4819
4819
  [e]: (t[e] ?? 0) + 1
4820
4820
  })));
4821
- }, [h]), k = (0, j.useCallback)(async (e) => {
4821
+ }, [h]), O = (0, A.useCallback)(async (e) => {
4822
4822
  if (!h.find((t) => t.id === e)) {
4823
4823
  Q.warn(`[McpClientProvider] Cannot reconnect server "${e}" - not found`);
4824
4824
  return;
@@ -4827,7 +4827,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4827
4827
  ...t,
4828
4828
  [e]: (t[e] ?? 0) + 1
4829
4829
  }));
4830
- }, [h]), ae = (0, j.useCallback)(async (e, t) => new Promise((n) => {
4830
+ }, [h]), oe = (0, A.useCallback)(async (e, t) => new Promise((n) => {
4831
4831
  let r = h.find((t) => t.id === e);
4832
4832
  if (!r) {
4833
4833
  Q.warn(`[McpClientProvider] Cannot update server metadata for "${e}" - not found`), n();
@@ -4847,33 +4847,33 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4847
4847
  } : t);
4848
4848
  return setTimeout(() => n(), 0), r;
4849
4849
  });
4850
- }), [h]), A = (0, j.useCallback)((e) => _.find((t) => t.id === e), [_]), oe = (0, j.useMemo)(() => ({
4850
+ }), [h]), k = (0, A.useCallback)((e) => _.find((t) => t.id === e), [_]), se = (0, A.useMemo)(() => ({
4851
4851
  servers: _,
4852
4852
  addServer: ie,
4853
- removeServer: D,
4854
- updateServerMetadata: ae,
4855
- updateServer: O,
4856
- getServer: A,
4853
+ removeServer: ae,
4854
+ updateServerMetadata: oe,
4855
+ updateServer: D,
4856
+ getServer: k,
4857
4857
  storageLoaded: y
4858
4858
  }), [
4859
4859
  _,
4860
4860
  ie,
4861
- D,
4862
4861
  ae,
4863
- O,
4864
- A,
4862
+ oe,
4863
+ D,
4864
+ k,
4865
4865
  y
4866
- ]), { capabilities: M, ...N } = s || {}, P = (0, j.useMemo)(() => Object.keys(N).length ? N : void 0, [s]), se = (0, j.useMemo)(() => h.map((e) => {
4866
+ ]), { capabilities: j, ...M } = s || {}, N = (0, A.useMemo)(() => Object.keys(M).length ? M : void 0, [s]), P = (0, A.useMemo)(() => h.map((e) => {
4867
4867
  let t = o ? {
4868
4868
  ...o,
4869
4869
  ...e.options
4870
4870
  } : e.options;
4871
- return M && (t = {
4871
+ return j && (t = {
4872
4872
  ...t,
4873
4873
  clientOptions: {
4874
4874
  ...t.clientOptions,
4875
4875
  capabilities: {
4876
- ...M,
4876
+ ...j,
4877
4877
  ...t.clientOptions?.capabilities
4878
4878
  }
4879
4879
  }
@@ -4883,10 +4883,10 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4883
4883
  };
4884
4884
  }), [
4885
4885
  h,
4886
- M,
4886
+ j,
4887
4887
  o
4888
- ]), F = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
- return /* @__PURE__ */ j.createElement(Aa.Provider, { value: oe }, e, !F && se.map((e) => /* @__PURE__ */ j.createElement(Ma, {
4888
+ ]), ce = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
4889
+ return /* @__PURE__ */ A.createElement(Aa.Provider, { value: se }, e, !ce && P.map((e) => /* @__PURE__ */ A.createElement(Ma, {
4890
4890
  key: `${e.id}-v${ee[e.id] ?? 0}`,
4891
4891
  id: e.id,
4892
4892
  options: e.options,
@@ -4894,19 +4894,19 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
4894
4894
  defaultOAuthProxyUrl: r,
4895
4895
  defaultProxyConfig: i,
4896
4896
  defaultAutoProxyFallback: a,
4897
- clientInfo: P,
4897
+ clientInfo: N,
4898
4898
  cachedMetadata: C.current[e.id],
4899
4899
  onUpdate: E,
4900
- onUpdateConfig: O,
4901
- onUpdateDisplayName: (e, t) => ae(e, { name: t }),
4902
- onReconnect: k,
4900
+ onUpdateConfig: D,
4901
+ onUpdateDisplayName: (e, t) => oe(e, { name: t }),
4902
+ onReconnect: O,
4903
4903
  rpcWrapTransport: ne,
4904
4904
  onGlobalSamplingRequest: p,
4905
4905
  onGlobalElicitationRequest: m
4906
4906
  })));
4907
4907
  }
4908
4908
  function Pa() {
4909
- let e = (0, j.useContext)(Aa);
4909
+ let e = (0, A.useContext)(Aa);
4910
4910
  if (!e) throw Error("useMcpClient must be used within a McpClientProvider");
4911
4911
  return e;
4912
4912
  }
@@ -5028,15 +5028,15 @@ function Ua(e) {
5028
5028
  let t = "<script>window.__SANDBOX_SEARCH__ = " + JSON.stringify(e).replace(/</g, "\\u003c") + ";<\/script>";
5029
5029
  return Ha.replace("<body>", "<body>" + t);
5030
5030
  }
5031
- var Wa = "fixed inset-0 z-[100] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background", Ga = [
5032
- "fixed top-4 left-1/2 -translate-x-1/2 z-[100]",
5031
+ var Wa = "fixed inset-0 z-[200] w-full h-full min-h-0 bg-background flex flex-col [&:fullscreen]:h-full [&:fullscreen]:w-full [&:fullscreen]:bg-background", Ga = [
5032
+ "fixed top-4 left-1/2 -translate-x-1/2 z-[200]",
5033
5033
  "rounded-3xl w-full min-w-[300px] h-[400px]",
5034
5034
  "shadow-2xl border overflow-hidden",
5035
5035
  "bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",
5036
5036
  "flex flex-col"
5037
5037
  ].join(" "), Ka = "data-mcp-widget-fullscreen", qa = "data-mcp-widget-display-mode";
5038
5038
  function Ja(e) {
5039
- (0, j.useEffect)(() => {
5039
+ (0, A.useEffect)(() => {
5040
5040
  if (!(typeof document > "u")) {
5041
5041
  if (e === "pip" || e === "fullscreen") return document.documentElement.setAttribute(qa, e), e === "fullscreen" ? document.documentElement.setAttribute(Ka, "") : document.documentElement.removeAttribute(Ka), () => {
5042
5042
  document.documentElement.removeAttribute(qa), document.documentElement.removeAttribute(Ka);
@@ -5048,7 +5048,7 @@ function Ja(e) {
5048
5048
  function Ya({ displayMode: e, setDisplayMode: t }) {
5049
5049
  let n = e === "fullscreen", r = e === "pip";
5050
5050
  return Ja(e), {
5051
- handleDisplayModeChange: (0, j.useCallback)((e) => t(e), [t]),
5051
+ handleDisplayModeChange: (0, A.useCallback)((e) => t(e), [t]),
5052
5052
  fullscreenShellClassName: n ? Wa : void 0,
5053
5053
  pipShellClassName: r ? Ga : void 0,
5054
5054
  isFullscreen: n,
@@ -5057,7 +5057,8 @@ function Ya({ displayMode: e, setDisplayMode: t }) {
5057
5057
  }
5058
5058
  var Xa = {
5059
5059
  PIP_MAX_WIDTH: 700,
5060
- DEFAULT_HEIGHT: 400
5060
+ DEFAULT_HEIGHT: 400,
5061
+ FULLSCREEN_HEADER_HEIGHT: 50
5061
5062
  };
5062
5063
  function Za(e) {
5063
5064
  let t = e?.ui;
@@ -5080,7 +5081,20 @@ var eo = {
5080
5081
  updateModelContext: { text: {} },
5081
5082
  message: { text: {} }
5082
5083
  };
5083
- function io(e) {
5084
+ function io() {
5085
+ return /* @__PURE__ */ A.createElement("svg", {
5086
+ width: "14",
5087
+ height: "14",
5088
+ viewBox: "0 0 24 24",
5089
+ fill: "none",
5090
+ stroke: "currentColor",
5091
+ strokeWidth: "2",
5092
+ strokeLinecap: "round",
5093
+ strokeLinejoin: "round",
5094
+ "aria-hidden": !0
5095
+ }, /* @__PURE__ */ A.createElement("path", { d: "M18 6 6 18" }), /* @__PURE__ */ A.createElement("path", { d: "m6 6 12 12" }));
5096
+ }
5097
+ function ao(e) {
5084
5098
  return new Promise((t) => {
5085
5099
  let n = (r) => {
5086
5100
  r.source === e.contentWindow && r.data?.method === no && (window.removeEventListener("message", n), t());
@@ -5088,7 +5102,7 @@ function io(e) {
5088
5102
  window.addEventListener("message", n);
5089
5103
  });
5090
5104
  }
5091
- function ao(e) {
5105
+ function oo(e) {
5092
5106
  let t = e.oninitialized;
5093
5107
  return new Promise((n) => {
5094
5108
  e.oninitialized = (...r) => {
@@ -5096,69 +5110,76 @@ function ao(e) {
5096
5110
  };
5097
5111
  });
5098
5112
  }
5099
- function oo(e, t) {
5113
+ function so(e, t) {
5100
5114
  let n = Ia(t);
5101
5115
  return Object.keys(n).length > 0 ? {
5102
5116
  ...typeof e == "object" && e ? e : {},
5103
5117
  structuredContent: n
5104
5118
  } : e ?? null;
5105
5119
  }
5106
- function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, className: re, testId: T = "mcp-app-frame", invoking: E, invoked: ie }) {
5107
- let D = (0, j.useRef)(null), O = (0, j.useRef)(null), k = (0, j.useRef)(null), ae = (0, j.useRef)(t.kind === "live" ? t.connection : null), [A, oe] = (0, j.useState)(null), [M, N] = (0, j.useState)(null), [P, se] = (0, j.useState)(null), [F, ce] = (0, j.useState)(0), [le, ue] = (0, j.useState)(!0), [I, de] = (0, j.useState)(Xa.DEFAULT_HEIGHT), [L, R] = (0, j.useState)("inline"), z = p ?? L, B = (0, j.useRef)(u);
5108
- B.current = u;
5109
- let fe = (0, j.useRef)(_);
5110
- fe.current = _;
5111
- let pe = (0, j.useRef)(i);
5112
- pe.current = i;
5113
- let me = (0, j.useRef)(a);
5114
- me.current = a;
5115
- let he = (0, j.useRef)(s);
5116
- he.current = s;
5117
- let ge = (0, j.useRef)(S);
5118
- ge.current = S;
5119
- let _e = (0, j.useRef)(v);
5120
- _e.current = v;
5121
- let ve = (0, j.useRef)(ee);
5122
- ve.current = ee;
5123
- let ye = (0, j.useRef)(b);
5124
- ye.current = b;
5125
- let be = (0, j.useRef)(x);
5126
- be.current = x;
5127
- let xe = (0, j.useRef)(te);
5128
- xe.current = te;
5129
- let V = (0, j.useRef)(y);
5130
- V.current = y;
5131
- let Se = (0, j.useRef)(n);
5132
- Se.current = n;
5133
- let Ce = (0, j.useRef)(f);
5134
- Ce.current = f;
5135
- let we = (0, j.useRef)(w);
5136
- we.current = w;
5137
- let Te = (0, j.useCallback)((e) => {
5138
- let t = Se.current;
5120
+ function co({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = eo, hostContext: u, hostCapabilities: d, cspMode: f = "widget-declared", displayMode: p, onDisplayModeChange: m, inlineMaxWidth: h = 768, chromeless: g, onMessage: _, onModelContextUpdate: v, onLog: ee, onReady: te, onLifecycleChange: y, onError: b, onCspViolation: x, onResourceResolved: S, wrapTransport: C, toolCallTimeout: ne = to, mockOpenAiFileApis: w = !1, onInlineHeightChange: re, fullscreenHeader: T, renderFullscreenClose: E, className: ie, testId: ae = "mcp-app-frame", invoking: D, invoked: O }) {
5121
+ let oe = (0, A.useRef)(null), k = (0, A.useRef)(null), se = (0, A.useRef)(null), j = (0, A.useRef)(t.kind === "live" ? t.connection : null), [M, N] = (0, A.useState)(null), [P, ce] = (0, A.useState)(null), [le, ue] = (0, A.useState)(null), [F, I] = (0, A.useState)(0), [de, L] = (0, A.useState)(!0), [R, z] = (0, A.useState)(Xa.DEFAULT_HEIGHT), [B, fe] = (0, A.useState)("inline"), V = p ?? B, pe = (0, A.useMemo)(() => !u || u.displayMode === V ? u : {
5122
+ ...u,
5123
+ displayMode: V
5124
+ }, [u, V]), me = (0, A.useRef)(pe);
5125
+ me.current = pe;
5126
+ let he = (0, A.useRef)(_);
5127
+ he.current = _;
5128
+ let ge = (0, A.useRef)(i);
5129
+ ge.current = i;
5130
+ let _e = (0, A.useRef)(o);
5131
+ _e.current = o;
5132
+ let ve = (0, A.useRef)(a);
5133
+ ve.current = a;
5134
+ let ye = (0, A.useRef)(s);
5135
+ ye.current = s;
5136
+ let be = (0, A.useRef)(S);
5137
+ be.current = S;
5138
+ let xe = (0, A.useRef)(v);
5139
+ xe.current = v;
5140
+ let Se = (0, A.useRef)(ee);
5141
+ Se.current = ee;
5142
+ let Ce = (0, A.useRef)(b);
5143
+ Ce.current = b;
5144
+ let we = (0, A.useRef)(x);
5145
+ we.current = x;
5146
+ let Te = (0, A.useRef)(te);
5147
+ Te.current = te;
5148
+ let H = (0, A.useRef)(y);
5149
+ H.current = y;
5150
+ let Ee = (0, A.useRef)(re);
5151
+ Ee.current = re;
5152
+ let De = (0, A.useRef)(n);
5153
+ De.current = n;
5154
+ let Oe = (0, A.useRef)(f);
5155
+ Oe.current = f;
5156
+ let ke = (0, A.useRef)(w);
5157
+ ke.current = w;
5158
+ let Ae = (0, A.useCallback)((e) => {
5159
+ let t = De.current;
5139
5160
  return t ? typeof t == "function" ? t(e) : t : Va({
5140
- cspMode: Ce.current,
5161
+ cspMode: Oe.current,
5141
5162
  permissions: e.permissions,
5142
5163
  widgetCsp: e.declaredCsp
5143
5164
  });
5144
- }, []), { handleDisplayModeChange: Ee, fullscreenShellClassName: De, pipShellClassName: Oe, isFullscreen: ke, isPip: Ae } = Ya({
5145
- containerRef: k,
5146
- displayMode: z,
5147
- setDisplayMode: (0, j.useCallback)((e) => {
5148
- m ? m(e) : R(e);
5165
+ }, []), { handleDisplayModeChange: je, fullscreenShellClassName: Me, pipShellClassName: Ne, isFullscreen: Pe, isPip: U } = Ya({
5166
+ containerRef: se,
5167
+ displayMode: V,
5168
+ setDisplayMode: (0, A.useCallback)((e) => {
5169
+ m ? m(e) : fe(e);
5149
5170
  }, [m])
5150
- }), je = (0, j.useRef)(Ee);
5151
- je.current = Ee;
5152
- let Me = (0, j.useRef)(z);
5153
- Me.current = z;
5154
- let Ne = t.kind === "live" ? t.resourceUri : void 0, Pe = t.kind === "preloaded" ? t.html : void 0;
5155
- t.kind === "live" && (ae.current = t.connection), (0, j.useEffect)(() => {
5171
+ }), Fe = (0, A.useRef)(je);
5172
+ Fe.current = je;
5173
+ let Ie = (0, A.useRef)(V);
5174
+ Ie.current = V;
5175
+ let W = t.kind === "live" ? t.resourceUri : void 0, Le = t.kind === "preloaded" ? t.html : void 0;
5176
+ t.kind === "live" && (j.current = t.connection), (0, A.useEffect)(() => {
5156
5177
  let e = !1;
5157
- V.current?.({ status: "resolving" });
5178
+ H.current?.({ status: "resolving" });
5158
5179
  let n = (e) => {
5159
- oe(e), V.current?.({ status: "sandbox-loading" });
5160
- let t = Te(e);
5161
- N((e) => e?.href === t.href ? e : t), ge.current?.(e);
5180
+ N(e), H.current?.({ status: "sandbox-loading" });
5181
+ let t = Ae(e);
5182
+ ce((e) => e?.href === t.href ? e : t), be.current?.(e);
5162
5183
  };
5163
5184
  if (t.kind === "preloaded") {
5164
5185
  n({
@@ -5174,7 +5195,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5174
5195
  return;
5175
5196
  }
5176
5197
  let { connection: r, resourceUri: i } = t;
5177
- return ae.current = r, (async () => {
5198
+ return j.current = r, (async () => {
5178
5199
  try {
5179
5200
  let t = await r.readResource(i);
5180
5201
  if (e) return;
@@ -5186,7 +5207,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5186
5207
  });
5187
5208
  if (!o.mimeTypeValid) {
5188
5209
  let e = o.mimeTypeWarning || "Invalid MIME type - SEP-1865 requires \"text/html;profile=mcp-app\"";
5189
- se(e), V.current?.({
5210
+ ue(e), H.current?.({
5190
5211
  status: "error",
5191
5212
  error: e
5192
5213
  });
@@ -5195,7 +5216,7 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5195
5216
  n(o);
5196
5217
  } catch (t) {
5197
5218
  if (e) return;
5198
- se(t instanceof Error ? t.message : "Failed to prepare view"), V.current?.({
5219
+ ue(t instanceof Error ? t.message : "Failed to prepare view"), H.current?.({
5199
5220
  status: "error",
5200
5221
  error: t instanceof Error ? t.message : "Failed to prepare view"
5201
5222
  });
@@ -5205,30 +5226,30 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5205
5226
  };
5206
5227
  }, [
5207
5228
  t.kind,
5208
- Ne,
5209
- Pe,
5229
+ W,
5230
+ Le,
5210
5231
  f,
5211
- Te
5212
- ]), (0, j.useEffect)(() => {
5213
- let e = M;
5232
+ Ae
5233
+ ]), (0, A.useEffect)(() => {
5234
+ let e = P;
5214
5235
  return () => {
5215
5236
  e?.protocol === "blob:" && URL.revokeObjectURL(e.href);
5216
5237
  };
5217
- }, [M]);
5218
- let Fe = M?.protocol === "blob:", H = !M || Fe ? null : (() => {
5238
+ }, [P]);
5239
+ let G = P?.protocol === "blob:", Re = !P || G ? null : (() => {
5219
5240
  try {
5220
- return M.origin;
5241
+ return P.origin;
5221
5242
  } catch {
5222
5243
  return null;
5223
5244
  }
5224
5245
  })();
5225
- (0, j.useEffect)(() => {
5226
- if (!H && !Fe) return;
5246
+ (0, A.useEffect)(() => {
5247
+ if (!Re && !G) return;
5227
5248
  let e = (e) => {
5228
- let t = D.current;
5229
- if (t?.contentWindow && e.source === t.contentWindow && !(!Fe && e.origin !== H && H !== "*")) {
5249
+ let t = oe.current;
5250
+ if (t?.contentWindow && e.source === t.contentWindow && !(!G && e.origin !== Re && Re !== "*")) {
5230
5251
  if (e.data?.type === "mcp-apps:csp-violation") {
5231
- be.current?.({
5252
+ we.current?.({
5232
5253
  directive: e.data.directive,
5233
5254
  effectiveDirective: e.data.effectiveDirective,
5234
5255
  blockedUri: e.data.blockedUri,
@@ -5240,33 +5261,33 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5240
5261
  });
5241
5262
  return;
5242
5263
  }
5243
- e.data?.type === "iframe-console-log" && ve.current && ve.current({
5264
+ e.data?.type === "iframe-console-log" && Se.current && Se.current({
5244
5265
  level: e.data.level ?? "log",
5245
5266
  data: e.data.args
5246
5267
  });
5247
5268
  }
5248
5269
  };
5249
5270
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
5250
- }, [H, Fe]), (0, j.useEffect)(() => {
5251
- if (!A || !M) return;
5252
- let t = D.current;
5271
+ }, [Re, G]), (0, A.useEffect)(() => {
5272
+ if (!M || !P) return;
5273
+ let t = oe.current;
5253
5274
  if (!t) return;
5254
5275
  let n = !1, r = null;
5255
5276
  return (async () => {
5256
5277
  try {
5257
- V.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5258
- let i = tr(A.permissions);
5278
+ H.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
5279
+ let i = tr(M.permissions);
5259
5280
  i && t.setAttribute("allow", i);
5260
- let a = io(t);
5261
- if (t.src = M.href, await a, n) return;
5281
+ let a = ao(t);
5282
+ if (t.src = P.href, await a, n) return;
5262
5283
  r = new rr(null, l, {
5263
5284
  ...d ?? ro,
5264
5285
  sandbox: {
5265
- csp: f === "permissive" ? void 0 : A.csp,
5266
- permissions: A.permissions
5286
+ csp: f === "permissive" ? void 0 : M.csp,
5287
+ permissions: M.permissions
5267
5288
  }
5268
- }, { hostContext: B.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && fe.current && fe.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5269
- let n = ae.current;
5289
+ }, { hostContext: me.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && he.current && he.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
5290
+ let n = j.current;
5270
5291
  if (!n) throw Error("Server connection not available");
5271
5292
  try {
5272
5293
  return await n.callTool(e, t || {}, {
@@ -5277,47 +5298,51 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5277
5298
  throw r?.sendToolCancelled({ reason: e instanceof Error ? e.message : String(e) }), e;
5278
5299
  }
5279
5300
  }), r.onreadresource = (async ({ uri: e }) => {
5280
- let t = ae.current;
5301
+ let t = j.current;
5281
5302
  if (!t) throw Error("Server connection not available");
5282
5303
  return await t.readResource(e);
5283
5304
  }), r.onlistresources = (async () => {
5284
- let e = ae.current;
5305
+ let e = j.current;
5285
5306
  if (!e) throw Error("Server connection not available");
5286
5307
  return { resources: [...e.resources ?? []] };
5287
5308
  }), r.onrequestdisplaymode = async ({ mode: e }) => {
5288
- let t = e ?? "inline", n = (B.current?.availableDisplayModes ?? [
5309
+ let t = e ?? "inline", n = (me.current?.availableDisplayModes ?? [
5289
5310
  "inline",
5290
5311
  "pip",
5291
5312
  "fullscreen"
5292
- ]).includes(t) ? t : Me.current;
5293
- return await je.current(n), { mode: n };
5294
- }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (_e.current?.({
5313
+ ]).includes(t) ? t : Ie.current;
5314
+ return await Fe.current(n), { mode: n };
5315
+ }, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (xe.current?.({
5295
5316
  content: e,
5296
5317
  structuredContent: t
5297
- }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (ve.current?.({
5318
+ }), {}), r.onloggingmessage = async ({ level: e, data: t }) => (Se.current?.({
5298
5319
  level: e,
5299
5320
  data: t
5300
5321
  }), {}), r.onsizechange = async ({ height: e }) => {
5301
- Me.current === "inline" && e !== void 0 && de(e);
5322
+ Ie.current === "inline" && e !== void 0 && (z(e), Ee.current?.(e));
5302
5323
  };
5303
- let o = ao(r), s = new $n(t.contentWindow, t.contentWindow);
5324
+ let o = oo(r), s = new $n(t.contentWindow, t.contentWindow);
5304
5325
  if (C && (s = C(s, e)), await r.connect(s), n || (await r.sendSandboxResourceReady({
5305
- html: we.current ? Ra(A.html) : A.html,
5306
- csp: A.csp,
5307
- permissions: A.permissions
5326
+ html: ke.current ? Ra(M.html) : M.html,
5327
+ csp: M.csp,
5328
+ permissions: M.permissions
5308
5329
  }), await o, n)) return;
5309
- O.current = r, ce((e) => e + 1), V.current?.({ status: "initialized" });
5310
- let c = {
5311
- ...pe.current,
5312
- ...Ia(he.current)
5313
- };
5314
- r.sendToolInput({ arguments: c });
5315
- let u = oo(me.current, he.current);
5316
- u && r.sendToolResult(u), V.current?.({ status: "ready" });
5330
+ k.current = r, I((e) => e + 1), H.current?.({ status: "initialized" });
5331
+ let c = _e.current;
5332
+ if (c) r.sendToolInputPartial({ arguments: c });
5333
+ else {
5334
+ let e = {
5335
+ ...ge.current,
5336
+ ...Ia(ye.current)
5337
+ };
5338
+ r.sendToolInput({ arguments: e });
5339
+ }
5340
+ let u = so(ve.current, ye.current);
5341
+ u && r.sendToolResult(u), H.current?.({ status: "ready" });
5317
5342
  } catch (e) {
5318
5343
  if (!n) {
5319
5344
  let t = e instanceof Error ? e.message : "Failed to connect view";
5320
- se(t), ye.current?.(t), V.current?.({
5345
+ ue(t), Ce.current?.(t), H.current?.({
5321
5346
  status: "error",
5322
5347
  error: t
5323
5348
  });
@@ -5326,17 +5351,17 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5326
5351
  })(), () => {
5327
5352
  n = !0;
5328
5353
  let e = r;
5329
- O.current = null, e && (V.current?.({ status: "tearing-down" }), (async () => {
5354
+ k.current = null, e && (H.current?.({ status: "tearing-down" }), (async () => {
5330
5355
  try {
5331
5356
  await Promise.race([e.teardownResource({}), new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("teardown timeout")), 2e3))]);
5332
5357
  } catch {} finally {
5333
- e.close().catch(() => {}), V.current?.({ status: "closed" });
5358
+ e.close().catch(() => {}), H.current?.({ status: "closed" });
5334
5359
  }
5335
5360
  })());
5336
5361
  };
5337
5362
  }, [
5338
- A,
5339
5363
  M,
5364
+ P,
5340
5365
  l,
5341
5366
  d,
5342
5367
  f,
@@ -5344,15 +5369,15 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5344
5369
  C,
5345
5370
  ne,
5346
5371
  w
5347
- ]), (0, j.useEffect)(() => {
5348
- let e = O.current;
5349
- !e || F === 0 || !u || e.setHostContext(u);
5350
- }, [u, F]), (0, j.useEffect)(() => {
5351
- let e = O.current;
5372
+ ]), (0, A.useEffect)(() => {
5373
+ let e = k.current;
5374
+ !e || F === 0 || !pe || e.setHostContext(pe);
5375
+ }, [pe, F]), (0, A.useEffect)(() => {
5376
+ let e = k.current;
5352
5377
  !e || F === 0 || !o || e.sendToolInputPartial({ arguments: o });
5353
- }, [F, o]), (0, j.useEffect)(() => {
5354
- let e = O.current;
5355
- if (!e || F === 0) return;
5378
+ }, [F, o]), (0, A.useEffect)(() => {
5379
+ let e = k.current;
5380
+ if (!e || F === 0 || o) return;
5356
5381
  let t = {
5357
5382
  ...i,
5358
5383
  ...Ia(s)
@@ -5361,65 +5386,97 @@ function so({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
5361
5386
  }, [
5362
5387
  F,
5363
5388
  i,
5389
+ o,
5364
5390
  s
5365
- ]), (0, j.useEffect)(() => {
5366
- let e = O.current;
5391
+ ]), (0, A.useEffect)(() => {
5392
+ let e = k.current;
5367
5393
  if (!e || F === 0) return;
5368
- let t = oo(a, s);
5394
+ let t = so(a, s);
5369
5395
  t && e.sendToolResult(t);
5370
5396
  }, [
5371
5397
  F,
5372
5398
  a,
5373
5399
  s
5374
- ]), (0, j.useEffect)(() => {
5375
- let e = O.current;
5400
+ ]), (0, A.useEffect)(() => {
5401
+ let e = k.current;
5376
5402
  !e || F === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
5377
5403
  }, [c, F]);
5378
- let Ie = (0, j.useRef)(!1);
5379
- if ((0, j.useEffect)(() => {
5380
- Ie.current || F === 0 || (Ie.current = !0, xe.current?.());
5381
- }, [F]), (0, j.useEffect)(() => {
5382
- if (F === 0 || !le) return;
5383
- let e = setTimeout(() => ue(!1), 300);
5404
+ let K = (0, A.useRef)(!1);
5405
+ (0, A.useEffect)(() => {
5406
+ K.current || F === 0 || (K.current = !0, Te.current?.());
5407
+ }, [F]), (0, A.useEffect)(() => {
5408
+ if (F === 0 || !de) return;
5409
+ let e = setTimeout(() => L(!1), 300);
5384
5410
  return () => clearTimeout(e);
5385
- }, [F, le]), P) return /* @__PURE__ */ j.createElement("div", { className: re }, /* @__PURE__ */ j.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ j.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", P)));
5386
- if (!A) return /* @__PURE__ */ j.createElement("div", { className: re }, /* @__PURE__ */ j.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ j.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5387
- let Le = De ?? Oe ?? "flex group flex-1 items-center justify-center", U = {
5388
- height: ke || Ae ? "100%" : `${I}px`,
5411
+ }, [F, de]);
5412
+ let q = M !== null && M.prefersBorder && V !== "fullscreen";
5413
+ if (le) return /* @__PURE__ */ A.createElement("div", { className: ie }, /* @__PURE__ */ A.createElement("div", { className: "border border-red-200/50 dark:border-red-800/50 bg-red-50/30 dark:bg-red-950/20 rounded-lg p-4" }, /* @__PURE__ */ A.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, "Failed to load view: ", le)));
5414
+ if (!M) return /* @__PURE__ */ A.createElement("div", { className: ie }, /* @__PURE__ */ A.createElement("div", { className: "flex items-center justify-center w-full h-[200px]" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading view…")));
5415
+ let ze = Me ?? Ne ?? "flex group flex-1 items-center justify-center", Be = {
5416
+ height: Pe || U ? "100%" : `${R}px`,
5389
5417
  width: "100%",
5390
- maxWidth: z === "inline" ? `${h}px` : "100%",
5391
- transition: ke || Ae ? void 0 : "height 300ms ease-out"
5392
- }, Re = /* @__PURE__ */ j.createElement("div", {
5393
- ref: k,
5394
- className: Le,
5395
- style: Ae ? {
5418
+ maxWidth: V === "inline" ? `${h}px` : "100%",
5419
+ transition: Pe || U ? void 0 : "height 300ms ease-out"
5420
+ }, Ve = /* @__PURE__ */ A.createElement("div", {
5421
+ ref: se,
5422
+ className: Pe ? `${ze} flex flex-col` : ze,
5423
+ style: U ? {
5396
5424
  height: Xa.DEFAULT_HEIGHT,
5397
5425
  maxWidth: Xa.PIP_MAX_WIDTH,
5398
5426
  zIndex: 100
5399
- } : ke ? { zIndex: 100 } : void 0
5400
- }, (ke || Ae) && /* @__PURE__ */ j.createElement("button", {
5427
+ } : Pe ? { zIndex: 100 } : void 0
5428
+ }, Pe && /* @__PURE__ */ A.createElement("header", {
5429
+ className: "grid shrink-0 items-center border-b border-zinc-200 bg-background px-3 dark:border-zinc-700",
5430
+ style: {
5431
+ height: Xa.FULLSCREEN_HEADER_HEIGHT,
5432
+ gridTemplateColumns: "auto 1fr auto"
5433
+ }
5434
+ }, E ? E({
5435
+ onClick: () => void je("inline"),
5436
+ "data-testid": "debugger-exit-fullscreen-button",
5437
+ "aria-label": "Exit fullscreen"
5438
+ }) : /* @__PURE__ */ A.createElement("button", {
5439
+ type: "button",
5440
+ "data-testid": "debugger-exit-fullscreen-button",
5441
+ "aria-label": "Exit fullscreen",
5442
+ className: "flex size-8 cursor-pointer items-center justify-center rounded-full border border-zinc-200 bg-background text-foreground shadow-sm hover:bg-muted dark:border-zinc-700",
5443
+ onClick: () => void je("inline")
5444
+ }, /* @__PURE__ */ A.createElement(io, null)), /* @__PURE__ */ A.createElement("div", { className: "flex min-w-0 items-center justify-center gap-2 px-2" }, T?.iconUrl ? /* @__PURE__ */ A.createElement("img", {
5445
+ src: T.iconUrl,
5446
+ alt: "",
5447
+ className: "size-6 shrink-0 rounded-md object-contain"
5448
+ }) : null, /* @__PURE__ */ A.createElement("span", { className: "truncate text-sm font-medium text-foreground" }, T?.title ?? r)), /* @__PURE__ */ A.createElement("div", {
5449
+ className: "size-8 shrink-0",
5450
+ "aria-hidden": !0
5451
+ })), U && (E ? /* @__PURE__ */ A.createElement("div", {
5452
+ className: "absolute right-3 top-3",
5453
+ style: { zIndex: 110 }
5454
+ }, E({
5455
+ onClick: () => void je("inline"),
5456
+ "data-testid": "debugger-exit-pip-button",
5457
+ "aria-label": "Exit picture-in-picture"
5458
+ })) : /* @__PURE__ */ A.createElement("button", {
5401
5459
  type: "button",
5402
- "data-testid": ke ? "debugger-exit-fullscreen-button" : "debugger-exit-pip-button",
5403
- "aria-label": ke ? "Exit fullscreen" : "Exit picture-in-picture",
5404
- className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-lg leading-none text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
5460
+ "data-testid": "debugger-exit-pip-button",
5461
+ "aria-label": "Exit picture-in-picture",
5462
+ className: "absolute right-3 top-3 z-[110] flex size-8 cursor-pointer items-center justify-center rounded-full border border-border bg-background/90 text-foreground shadow-sm backdrop-blur-sm hover:bg-background",
5405
5463
  style: { zIndex: 110 },
5406
- onClick: () => void Ee("inline")
5407
- }, "×"), /* @__PURE__ */ j.createElement("div", { className: ke || Ae ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, le && /* @__PURE__ */ j.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ j.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !Ae && !ke && (E || ie) && /* @__PURE__ */ j.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, E && !a ? E : ie), /* @__PURE__ */ j.createElement("div", {
5408
- "data-testid": T,
5464
+ onClick: () => void je("inline")
5465
+ }, /* @__PURE__ */ A.createElement(io, null))), /* @__PURE__ */ A.createElement("div", { className: Pe ? "relative flex min-h-0 w-full flex-1 flex-col" : U ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, de && /* @__PURE__ */ A.createElement("div", { className: "flex absolute inset-0 items-center justify-center z-10" }, /* @__PURE__ */ A.createElement("span", { className: "text-sm text-muted-foreground" }, "Loading…")), !U && !Pe && (D || O) && /* @__PURE__ */ A.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, D && !a ? D : O), /* @__PURE__ */ A.createElement("div", {
5466
+ "data-testid": ae,
5409
5467
  "data-mcp-app-tool": r,
5410
- className: z === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5411
- style: U
5412
- }, /* @__PURE__ */ j.createElement("iframe", {
5413
- ref: D,
5468
+ className: V === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
5469
+ style: Be
5470
+ }, /* @__PURE__ */ A.createElement("iframe", {
5471
+ ref: oe,
5414
5472
  title: `MCP App: ${r}`,
5415
- className: "w-full h-full border-0 bg-transparent",
5416
- style: { border: A.prefersBorder && z !== "fullscreen" ? void 0 : "none" }
5473
+ className: q ? "w-full h-full bg-transparent border border-border rounded-xl" : "w-full h-full bg-transparent border-0"
5417
5474
  }))));
5418
- return /* @__PURE__ */ j.createElement("div", { className: re }, Re);
5475
+ return /* @__PURE__ */ A.createElement("div", { className: ie }, Ve);
5419
5476
  }
5420
- function co(e, t) {
5421
- return !(e.viewId !== t.viewId || e.source !== t.source || e.sandboxUrl !== t.sandboxUrl || e.displayMode !== t.displayMode || e.cancelled !== t.cancelled || e.toolInput !== t.toolInput || e.toolOutput !== t.toolOutput || e.partialToolInput !== t.partialToolInput || e.customProps !== t.customProps || e.hostContext !== t.hostContext || e.hostCapabilities !== t.hostCapabilities || e.cspMode !== t.cspMode || e.mockOpenAiFileApis !== t.mockOpenAiFileApis || e.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
5477
+ function lo(e, t) {
5478
+ return !(e.viewId !== t.viewId || e.source !== t.source || e.sandboxUrl !== t.sandboxUrl || e.displayMode !== t.displayMode || e.cancelled !== t.cancelled || e.toolInput !== t.toolInput || e.toolOutput !== t.toolOutput || e.partialToolInput !== t.partialToolInput || e.customProps !== t.customProps || e.hostContext !== t.hostContext || e.hostCapabilities !== t.hostCapabilities || e.cspMode !== t.cspMode || e.mockOpenAiFileApis !== t.mockOpenAiFileApis || e.onInlineHeightChange !== t.onInlineHeightChange || e.fullscreenHeader !== t.fullscreenHeader || e.renderFullscreenClose !== t.renderFullscreenClose || e.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
5422
5479
  }
5423
- var lo = (0, j.memo)(so, co);
5480
+ var uo = (0, A.memo)(co, lo);
5424
5481
  //#endregion
5425
- export { _r as a, Qa as c, Pa as d, yr as i, Sa as l, Na as n, Za as o, lo as r, $a as s, Fa as t, vr as u };
5482
+ export { _r as a, Qa as c, Pa as d, yr as i, Sa as l, Na as n, Za as o, uo as r, $a as s, Fa as t, vr as u };