@mcp-use/inspector 20.0.0-beta.1 → 20.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -18
- package/dist/cdn/{AnimatePresence-B4HhIdgq.js → AnimatePresence-D1bZ5_-l.js} +80 -79
- package/dist/cdn/ChatTab-KJDI5ycl.js +6811 -0
- package/dist/cdn/{CheckboxIndicator-BF2cKfbA.js → CheckboxIndicator-BjF73mGX.js} +74 -73
- package/dist/cdn/ConnectionSettingsForm-CAvpobCm.js +929 -0
- package/dist/cdn/ConnectionSettingsTab-Nhdvdpk5.js +151 -0
- package/dist/cdn/{ElicitationTab-upPXq2q7.js → ElicitationTab-PEmEDvC5.js} +48 -47
- package/dist/cdn/{FormContext-Cl51-7O7.js → FormContext-NtUiZclE.js} +26 -26
- package/dist/cdn/{InspectorContext-DzXtgyTx.js → InspectorContext-BBKCdfmK.js} +2 -22
- package/dist/cdn/{JSONDisplay-D3RcyO9z.js → JSONDisplay-BJqMz7Ny.js} +23 -23
- package/dist/cdn/{ListTabHeader-8lULn-90.js → ListTabHeader-DzmTtN1e.js} +21 -20
- package/dist/cdn/{WidgetWrapper-D29YDxIu.js → MCPAppsDebugControls-BIiauZ_A.js} +583 -620
- package/dist/cdn/{ManufactOAuthCallback-DEM8mhWD.js → ManufactOAuthCallback-ChbbjFIT.js} +3 -3
- package/dist/cdn/MarkdownRenderer-DZuWYsja.js +3610 -0
- package/dist/cdn/McpAppsViewPanel-BTOKcnV3.js +56 -0
- package/dist/cdn/{NotificationsTab-CWopTIzT.js → NotificationsTab-B7uebqMV.js} +13 -13
- package/dist/cdn/{OAuthCallback-k3oeLtIC.js → OAuthCallback-CBWWNg2N.js} +3 -3
- package/dist/cdn/PromptsTab-DuP66kUg.js +902 -0
- package/dist/cdn/{ResourcesTab-KfamsM6-.js → ResourcesTab-BJxaJgKU.js} +106 -124
- package/dist/cdn/{SamplingTab-vcufuK24.js → SamplingTab-Bfnd-TZ-.js} +43 -42
- package/dist/cdn/{ServerMetadataTab-DS0eiyyD.js → ServerMetadataTab-BM3VhSLf.js} +14 -14
- package/dist/cdn/{StatusIcon-BGXOEU2u.js → StatusIcon-Q3n3YRtE.js} +8 -9
- package/dist/cdn/{ToolsTab-DRjcZnpu.js → ToolsTab-DGBRXBW-.js} +671 -693
- package/dist/cdn/{ViewPreview-B_onhcUB.js → ViewPreview-DPWKMeND.js} +5 -4
- package/dist/cdn/{WidgetDebugContext-D4usL_MA.js → WidgetDebugContext-B6yoOVVV.js} +1 -11
- package/dist/cdn/WidgetWrapper-BlbQAh_X.js +12 -0
- package/dist/cdn/{bell-CGjAO_0s.js → bell-GrTZcnD2.js} +1 -1
- package/dist/cdn/{browser-CbQIH4w2.js → browser-DG2Z8392.js} +1 -1
- package/dist/cdn/{brush-B_mKhyxG.js → brush-CelVvMGp.js} +1 -1
- package/dist/cdn/button-CB4uOoUV.js +2509 -0
- package/dist/cdn/{card-DqjqAq0o.js → card-BA-DQk-G.js} +2 -2
- package/dist/cdn/{checkbox-B4oUG6Rr.js → checkbox-kwVa4gRX.js} +4 -4
- package/dist/cdn/{clock-CmUbSx_B.js → clock-YMF8Gtw5.js} +1 -1
- package/dist/cdn/{code-V_0nf5rg.js → code-C8sN2OGR.js} +1 -1
- package/dist/cdn/{jsx-runtime-CIxvMpEo.js → createLucideIcon-BONxC1L5.js} +57 -24
- package/dist/cdn/{dialog-Dnl-pZsY.js → dialog-CJGnC5Ag.js} +165 -165
- package/dist/cdn/{dist-mRDqCgKU.js → dist-BgB6gR-d.js} +116 -114
- package/dist/cdn/{dist-DjXr_YO3.js → dist-CTJnCYmk.js} +1 -1
- package/dist/cdn/{external-link-CjmfT6rW.js → external-link-Bo4lQxr1.js} +1 -1
- package/dist/cdn/{eye-B7H96av8.js → eye-pSGG7nvf.js} +1 -1
- package/dist/cdn/{folder-open-B3lu2rG_.js → folder-open-aM8CPtBO.js} +1 -1
- package/dist/cdn/{hash-BVQnWi7q.js → hash-DDs2vE1k.js} +1 -1
- package/dist/cdn/{history-Csw4rb44.js → history-BfUFpL1d.js} +1 -1
- package/dist/cdn/{index-browser-CVUwR-Bu.js → index-browser-Ds41Irtb.js} +120 -201
- package/dist/cdn/{info-CNiOwqkf.js → info-BMkB68mB.js} +1 -1
- package/dist/cdn/{input-BLxOA7V-.js → input-BCpgLXU1.js} +3039 -3600
- package/dist/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +7797 -7857
- package/dist/cdn/{label-CBvG613A.js → label-A0UGV8FE.js} +8 -8
- package/dist/cdn/{loader-circle-BLy9A_pp.js → loader-circle-BKRHJEB7.js} +1 -1
- package/dist/cdn/{manufact-auth-0TVxpeTA.js → manufact-auth-BQMHhbLV.js} +142 -106
- package/dist/cdn/{maximize-2-CH5Lq90B.js → maximize-2-DdrB_spi.js} +1 -1
- package/dist/cdn/{maximize-BALCV_ep.js → maximize-hSOCz133.js} +1 -1
- package/dist/cdn/{message-square-BnxdpJxZ.js → message-square-D3tKB3uJ.js} +1 -1
- package/dist/cdn/{not-found-BcNNsTjS.js → not-found-BajFyZpp.js} +4 -6
- package/dist/cdn/{play-vuZ5PLnI.js → play-B1leulYf.js} +1 -1
- package/dist/cdn/providerMeta-CjGU4rID.js +436 -0
- package/dist/cdn/{react-BxO-uEDZ.js → react-BtzXvzGh.js} +855 -853
- package/dist/cdn/{refresh-cw-BXY-Pa0U.js → refresh-cw-CyvXrS91.js} +1 -1
- package/dist/cdn/{save-Tgil_AJZ.js → save-CmdEPUAm.js} +1 -1
- package/dist/cdn/{select-BZ_IoKxg.js → select-CCFHjOGk.js} +843 -842
- package/dist/cdn/{servers-Dm72iTpY.js → servers-Dd0Vcp81.js} +5 -1
- package/dist/cdn/{shared-uMiV6Fx1.js → shared-CJVHJhag.js} +35 -35
- package/dist/cdn/sheet-oyq1mIyg.js +2078 -0
- package/dist/cdn/{sparkles-BntO2rDR.js → sparkles-CxeZpVtX.js} +1 -1
- package/dist/cdn/{spinner-CWcJhIY_.js → spinner-Be1GlSGX.js} +3 -3
- package/dist/cdn/{square-check-big-BvwQ17Bl.js → square-check-big-C_4wbfwF.js} +1 -1
- package/dist/cdn/{switch-DtQOLb9R.js → switch-DHXEA_N5.js} +211 -210
- package/dist/cdn/{tabs-subtle-C5cy35sY.js → tabs-subtle-Dubd6Kj8.js} +259 -258
- package/dist/cdn/{telemetry-Ct6pVkM1.js → telemetry-B6Xh2ktb.js} +38 -70
- package/dist/cdn/{textarea-Bj-CT7hC.js → textarea-CwmI8_uI.js} +2 -2
- package/dist/cdn/{trash-2-RwpJY5SL.js → trash-2-BhumJAFE.js} +1 -1
- package/dist/cdn/{useAriaLabelledBy-Bm9qHGK6.js → useAriaLabelledBy-Cra6w3YY.js} +2 -1
- package/dist/cdn/{useCompositeItem-CNJ6MXdi.js → useCompositeItem-Dhnm-7el.js} +3 -3
- package/dist/cdn/{useConfig-CwxZ6Quj.js → useConfig-CLBnK-B4.js} +73 -46
- package/dist/cdn/{useSavedRequests-Ci2I919u.js → useSavedRequests-mSIsDd4c.js} +1 -1
- package/dist/cdn/{useViewHostProps-Dr6W2ooF.js → useViewHostProps-DRWpI0-w.js} +124 -108
- package/dist/cdn/{wrench-DzGmCfnb.js → wrench-DvK20LUT.js} +1 -1
- package/dist/cdn/{x-C3vRQIYu.js → x-EilKPiCX.js} +1 -1
- package/dist/cdn/{zap-Mb-pbw2X.js → zap-0Wr9QO7N.js} +1 -1
- package/dist/cli.js +87 -14
- package/dist/client/auth/manufact-auth.d.ts +3 -1
- package/dist/client/auth/manufact-auth.d.ts.map +1 -1
- package/dist/client/components/ChatTab.d.ts +1 -8
- package/dist/client/components/ChatTab.d.ts.map +1 -1
- package/dist/client/components/MCPAppsDebugControls.d.ts.map +1 -1
- package/dist/client/components/ResourcesTab.d.ts.map +1 -1
- package/dist/client/components/ToolsTab.d.ts.map +1 -1
- package/dist/client/components/chat/ChatHeader.d.ts +7 -2
- package/dist/client/components/chat/ChatHeader.d.ts.map +1 -1
- package/dist/client/components/chat/ChatLandingForm.d.ts +4 -2
- package/dist/client/components/chat/ChatLandingForm.d.ts.map +1 -1
- package/dist/client/components/chat/ChatManagedNotice.d.ts +10 -0
- package/dist/client/components/chat/ChatManagedNotice.d.ts.map +1 -0
- package/dist/client/components/chat/ChatScrollTopFade.d.ts +7 -0
- package/dist/client/components/chat/ChatScrollTopFade.d.ts.map +1 -0
- package/dist/client/components/chat/ConfigurationDialog.d.ts +11 -9
- package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
- package/dist/client/components/chat/ConfigureEmptyState.d.ts +1 -6
- package/dist/client/components/chat/ConfigureEmptyState.d.ts.map +1 -1
- package/dist/client/components/chat/MessageList.d.ts +1 -0
- package/dist/client/components/chat/MessageList.d.ts.map +1 -1
- package/dist/client/components/chat/StreamingAssistantContent.d.ts.map +1 -1
- package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
- package/dist/client/components/chat/chatModeStorage.d.ts +11 -0
- package/dist/client/components/chat/chatModeStorage.d.ts.map +1 -0
- package/dist/client/components/chat/managedChatNotice.d.ts +16 -0
- package/dist/client/components/chat/managedChatNotice.d.ts.map +1 -0
- package/dist/client/components/chat/partialToolArgs.d.ts +10 -0
- package/dist/client/components/chat/partialToolArgs.d.ts.map +1 -0
- package/dist/client/components/chat/providerMeta.d.ts +11 -0
- package/dist/client/components/chat/providerMeta.d.ts.map +1 -1
- package/dist/client/components/chat/types.d.ts +1 -0
- package/dist/client/components/chat/types.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessages.d.ts +7 -5
- package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts +4 -6
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
- package/dist/client/components/chat/useChatScrollToBottom.d.ts +1 -0
- package/dist/client/components/chat/useChatScrollToBottom.d.ts.map +1 -1
- package/dist/client/components/chat/useConfig.d.ts +1 -1
- package/dist/client/components/chat/useConfig.d.ts.map +1 -1
- package/dist/client/components/chat/useHostedChatMode.d.ts +1 -1
- package/dist/client/components/chat/useHostedChatMode.d.ts.map +1 -1
- package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts +29 -0
- package/dist/client/components/mcp-apps/McpAppsViewPanel.d.ts.map +1 -0
- package/dist/client/components/shared/MarkdownRenderer.d.ts +2 -1
- package/dist/client/components/shared/MarkdownRenderer.d.ts.map +1 -1
- package/dist/client/components/tools/ToolExecutionPanel.d.ts.map +1 -1
- package/dist/client/components/tools/ToolResultDisplay.d.ts +2 -1
- package/dist/client/components/tools/ToolResultDisplay.d.ts.map +1 -1
- package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -1
- package/dist/client/components/ui/MeshGradientCanvas.d.ts +13 -0
- package/dist/client/components/ui/MeshGradientCanvas.d.ts.map +1 -0
- package/dist/client/components/ui/chat-message.d.ts +1 -1
- package/dist/client/components/ui/chat-message.d.ts.map +1 -1
- package/dist/client/components/ui/file-thumbnail.d.ts.map +1 -1
- package/dist/client/components/ui/mesh-animation-pause.d.ts +14 -0
- package/dist/client/components/ui/mesh-animation-pause.d.ts.map +1 -0
- package/dist/client/components/ui/mesh-gradient-colors.d.ts +6 -0
- package/dist/client/components/ui/mesh-gradient-colors.d.ts.map +1 -0
- package/dist/client/components/ui/mesh-tab-background.d.ts +3 -1
- package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -1
- package/dist/client/components/ui/not-found.d.ts.map +1 -1
- package/dist/client/context/InspectorContext.d.ts.map +1 -1
- package/dist/client/context/WidgetDebugContext.d.ts +1 -11
- package/dist/client/context/WidgetDebugContext.d.ts.map +1 -1
- package/dist/client/hooks/useDeviceViewport.d.ts +1 -5
- package/dist/client/hooks/useDeviceViewport.d.ts.map +1 -1
- package/dist/client/hooks/useViewHostProps.d.ts +1 -1
- package/dist/client/hooks/useViewHostProps.d.ts.map +1 -1
- package/dist/client/index.js +4202 -3491
- package/dist/client/telemetry/init.d.ts.map +1 -1
- package/dist/client/telemetry/utils.d.ts.map +1 -1
- package/dist/client/utils/servers.d.ts +5 -0
- package/dist/client/utils/servers.d.ts.map +1 -1
- package/dist/server/asset-urls.d.ts +4 -0
- package/dist/server/asset-urls.d.ts.map +1 -1
- package/dist/server/asset-urls.js +7 -3
- package/dist/server/cdn-shell.d.ts.map +1 -1
- package/dist/server/cdn-shell.js +3 -3
- package/dist/server/{chunk-Y2GBQOQW.js → chunk-7BTEIKSA.js} +2 -9
- package/dist/server/{chunk-VDUV6LR6.js → chunk-FJ7P3RIU.js} +75 -5
- package/dist/server/{chunk-KBVKS4J5.js → chunk-H6ZCIKBS.js} +10 -0
- package/dist/server/{chunk-K2V2SDQD.js → chunk-OWR2BIBW.js} +1 -1
- package/dist/server/{chunk-IXYK6ZOY.js → chunk-PY5HM5DW.js} +2 -2
- package/dist/server/{chunk-5B3SXGZP.js → chunk-UJLXHNQP.js} +1 -1
- package/dist/server/{chunk-6XWDZEFF.js → chunk-XCNS5CIW.js} +8 -3
- package/dist/server/cli.js +5 -5
- package/dist/server/create-dev-api-app.js +3 -3
- package/dist/server/dev-callback-redirect.d.ts +3 -0
- package/dist/server/dev-callback-redirect.d.ts.map +1 -0
- package/dist/server/dev-callback-redirect.js +18 -0
- package/dist/server/index.js +6 -6
- package/dist/server/middleware.js +6 -6
- package/dist/server/proxy/index.js +1 -1
- package/dist/server/proxy/mcp-proxy.d.ts +2 -0
- package/dist/server/proxy/mcp-proxy.d.ts.map +1 -1
- package/dist/server/proxy/mcp-proxy.js +3 -1
- package/dist/server/proxy-routes.js +2 -2
- package/dist/server/server.js +3 -3
- package/dist/server/version.js +1 -1
- package/dist/server/vite-dev-api-plugin.js +3 -3
- package/dist/web/assets/AnimatePresence-FfDQQNFJ.js +9 -0
- package/dist/web/assets/ChatTab-B_CvwC4L.js +18 -0
- package/dist/web/assets/ConnectionSettingsTab-OhY1ex8u.js +1 -0
- package/dist/web/assets/ElicitationTab-CwkUbGUo.js +1 -0
- package/dist/web/assets/FormContext-sV-yByKz.js +1 -0
- package/dist/web/assets/ListTabHeader-CrGae306.js +1 -0
- package/dist/web/assets/MCPAppsDebugControls-SlpRw9KD.js +34 -0
- package/dist/web/assets/{ManufactOAuthCallback-DCLbW-mz.js → ManufactOAuthCallback-DgIxvi85.js} +1 -1
- package/dist/web/assets/MarkdownRenderer-B_n2JuA3.js +47 -0
- package/dist/web/assets/McpAppsViewPanel-CR8zhRi4.js +1 -0
- package/dist/web/assets/{NotificationsTab-JevzvJTg.js → NotificationsTab-DeGCkKLB.js} +1 -1
- package/dist/web/assets/{OAuthCallback-BjcRxLh5.js → OAuthCallback-DhFgvjS_.js} +1 -1
- package/dist/web/assets/PromptsTab-DZVkm_vn.js +15 -0
- package/dist/web/assets/ResourcesTab-5mZflymU.js +2 -0
- package/dist/web/assets/SamplingTab-TWoyNn8-.js +1 -0
- package/dist/web/assets/ServerMetadataTab-DZZpijCY.js +1 -0
- package/dist/web/assets/ToolsTab-DEZiEf9V.js +8 -0
- package/dist/web/assets/ViewPreview-ymDMBa0M.js +1 -0
- package/dist/web/assets/WidgetWrapper-cv_BM1bY.js +1 -0
- package/dist/web/assets/{brush--0LobUi4.js → brush-DX0UZ_pI.js} +1 -1
- package/dist/web/assets/button-C8Xa2k4x.js +1 -0
- package/dist/web/assets/checkbox-Wgm0SaKL.js +1 -0
- package/dist/web/assets/code-B14rVdNt.js +1 -0
- package/dist/web/assets/createLucideIcon-BEHeJH0M.js +1 -0
- package/dist/web/assets/dist-Bl7zPiY1.js +21 -0
- package/dist/web/assets/index-CpswgjB5.js +499 -0
- package/dist/web/assets/index-bCIH1Sdx.css +1 -0
- package/dist/web/assets/input-C0OQCUZy.js +1 -0
- package/dist/web/assets/{label-B5Q_Zr8M.js → label-CI7JWQOo.js} +1 -1
- package/dist/web/assets/{maximize-2-BTT9QQU9.js → maximize-2-Br1WQzT2.js} +1 -1
- package/dist/web/assets/{maximize-_O55kFcr.js → maximize-CJNgRe6S.js} +1 -1
- package/dist/web/assets/{refresh-cw-C9wQl8_d.js → refresh-cw-B5iaAZKn.js} +1 -1
- package/dist/web/assets/{save-B-MsgxX9.js → save-TM6fvNrt.js} +1 -1
- package/dist/web/assets/select-D6jzbLJn.js +1 -0
- package/dist/web/assets/shared-BtvKT_T4.js +1 -0
- package/dist/web/assets/{sparkles-2OAsc1aP.js → sparkles-BGYTDThM.js} +1 -1
- package/dist/web/assets/tabs-subtle-C5J9sUzi.js +1 -0
- package/dist/web/assets/textarea-CRTXuRmE.js +1 -0
- package/dist/web/assets/useConfig-CZkuy4Iy.js +1 -0
- package/dist/web/assets/useViewHostProps-nCaYmcbd.js +1 -0
- package/dist/web/assets/{zap-Du2Uc5pa.js → zap-BDWHCVHU.js} +1 -1
- package/dist/web/index.html +10 -11
- package/package.json +5 -12
- package/dist/cdn/ChatTab-D8uwCHAf.js +0 -13218
- package/dist/cdn/ConnectionSettingsForm-BNS6bOMD.js +0 -873
- package/dist/cdn/ConnectionSettingsTab-B97gPPJW.js +0 -145
- package/dist/cdn/PromptsTab-Cspfnl6n.js +0 -4400
- package/dist/cdn/bundle-mjs-B0nmHDtp.js +0 -1953
- package/dist/cdn/chunk-BO2N2NFS-Cy167e0X.js +0 -17500
- package/dist/cdn/createLucideIcon-C5fZZ6oB.js +0 -38
- package/dist/cdn/highlighted-body-OFNGDK62-CoReNbTX.js +0 -36
- package/dist/cdn/mermaid-GHXKKRXX-DgVIbk-D.js +0 -2
- package/dist/cdn/pdf-CxFT9FER.js +0 -16291
- package/dist/cdn/popover-C_SSrXT0.js +0 -2005
- package/dist/cdn/sheet-CerCdhxz.js +0 -78
- package/dist/cdn/useHostedSession-BA39Aegc.js +0 -153
- package/dist/cdn/useMCPPrompts-D3_Hla_z.js +0 -104
- package/dist/client/components/chat/streamdown-code-slim.d.ts +0 -4
- package/dist/client/components/chat/streamdown-code-slim.d.ts.map +0 -1
- package/dist/web/assets/AnimatePresence-CthXziG2.js +0 -9
- package/dist/web/assets/ChatTab-Cy8eyFYI.js +0 -460
- package/dist/web/assets/ConnectionSettingsTab-sDZGaUJn.js +0 -1
- package/dist/web/assets/ElicitationTab-wDKgU1qL.js +0 -1
- package/dist/web/assets/FormContext-Cqc_A12u.js +0 -1
- package/dist/web/assets/ListTabHeader-G-nQX18m.js +0 -1
- package/dist/web/assets/PromptsTab-DsQVOjKH.js +0 -61
- package/dist/web/assets/ResourcesTab-Bw8_p6M1.js +0 -2
- package/dist/web/assets/SamplingTab-BrcF1zJF.js +0 -1
- package/dist/web/assets/ServerMetadataTab-Bydeh1Po.js +0 -1
- package/dist/web/assets/ToolsTab-DJWF7Q_x.js +0 -8
- package/dist/web/assets/ViewPreview-jgeU7bY9.js +0 -1
- package/dist/web/assets/WidgetWrapper-B_vJU9uF.js +0 -34
- package/dist/web/assets/bundle-mjs-8puS6ou7.js +0 -1
- package/dist/web/assets/checkbox-BA-XURSj.js +0 -1
- package/dist/web/assets/chunk-BO2N2NFS-CGbd3eLY.js +0 -131
- package/dist/web/assets/code-tME-5H6D.js +0 -1
- package/dist/web/assets/createLucideIcon-B3b8EU0b.js +0 -1
- package/dist/web/assets/dist-BcAQZluc.js +0 -21
- package/dist/web/assets/highlighted-body-OFNGDK62-BBJFbIMp.js +0 -1
- package/dist/web/assets/index-BjH-Qp85.css +0 -1
- package/dist/web/assets/index-D2UxaT9v.js +0 -475
- package/dist/web/assets/input-CjmxOFr6.js +0 -1
- package/dist/web/assets/jsx-runtime-Cjj9sGSy.js +0 -1
- package/dist/web/assets/mermaid-GHXKKRXX-B4MKVODA.js +0 -1
- package/dist/web/assets/pdf-CuwKm9zO.js +0 -54
- package/dist/web/assets/select-C0xlfLAa.js +0 -1
- package/dist/web/assets/shared-DQE60Op-.js +0 -1
- package/dist/web/assets/sheet-7TIkLdpr.js +0 -1
- package/dist/web/assets/tabs-subtle-AkJZvdxS.js +0 -1
- package/dist/web/assets/textarea-Ci09-en6.js +0 -1
- package/dist/web/assets/useConfig-Qglo4xs1.js +0 -1
- package/dist/web/assets/useMCPPrompts-USLYc1I4.js +0 -1
- package/dist/web/assets/useViewHostProps-DXAD1g7g.js +0 -1
|
@@ -1,144 +1,144 @@
|
|
|
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 D, t as
|
|
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 D, t as ie, v as O, w as k, x as ae, y as A } 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
|
|
4
|
+
var j = /* @__PURE__ */ t(n(), 1), oe = "io.modelcontextprotocol/related-task", se = "io.modelcontextprotocol/subscriptionId", M = ae(() => x([
|
|
5
5
|
r(),
|
|
6
6
|
p(),
|
|
7
|
-
|
|
7
|
+
O(),
|
|
8
8
|
ne(),
|
|
9
|
-
S(r(),
|
|
10
|
-
m(
|
|
11
|
-
])),
|
|
12
|
-
m(
|
|
13
|
-
var
|
|
14
|
-
progressToken:
|
|
15
|
-
[
|
|
16
|
-
}),
|
|
9
|
+
S(r(), M),
|
|
10
|
+
m(M)
|
|
11
|
+
])), N = S(r(), M);
|
|
12
|
+
m(M);
|
|
13
|
+
var ce = x([r(), p().int()]), P = r(), le = o({ ttl: p().optional() }), ue = o({ taskId: r() }), de = i({
|
|
14
|
+
progressToken: ce.optional(),
|
|
15
|
+
[oe]: ue.optional()
|
|
16
|
+
}), F = o({ _meta: de.optional() }), fe = F.extend({ task: le.optional() }), I = o({
|
|
17
17
|
method: r(),
|
|
18
|
-
params:
|
|
19
|
-
}),
|
|
18
|
+
params: F.loose().optional()
|
|
19
|
+
}), L = o({ _meta: de.optional() }), R = o({
|
|
20
20
|
method: r(),
|
|
21
|
-
params:
|
|
22
|
-
}),
|
|
21
|
+
params: L.loose().optional()
|
|
22
|
+
}), z = i({ _meta: de.optional() }), pe = x([r(), p().int()]), me = o({
|
|
23
23
|
jsonrpc: f("2.0"),
|
|
24
|
-
id:
|
|
25
|
-
...
|
|
26
|
-
}).strict(),
|
|
24
|
+
id: pe,
|
|
25
|
+
...I.shape
|
|
26
|
+
}).strict(), he = o({
|
|
27
27
|
jsonrpc: f("2.0"),
|
|
28
|
-
...
|
|
29
|
-
}).strict(),
|
|
28
|
+
...R.shape
|
|
29
|
+
}).strict(), ge = o({
|
|
30
30
|
jsonrpc: f("2.0"),
|
|
31
|
-
id:
|
|
32
|
-
result:
|
|
33
|
-
}).strict(),
|
|
31
|
+
id: pe,
|
|
32
|
+
result: z
|
|
33
|
+
}).strict(), _e = o({
|
|
34
34
|
jsonrpc: f("2.0"),
|
|
35
|
-
id:
|
|
35
|
+
id: pe.optional(),
|
|
36
36
|
error: o({
|
|
37
37
|
code: p().int(),
|
|
38
38
|
message: r(),
|
|
39
39
|
data: c().optional()
|
|
40
40
|
})
|
|
41
|
-
}).strict(),
|
|
42
|
-
fe,
|
|
43
|
-
pe,
|
|
41
|
+
}).strict(), ve = x([
|
|
44
42
|
me,
|
|
45
|
-
he
|
|
43
|
+
he,
|
|
44
|
+
ge,
|
|
45
|
+
_e
|
|
46
46
|
]);
|
|
47
|
-
x([
|
|
48
|
-
var
|
|
49
|
-
requestId:
|
|
47
|
+
x([ge, _e]);
|
|
48
|
+
var ye = z.strict(), be = L.extend({
|
|
49
|
+
requestId: pe.optional(),
|
|
50
50
|
reason: r().optional()
|
|
51
|
-
}),
|
|
51
|
+
}), xe = R.extend({
|
|
52
52
|
method: f("notifications/cancelled"),
|
|
53
|
-
params:
|
|
54
|
-
}),
|
|
53
|
+
params: be
|
|
54
|
+
}), B = 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() }),
|
|
59
|
+
})).optional() }), Se = o({
|
|
60
60
|
name: r(),
|
|
61
61
|
title: r().optional()
|
|
62
|
-
}),
|
|
63
|
-
...
|
|
64
|
-
...
|
|
62
|
+
}), Ce = Se.extend({
|
|
63
|
+
...Se.shape,
|
|
64
|
+
...B.shape,
|
|
65
65
|
version: r(),
|
|
66
66
|
websiteUrl: r().optional(),
|
|
67
67
|
description: r().optional()
|
|
68
|
-
}),
|
|
69
|
-
form: g(o({ applyDefaults:
|
|
70
|
-
url:
|
|
71
|
-
}),
|
|
72
|
-
list:
|
|
73
|
-
cancel:
|
|
68
|
+
}), we = 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() }), N).optional(),
|
|
70
|
+
url: N.optional()
|
|
71
|
+
}), N.optional())), Te = i({
|
|
72
|
+
list: N.optional(),
|
|
73
|
+
cancel: N.optional(),
|
|
74
74
|
requests: i({
|
|
75
|
-
sampling: i({ createMessage:
|
|
76
|
-
elicitation: i({ create:
|
|
75
|
+
sampling: i({ createMessage: N.optional() }).optional(),
|
|
76
|
+
elicitation: i({ create: N.optional() }).optional()
|
|
77
77
|
}).optional()
|
|
78
|
-
}),
|
|
79
|
-
list:
|
|
80
|
-
cancel:
|
|
81
|
-
requests: i({ tools: i({ call:
|
|
82
|
-
}),
|
|
83
|
-
experimental: S(r(),
|
|
78
|
+
}), Ee = i({
|
|
79
|
+
list: N.optional(),
|
|
80
|
+
cancel: N.optional(),
|
|
81
|
+
requests: i({ tools: i({ call: N.optional() }).optional() }).optional()
|
|
82
|
+
}), De = o({
|
|
83
|
+
experimental: S(r(), N).optional(),
|
|
84
84
|
sampling: o({
|
|
85
|
-
context:
|
|
86
|
-
tools:
|
|
85
|
+
context: N.optional(),
|
|
86
|
+
tools: N.optional()
|
|
87
87
|
}).optional(),
|
|
88
|
-
elicitation:
|
|
89
|
-
roots: o({ listChanged:
|
|
90
|
-
tasks:
|
|
91
|
-
extensions: S(r(),
|
|
92
|
-
}),
|
|
88
|
+
elicitation: we.optional(),
|
|
89
|
+
roots: o({ listChanged: O().optional() }).optional(),
|
|
90
|
+
tasks: Te.optional(),
|
|
91
|
+
extensions: S(r(), N).optional()
|
|
92
|
+
}), V = F.extend({
|
|
93
93
|
protocolVersion: r(),
|
|
94
|
-
capabilities:
|
|
95
|
-
clientInfo:
|
|
96
|
-
}),
|
|
94
|
+
capabilities: De,
|
|
95
|
+
clientInfo: Ce
|
|
96
|
+
}), Oe = I.extend({
|
|
97
97
|
method: f("initialize"),
|
|
98
|
-
params:
|
|
99
|
-
}),
|
|
100
|
-
experimental: S(r(),
|
|
101
|
-
logging:
|
|
102
|
-
completions:
|
|
103
|
-
prompts: o({ listChanged:
|
|
98
|
+
params: V
|
|
99
|
+
}), ke = o({
|
|
100
|
+
experimental: S(r(), N).optional(),
|
|
101
|
+
logging: N.optional(),
|
|
102
|
+
completions: N.optional(),
|
|
103
|
+
prompts: o({ listChanged: O().optional() }).optional(),
|
|
104
104
|
resources: o({
|
|
105
|
-
subscribe:
|
|
106
|
-
listChanged:
|
|
105
|
+
subscribe: O().optional(),
|
|
106
|
+
listChanged: O().optional()
|
|
107
107
|
}).optional(),
|
|
108
|
-
tools: o({ listChanged:
|
|
109
|
-
tasks:
|
|
110
|
-
extensions: S(r(),
|
|
111
|
-
}),
|
|
108
|
+
tools: o({ listChanged: O().optional() }).optional(),
|
|
109
|
+
tasks: Ee.optional(),
|
|
110
|
+
extensions: S(r(), N).optional()
|
|
111
|
+
}), Ae = z.extend({
|
|
112
112
|
protocolVersion: r(),
|
|
113
|
-
capabilities:
|
|
114
|
-
serverInfo:
|
|
113
|
+
capabilities: ke,
|
|
114
|
+
serverInfo: Ce,
|
|
115
115
|
instructions: r().optional()
|
|
116
|
-
}), Ae = B.extend({
|
|
117
|
-
method: f("notifications/initialized"),
|
|
118
|
-
params: z.optional()
|
|
119
116
|
}), je = R.extend({
|
|
120
|
-
method: f("
|
|
117
|
+
method: f("notifications/initialized"),
|
|
121
118
|
params: L.optional()
|
|
122
|
-
}), Me =
|
|
119
|
+
}), Me = I.extend({
|
|
120
|
+
method: f("server/discover"),
|
|
121
|
+
params: F.optional()
|
|
122
|
+
}), Ne = z.extend({
|
|
123
123
|
supportedVersions: m(r()),
|
|
124
|
-
capabilities:
|
|
125
|
-
serverInfo:
|
|
124
|
+
capabilities: ke,
|
|
125
|
+
serverInfo: Ce,
|
|
126
126
|
instructions: r().optional()
|
|
127
|
-
}),
|
|
127
|
+
}), Pe = I.extend({
|
|
128
128
|
method: f("ping"),
|
|
129
|
-
params:
|
|
130
|
-
}),
|
|
129
|
+
params: F.optional()
|
|
130
|
+
}), Fe = o({
|
|
131
131
|
progress: p(),
|
|
132
132
|
total: a(p()),
|
|
133
133
|
message: a(r())
|
|
134
|
-
}),
|
|
135
|
-
...
|
|
136
|
-
...
|
|
137
|
-
progressToken:
|
|
138
|
-
}), Ie =
|
|
134
|
+
}), H = o({
|
|
135
|
+
...L.shape,
|
|
136
|
+
...Fe.shape,
|
|
137
|
+
progressToken: ce
|
|
138
|
+
}), Ie = R.extend({
|
|
139
139
|
method: f("notifications/progress"),
|
|
140
|
-
params:
|
|
141
|
-
}), Le =
|
|
140
|
+
params: H
|
|
141
|
+
}), Le = F.extend({ cursor: P.optional() }), U = I.extend({ params: Le.optional() }), Re = z.extend({ nextCursor: P.optional() }), W = o({
|
|
142
142
|
uri: r(),
|
|
143
143
|
mimeType: a(r()),
|
|
144
144
|
_meta: S(r(), c()).optional()
|
|
@@ -153,8 +153,8 @@ var _e = V.strict(), ve = z.extend({
|
|
|
153
153
|
priority: p().min(0).max(1).optional(),
|
|
154
154
|
lastModified: d({ offset: !0 }).optional()
|
|
155
155
|
}), He = o({
|
|
156
|
-
...
|
|
157
|
-
...
|
|
156
|
+
...Se.shape,
|
|
157
|
+
...B.shape,
|
|
158
158
|
uri: r(),
|
|
159
159
|
description: a(r()),
|
|
160
160
|
mimeType: a(r()),
|
|
@@ -162,53 +162,53 @@ var _e = V.strict(), ve = z.extend({
|
|
|
162
162
|
annotations: Ve.optional(),
|
|
163
163
|
_meta: a(i({}))
|
|
164
164
|
}), Ue = o({
|
|
165
|
-
...
|
|
166
|
-
...
|
|
165
|
+
...Se.shape,
|
|
166
|
+
...B.shape,
|
|
167
167
|
uriTemplate: r(),
|
|
168
168
|
description: a(r()),
|
|
169
169
|
mimeType: a(r()),
|
|
170
170
|
annotations: Ve.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 =
|
|
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 = F.extend({ uri: r() }), Je = qe, Ye = I.extend({
|
|
173
173
|
method: f("resources/read"),
|
|
174
174
|
params: Je
|
|
175
|
-
}), Xe =
|
|
175
|
+
}), Xe = z.extend({ contents: m(x([ze, K])) }), Ze = R.extend({
|
|
176
176
|
method: f("notifications/resources/list_changed"),
|
|
177
|
-
params:
|
|
178
|
-
}), Qe = qe, $e =
|
|
177
|
+
params: L.optional()
|
|
178
|
+
}), Qe = qe, $e = I.extend({
|
|
179
179
|
method: f("resources/subscribe"),
|
|
180
180
|
params: Qe
|
|
181
|
-
}), et = qe, tt =
|
|
181
|
+
}), et = qe, tt = I.extend({
|
|
182
182
|
method: f("resources/unsubscribe"),
|
|
183
183
|
params: et
|
|
184
184
|
}), nt = o({
|
|
185
|
-
toolsListChanged:
|
|
186
|
-
promptsListChanged:
|
|
187
|
-
resourcesListChanged:
|
|
185
|
+
toolsListChanged: O().optional(),
|
|
186
|
+
promptsListChanged: O().optional(),
|
|
187
|
+
resourcesListChanged: O().optional(),
|
|
188
188
|
resourceSubscriptions: m(r()).optional()
|
|
189
|
-
}), J =
|
|
189
|
+
}), J = F.extend({ notifications: nt }), rt = I.extend({
|
|
190
190
|
method: f("subscriptions/listen"),
|
|
191
191
|
params: J
|
|
192
|
-
}), it =
|
|
192
|
+
}), it = L.extend({ notifications: nt }), Y = R.extend({
|
|
193
193
|
method: f("notifications/subscriptions/acknowledged"),
|
|
194
194
|
params: it
|
|
195
|
-
}), at = i({ [
|
|
195
|
+
}), at = i({ [se]: pe }), ot = z.extend({ _meta: at }), st = L.extend({ uri: r() }), ct = R.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(
|
|
201
|
+
required: a(O())
|
|
202
202
|
}), ut = o({
|
|
203
|
-
...
|
|
204
|
-
...
|
|
203
|
+
...Se.shape,
|
|
204
|
+
...B.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 =
|
|
208
|
+
}), dt = U.extend({ method: f("prompts/list") }), ft = Re.extend({ prompts: m(ut) }), pt = F.extend({
|
|
209
209
|
name: r(),
|
|
210
210
|
arguments: S(r(), r()).optional()
|
|
211
|
-
}), mt =
|
|
211
|
+
}), mt = I.extend({
|
|
212
212
|
method: f("prompts/get"),
|
|
213
213
|
params: pt
|
|
214
214
|
}), ht = o({
|
|
@@ -248,53 +248,53 @@ var _e = V.strict(), ve = z.extend({
|
|
|
248
248
|
]), St = o({
|
|
249
249
|
role: Be,
|
|
250
250
|
content: xt
|
|
251
|
-
}), Ct =
|
|
251
|
+
}), Ct = z.extend({
|
|
252
252
|
description: r().optional(),
|
|
253
253
|
messages: m(St)
|
|
254
|
-
}), wt =
|
|
254
|
+
}), wt = R.extend({
|
|
255
255
|
method: f("notifications/prompts/list_changed"),
|
|
256
|
-
params:
|
|
256
|
+
params: L.optional()
|
|
257
257
|
}), Tt = o({
|
|
258
258
|
title: r().optional(),
|
|
259
|
-
readOnlyHint:
|
|
260
|
-
destructiveHint:
|
|
261
|
-
idempotentHint:
|
|
262
|
-
openWorldHint:
|
|
259
|
+
readOnlyHint: O().optional(),
|
|
260
|
+
destructiveHint: O().optional(),
|
|
261
|
+
idempotentHint: O().optional(),
|
|
262
|
+
openWorldHint: O().optional()
|
|
263
263
|
}), Et = o({ taskSupport: T([
|
|
264
264
|
"required",
|
|
265
265
|
"optional",
|
|
266
266
|
"forbidden"
|
|
267
267
|
]).optional() }), Dt = o({
|
|
268
|
-
...
|
|
269
|
-
...
|
|
268
|
+
...Se.shape,
|
|
269
|
+
...B.shape,
|
|
270
270
|
description: r().optional(),
|
|
271
271
|
inputSchema: o({
|
|
272
272
|
type: f("object"),
|
|
273
|
-
properties: S(r(),
|
|
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 =
|
|
280
|
+
}), Ot = U.extend({ method: f("tools/list") }), kt = Re.extend({ tools: m(Dt) }), At = z.extend({
|
|
281
281
|
content: m(xt).default([]),
|
|
282
282
|
structuredContent: c().optional(),
|
|
283
|
-
isError:
|
|
283
|
+
isError: O().optional()
|
|
284
284
|
});
|
|
285
|
-
At.or(
|
|
286
|
-
var jt =
|
|
285
|
+
At.or(z.extend({ toolResult: c() }));
|
|
286
|
+
var jt = fe.extend({
|
|
287
287
|
name: r(),
|
|
288
288
|
arguments: S(r(), c()).optional()
|
|
289
|
-
}), Mt =
|
|
289
|
+
}), Mt = I.extend({
|
|
290
290
|
method: f("tools/call"),
|
|
291
291
|
params: jt
|
|
292
|
-
}), Nt =
|
|
292
|
+
}), Nt = R.extend({
|
|
293
293
|
method: f("notifications/tools/list_changed"),
|
|
294
|
-
params:
|
|
294
|
+
params: L.optional()
|
|
295
295
|
});
|
|
296
296
|
o({
|
|
297
|
-
autoRefresh:
|
|
297
|
+
autoRefresh: O().default(!0),
|
|
298
298
|
debounceMs: p().int().nonnegative().default(300)
|
|
299
299
|
});
|
|
300
300
|
var Pt = T([
|
|
@@ -306,14 +306,14 @@ var Pt = T([
|
|
|
306
306
|
"critical",
|
|
307
307
|
"alert",
|
|
308
308
|
"emergency"
|
|
309
|
-
]), Ft =
|
|
309
|
+
]), Ft = F.extend({ level: Pt }), It = I.extend({
|
|
310
310
|
method: f("logging/setLevel"),
|
|
311
311
|
params: Ft
|
|
312
|
-
}), Lt =
|
|
312
|
+
}), Lt = L.extend({
|
|
313
313
|
level: Pt,
|
|
314
314
|
logger: r().optional(),
|
|
315
315
|
data: c()
|
|
316
|
-
}), Rt =
|
|
316
|
+
}), Rt = R.extend({
|
|
317
317
|
method: f("notifications/message"),
|
|
318
318
|
params: Lt
|
|
319
319
|
}), zt = o({
|
|
@@ -330,13 +330,13 @@ 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:
|
|
333
|
+
isError: O().optional(),
|
|
334
334
|
_meta: S(r(), c()).optional()
|
|
335
|
-
}), Ht =
|
|
335
|
+
}), Ht = A("type", [
|
|
336
336
|
ht,
|
|
337
337
|
gt,
|
|
338
338
|
_t
|
|
339
|
-
]), Ut =
|
|
339
|
+
]), Ut = A("type", [
|
|
340
340
|
ht,
|
|
341
341
|
gt,
|
|
342
342
|
_t,
|
|
@@ -346,7 +346,7 @@ var Pt = T([
|
|
|
346
346
|
role: Be,
|
|
347
347
|
content: x([Ut, m(Ut)]),
|
|
348
348
|
_meta: S(r(), c()).optional()
|
|
349
|
-
}), Gt =
|
|
349
|
+
}), Gt = fe.extend({
|
|
350
350
|
messages: m(Wt),
|
|
351
351
|
modelPreferences: zt.optional(),
|
|
352
352
|
systemPrompt: r().optional(),
|
|
@@ -358,13 +358,13 @@ var Pt = T([
|
|
|
358
358
|
temperature: p().optional(),
|
|
359
359
|
maxTokens: p().int(),
|
|
360
360
|
stopSequences: m(r()).optional(),
|
|
361
|
-
metadata:
|
|
361
|
+
metadata: N.optional(),
|
|
362
362
|
tools: m(Dt).optional(),
|
|
363
363
|
toolChoice: Bt.optional()
|
|
364
|
-
}), Kt =
|
|
364
|
+
}), Kt = I.extend({
|
|
365
365
|
method: f("sampling/createMessage"),
|
|
366
366
|
params: Gt
|
|
367
|
-
}), qt =
|
|
367
|
+
}), qt = z.extend({
|
|
368
368
|
model: r(),
|
|
369
369
|
stopReason: a(T([
|
|
370
370
|
"endTurn",
|
|
@@ -373,7 +373,7 @@ var Pt = T([
|
|
|
373
373
|
]).or(r())),
|
|
374
374
|
role: Be,
|
|
375
375
|
content: Ht
|
|
376
|
-
}), Jt =
|
|
376
|
+
}), Jt = z.extend({
|
|
377
377
|
model: r(),
|
|
378
378
|
stopReason: a(T([
|
|
379
379
|
"endTurn",
|
|
@@ -387,7 +387,7 @@ var Pt = T([
|
|
|
387
387
|
type: f("boolean"),
|
|
388
388
|
title: r().optional(),
|
|
389
389
|
description: r().optional(),
|
|
390
|
-
default:
|
|
390
|
+
default: O().optional()
|
|
391
391
|
}), Xt = o({
|
|
392
392
|
type: f("string"),
|
|
393
393
|
title: r().optional(),
|
|
@@ -461,7 +461,7 @@ var Pt = T([
|
|
|
461
461
|
Yt,
|
|
462
462
|
Xt,
|
|
463
463
|
Zt
|
|
464
|
-
]), tn = x([
|
|
464
|
+
]), tn = x([fe.extend({
|
|
465
465
|
mode: f("form").optional(),
|
|
466
466
|
message: r(),
|
|
467
467
|
requestedSchema: o({
|
|
@@ -469,18 +469,18 @@ var Pt = T([
|
|
|
469
469
|
properties: S(r(), en),
|
|
470
470
|
required: m(r()).optional()
|
|
471
471
|
}).catchall(c())
|
|
472
|
-
}),
|
|
472
|
+
}), fe.extend({
|
|
473
473
|
mode: f("url"),
|
|
474
474
|
message: r(),
|
|
475
475
|
elicitationId: r(),
|
|
476
476
|
url: r().url()
|
|
477
|
-
})]), nn =
|
|
477
|
+
})]), nn = I.extend({
|
|
478
478
|
method: f("elicitation/create"),
|
|
479
479
|
params: tn
|
|
480
|
-
}), rn =
|
|
480
|
+
}), rn = L.extend({ elicitationId: r() }), an = R.extend({
|
|
481
481
|
method: f("notifications/elicitation/complete"),
|
|
482
482
|
params: rn
|
|
483
|
-
}), on =
|
|
483
|
+
}), on = z.extend({
|
|
484
484
|
action: T([
|
|
485
485
|
"accept",
|
|
486
486
|
"decline",
|
|
@@ -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
|
-
|
|
492
|
+
O(),
|
|
493
493
|
m(r())
|
|
494
494
|
])).optional())
|
|
495
495
|
}), sn = o({
|
|
@@ -498,30 +498,30 @@ var Pt = T([
|
|
|
498
498
|
}), cn = o({
|
|
499
499
|
type: f("ref/prompt"),
|
|
500
500
|
name: r()
|
|
501
|
-
}), ln =
|
|
501
|
+
}), ln = F.extend({
|
|
502
502
|
ref: x([cn, sn]),
|
|
503
503
|
argument: o({
|
|
504
504
|
name: r(),
|
|
505
505
|
value: r()
|
|
506
506
|
}),
|
|
507
507
|
context: o({ arguments: S(r(), r()).optional() }).optional()
|
|
508
|
-
}), un =
|
|
508
|
+
}), un = I.extend({
|
|
509
509
|
method: f("completion/complete"),
|
|
510
510
|
params: ln
|
|
511
|
-
}), dn =
|
|
511
|
+
}), dn = z.extend({ completion: i({
|
|
512
512
|
values: m(r()).max(100),
|
|
513
513
|
total: a(p().int()),
|
|
514
|
-
hasMore: a(
|
|
514
|
+
hasMore: a(O())
|
|
515
515
|
}) }), fn = o({
|
|
516
516
|
uri: r().startsWith("file://"),
|
|
517
517
|
name: r().optional(),
|
|
518
518
|
_meta: S(r(), c()).optional()
|
|
519
|
-
}), pn =
|
|
519
|
+
}), pn = I.extend({
|
|
520
520
|
method: f("roots/list"),
|
|
521
|
-
params:
|
|
522
|
-
}), mn =
|
|
521
|
+
params: F.optional()
|
|
522
|
+
}), mn = z.extend({ roots: m(fn) }), hn = R.extend({
|
|
523
523
|
method: f("notifications/roots/list_changed"),
|
|
524
|
-
params:
|
|
524
|
+
params: L.optional()
|
|
525
525
|
});
|
|
526
526
|
i({
|
|
527
527
|
ttl: p().optional(),
|
|
@@ -542,24 +542,24 @@ var gn = T([
|
|
|
542
542
|
pollInterval: a(p()),
|
|
543
543
|
statusMessage: a(r())
|
|
544
544
|
});
|
|
545
|
-
|
|
546
|
-
var vn =
|
|
547
|
-
|
|
545
|
+
z.extend({ task: _n });
|
|
546
|
+
var vn = L.merge(_n);
|
|
547
|
+
R.extend({
|
|
548
548
|
method: f("notifications/tasks/status"),
|
|
549
549
|
params: vn
|
|
550
|
-
}),
|
|
550
|
+
}), I.extend({
|
|
551
551
|
method: f("tasks/get"),
|
|
552
|
-
params:
|
|
553
|
-
}),
|
|
552
|
+
params: F.extend({ taskId: r() })
|
|
553
|
+
}), z.merge(_n), I.extend({
|
|
554
554
|
method: f("tasks/result"),
|
|
555
|
-
params:
|
|
556
|
-
}),
|
|
555
|
+
params: F.extend({ taskId: r() })
|
|
556
|
+
}), z.loose(), U.extend({ method: f("tasks/list") }), Re.extend({ tasks: m(_n) }), I.extend({
|
|
557
557
|
method: f("tasks/cancel"),
|
|
558
|
-
params:
|
|
559
|
-
}),
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
558
|
+
params: F.extend({ taskId: r() })
|
|
559
|
+
}), z.merge(_n), x([
|
|
560
|
+
Pe,
|
|
561
|
+
Oe,
|
|
562
|
+
Me,
|
|
563
563
|
un,
|
|
564
564
|
It,
|
|
565
565
|
mt,
|
|
@@ -573,23 +573,23 @@ B.extend({
|
|
|
573
573
|
Mt,
|
|
574
574
|
Ot
|
|
575
575
|
]), x([
|
|
576
|
-
|
|
576
|
+
xe,
|
|
577
577
|
Ie,
|
|
578
|
-
|
|
578
|
+
je,
|
|
579
579
|
hn
|
|
580
580
|
]), x([
|
|
581
|
-
|
|
581
|
+
ye,
|
|
582
582
|
qt,
|
|
583
583
|
Jt,
|
|
584
584
|
on,
|
|
585
585
|
mn
|
|
586
586
|
]), x([
|
|
587
|
-
|
|
587
|
+
Pe,
|
|
588
588
|
Kt,
|
|
589
589
|
nn,
|
|
590
590
|
pn
|
|
591
591
|
]), x([
|
|
592
|
-
|
|
592
|
+
xe,
|
|
593
593
|
Ie,
|
|
594
594
|
Rt,
|
|
595
595
|
ct,
|
|
@@ -599,9 +599,9 @@ B.extend({
|
|
|
599
599
|
Y,
|
|
600
600
|
an
|
|
601
601
|
]), x([
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
602
|
+
ye,
|
|
603
|
+
Ae,
|
|
604
|
+
Ne,
|
|
605
605
|
dn,
|
|
606
606
|
Ct,
|
|
607
607
|
ft,
|
|
@@ -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:
|
|
636
|
+
tls_client_certificate_bound_access_tokens: O().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:
|
|
639
|
+
dpop_bound_access_tokens_required: O().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:
|
|
661
|
-
authorization_response_iss_parameter_supported:
|
|
660
|
+
client_id_metadata_document_supported: O().optional(),
|
|
661
|
+
authorization_response_iss_parameter_supported: O().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:
|
|
695
|
-
request_parameter_supported:
|
|
696
|
-
request_uri_parameter_supported:
|
|
697
|
-
require_request_uri_registration:
|
|
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(),
|
|
698
698
|
op_policy_uri: X.optional(),
|
|
699
699
|
op_tos_uri: X.optional(),
|
|
700
|
-
client_id_metadata_document_supported:
|
|
701
|
-
authorization_response_iss_parameter_supported:
|
|
700
|
+
client_id_metadata_document_supported: O().optional(),
|
|
701
|
+
authorization_response_iss_parameter_supported: O().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:
|
|
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({
|
|
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:
|
|
924
|
-
serverResources: o({ listChanged:
|
|
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."),
|
|
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:
|
|
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."),
|
|
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:
|
|
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")
|
|
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:
|
|
955
|
-
permissions:
|
|
954
|
+
csp: k().optional(),
|
|
955
|
+
permissions: k().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"),
|
|
@@ -978,7 +978,7 @@ o({
|
|
|
978
978
|
});
|
|
979
979
|
var Yn = o({
|
|
980
980
|
toolInfo: o({
|
|
981
|
-
id:
|
|
981
|
+
id: pe.optional().describe("JSON-RPC id of the tools/call request."),
|
|
982
982
|
tool: Dt.describe("Tool definition including name, inputSchema, etc.")
|
|
983
983
|
}).optional().describe("Metadata of the tool call that instantiated this App."),
|
|
984
984
|
theme: Tn.optional().describe("Current color theme preference."),
|
|
@@ -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:
|
|
999
|
-
hover:
|
|
998
|
+
touch: O().optional().describe("Whether the device supports touch input."),
|
|
999
|
+
hover: O().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."),
|
|
@@ -1018,13 +1018,13 @@ var Xn = o({
|
|
|
1018
1018
|
}), Zn = o({
|
|
1019
1019
|
method: f("ui/initialize"),
|
|
1020
1020
|
params: o({
|
|
1021
|
-
appInfo:
|
|
1021
|
+
appInfo: Ce.describe("App identification (name and version)."),
|
|
1022
1022
|
appCapabilities: Hn.describe("Features and capabilities this app provides."),
|
|
1023
1023
|
protocolVersion: r().describe("Protocol version this app supports.")
|
|
1024
1024
|
})
|
|
1025
1025
|
}), Qn = o({
|
|
1026
1026
|
protocolVersion: r().describe("Negotiated protocol version string (e.g., \"2025-11-21\")."),
|
|
1027
|
-
hostInfo:
|
|
1027
|
+
hostInfo: Ce.describe("Host application identification and version."),
|
|
1028
1028
|
hostCapabilities: Vn.describe("Features and capabilities provided by the host."),
|
|
1029
1029
|
hostContext: Yn.describe("Rich context about the host environment.")
|
|
1030
1030
|
}).passthrough(), $n = class {
|
|
@@ -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 =
|
|
1040
|
+
let n = ve.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 D {
|
|
|
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:
|
|
1222
|
+
result: ye
|
|
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
|
|
2138
|
+
Z.debug("Creating Client with capabilities:", JSON.stringify(o.capabilities, null, 2)), this.client = new ie(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.
|
|
2201
|
+
}, Hr = "2.0.0-beta.6";
|
|
2202
2202
|
function Ur() {
|
|
2203
2203
|
return Hr;
|
|
2204
2204
|
}
|
|
@@ -2458,6 +2458,10 @@ var Zr = class {
|
|
|
2458
2458
|
async getTokenEndpoint() {
|
|
2459
2459
|
return (await this.discoveryState())?.authorizationServerMetadata?.token_endpoint ?? null;
|
|
2460
2460
|
}
|
|
2461
|
+
async getResource() {
|
|
2462
|
+
let e = (await this.discoveryState())?.resourceMetadata?.resource;
|
|
2463
|
+
return typeof e == "string" ? e : null;
|
|
2464
|
+
}
|
|
2461
2465
|
};
|
|
2462
2466
|
async function $r(e) {
|
|
2463
2467
|
return typeof e == "string" ? e : e instanceof URLSearchParams || e instanceof FormData ? Object.fromEntries(e.entries()) : e instanceof Blob ? await e.text() : e;
|
|
@@ -2617,6 +2621,9 @@ var ei = class {
|
|
|
2617
2621
|
getTokenEndpoint() {
|
|
2618
2622
|
return this.session.getTokenEndpoint();
|
|
2619
2623
|
}
|
|
2624
|
+
getResource() {
|
|
2625
|
+
return this.session.getResource();
|
|
2626
|
+
}
|
|
2620
2627
|
async getClientCredentials() {
|
|
2621
2628
|
let e = await this.clientInformation();
|
|
2622
2629
|
return e?.client_id ? { client_id: e.client_id } : null;
|
|
@@ -2786,52 +2793,8 @@ async function ci(e, t) {
|
|
|
2786
2793
|
await fetch(e, t);
|
|
2787
2794
|
} catch {}
|
|
2788
2795
|
}
|
|
2789
|
-
var li = "https://eu.i.posthog.com", ui = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI"
|
|
2790
|
-
|
|
2791
|
-
"response",
|
|
2792
|
-
"messages"
|
|
2793
|
-
]);
|
|
2794
|
-
function hi(e) {
|
|
2795
|
-
if (e == null) return "";
|
|
2796
|
-
if (typeof e == "string") return e;
|
|
2797
|
-
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
2798
|
-
try {
|
|
2799
|
-
return JSON.stringify(e);
|
|
2800
|
-
} catch {
|
|
2801
|
-
return String(e);
|
|
2802
|
-
}
|
|
2803
|
-
}
|
|
2804
|
-
function gi(e, t = fi) {
|
|
2805
|
-
let n = new URLSearchParams();
|
|
2806
|
-
for (let [t, r] of Object.entries(e)) {
|
|
2807
|
-
let e = hi(r);
|
|
2808
|
-
mi.has(t) && e.length > 120 && (e = `${e.slice(0, 117)}...`), e !== "" && n.set(t, e);
|
|
2809
|
-
}
|
|
2810
|
-
let r = `${t}${t.includes("?") ? "&" : "?"}${n.toString()}`;
|
|
2811
|
-
if (r.length <= pi) return r;
|
|
2812
|
-
let i = [...n.keys()].sort((e, t) => (n.get(t)?.length ?? 0) - (n.get(e)?.length ?? 0));
|
|
2813
|
-
for (let e of i) {
|
|
2814
|
-
if (r.length <= pi) break;
|
|
2815
|
-
e === "event" || e === "user_id" || (n.delete(e), r = `${t}${t.includes("?") ? "&" : "?"}${n.toString()}`);
|
|
2816
|
-
}
|
|
2817
|
-
return r.slice(0, pi);
|
|
2818
|
-
}
|
|
2819
|
-
function _i(e, t) {
|
|
2820
|
-
return ci(t, {
|
|
2821
|
-
method: "POST",
|
|
2822
|
-
headers: { "Content-Type": "application/json" },
|
|
2823
|
-
keepalive: !0,
|
|
2824
|
-
body: JSON.stringify(e)
|
|
2825
|
-
});
|
|
2826
|
-
}
|
|
2827
|
-
function vi(e, t) {
|
|
2828
|
-
try {
|
|
2829
|
-
let n = gi(e, t), r = new Image();
|
|
2830
|
-
r.referrerPolicy = "no-referrer-when-downgrade", r.src = n;
|
|
2831
|
-
} catch {}
|
|
2832
|
-
return Promise.resolve();
|
|
2833
|
-
}
|
|
2834
|
-
function yi(e) {
|
|
2796
|
+
var li = "https://eu.i.posthog.com", ui = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";
|
|
2797
|
+
function di(e) {
|
|
2835
2798
|
let t = e.host ?? li, n = e.apiKey ?? ui;
|
|
2836
2799
|
return ci(`${t}/i/v0/e/`, {
|
|
2837
2800
|
method: "POST",
|
|
@@ -2846,30 +2809,19 @@ function yi(e) {
|
|
|
2846
2809
|
})
|
|
2847
2810
|
});
|
|
2848
2811
|
}
|
|
2849
|
-
function
|
|
2850
|
-
return typeof window < "u" ? vi(e, t === di ? fi : t) : _i(e, t);
|
|
2851
|
-
}
|
|
2852
|
-
function xi() {
|
|
2812
|
+
function fi() {
|
|
2853
2813
|
return globalThis.crypto.randomUUID();
|
|
2854
2814
|
}
|
|
2855
|
-
function
|
|
2815
|
+
function pi() {
|
|
2856
2816
|
let e = new Uint8Array(8);
|
|
2857
2817
|
return globalThis.crypto.getRandomValues(e), Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
2858
2818
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
for (let e = 0; e < a; e++) {
|
|
2862
|
-
let t = r[e] ?? 0, n = i[e] ?? 0;
|
|
2863
|
-
if (t !== n) return t > n;
|
|
2864
|
-
}
|
|
2865
|
-
return !1;
|
|
2866
|
-
}
|
|
2867
|
-
var wi = "mcp_use_user_id", Ti = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI", Ei = "https://eu.i.posthog.com", Di = null;
|
|
2868
|
-
function Oi() {
|
|
2819
|
+
var mi = "mcp_use_user_id", hi = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI", gi = "https://eu.i.posthog.com", _i = null;
|
|
2820
|
+
function vi() {
|
|
2869
2821
|
return typeof localStorage < "u" && typeof localStorage.getItem == "function" && typeof localStorage.setItem == "function" && typeof localStorage.removeItem == "function";
|
|
2870
2822
|
}
|
|
2871
|
-
function
|
|
2872
|
-
if (!
|
|
2823
|
+
function yi() {
|
|
2824
|
+
if (!vi()) return null;
|
|
2873
2825
|
try {
|
|
2874
2826
|
localStorage.setItem("__mcp_use_test__", "1"), localStorage.removeItem("__mcp_use_test__");
|
|
2875
2827
|
} catch {
|
|
@@ -2878,66 +2830,60 @@ function ki() {
|
|
|
2878
2830
|
return {
|
|
2879
2831
|
getUserId() {
|
|
2880
2832
|
try {
|
|
2881
|
-
return localStorage.getItem(
|
|
2833
|
+
return localStorage.getItem(mi);
|
|
2882
2834
|
} catch {
|
|
2883
2835
|
return null;
|
|
2884
2836
|
}
|
|
2885
2837
|
},
|
|
2886
2838
|
setUserId(e) {
|
|
2887
2839
|
try {
|
|
2888
|
-
localStorage.setItem(
|
|
2840
|
+
localStorage.setItem(mi, e);
|
|
2889
2841
|
} catch {}
|
|
2890
|
-
}
|
|
2891
|
-
getDownloadedVersion: () => null,
|
|
2892
|
-
setDownloadedVersion: () => void 0
|
|
2842
|
+
}
|
|
2893
2843
|
};
|
|
2894
2844
|
}
|
|
2895
|
-
function
|
|
2845
|
+
function bi() {
|
|
2896
2846
|
try {
|
|
2897
2847
|
return globalThis.Bun === void 0 ? globalThis.Deno === void 0 ? typeof navigator < "u" && navigator.userAgent?.includes("Cloudflare-Workers") ? "cloudflare-workers" : globalThis.EdgeRuntime === void 0 ? typeof window < "u" && typeof document < "u" ? "browser" : typeof process < "u" && process.versions?.node !== void 0 ? "node" : "unknown" : "edge" : "deno" : "bun";
|
|
2898
2848
|
} catch {
|
|
2899
2849
|
return "unknown";
|
|
2900
2850
|
}
|
|
2901
2851
|
}
|
|
2902
|
-
function
|
|
2852
|
+
function xi() {
|
|
2903
2853
|
if (typeof process < "u" && {}.MCP_USE_TELEMETRY_SOURCE) return {}.MCP_USE_TELEMETRY_SOURCE;
|
|
2904
2854
|
try {
|
|
2905
|
-
if (
|
|
2855
|
+
if (vi()) return localStorage.getItem("MCP_USE_TELEMETRY_SOURCE") ?? void 0;
|
|
2906
2856
|
} catch {}
|
|
2907
2857
|
}
|
|
2908
|
-
function
|
|
2858
|
+
function Si() {
|
|
2909
2859
|
if (typeof window < "u" && window.__MCP_USE_ANONYMIZED_TELEMETRY__ === !1 || typeof process < "u" && {}.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase() === "false") return !0;
|
|
2910
2860
|
try {
|
|
2911
|
-
if (
|
|
2861
|
+
if (vi() && localStorage.getItem("MCP_USE_ANONYMIZED_TELEMETRY") === "false") return !0;
|
|
2912
2862
|
} catch {}
|
|
2913
2863
|
return !1;
|
|
2914
2864
|
}
|
|
2915
|
-
function
|
|
2865
|
+
function Ci() {
|
|
2916
2866
|
try {
|
|
2917
|
-
return `session-${
|
|
2867
|
+
return `session-${fi()}`;
|
|
2918
2868
|
} catch {
|
|
2919
|
-
return `session-${Date.now()}-${
|
|
2869
|
+
return `session-${Date.now()}-${pi()}`;
|
|
2920
2870
|
}
|
|
2921
2871
|
}
|
|
2922
|
-
var
|
|
2872
|
+
var wi = class e {
|
|
2923
2873
|
static instance = null;
|
|
2924
2874
|
UNKNOWN_USER_ID = "UNKNOWN_USER_ID";
|
|
2925
2875
|
_currUserId = null;
|
|
2926
2876
|
_telemetryEnabled = !1;
|
|
2927
2877
|
_pending = /* @__PURE__ */ new Set();
|
|
2928
|
-
_scarfEnabled = !1;
|
|
2929
2878
|
_runtimeEnvironment;
|
|
2930
2879
|
_storageCapability;
|
|
2931
2880
|
_storage;
|
|
2932
|
-
_fsBacked;
|
|
2933
2881
|
_source;
|
|
2934
2882
|
_productVersion;
|
|
2935
2883
|
constructor() {
|
|
2936
|
-
this._runtimeEnvironment =
|
|
2937
|
-
let e =
|
|
2938
|
-
e ? (this._telemetryEnabled = !1, Z.debug("Telemetry disabled via opt-out")) : t ? (Z.debug("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."), this._telemetryEnabled = !0
|
|
2939
|
-
this.trackPackageDownload({ triggered_by: "initialization" }).catch((e) => Z.debug(`Failed to track package download: ${e}`));
|
|
2940
|
-
}, 0)) : (this._telemetryEnabled = !1, Z.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`));
|
|
2884
|
+
this._runtimeEnvironment = bi(), this._storage = _i ?? yi() ?? null, this._storageCapability = this._storage ? "persistent" : "session-only", this._source = xi() || this._runtimeEnvironment;
|
|
2885
|
+
let e = Si(), t = this._runtimeEnvironment !== "unknown";
|
|
2886
|
+
e ? (this._telemetryEnabled = !1, Z.debug("Telemetry disabled via opt-out")) : t ? (Z.debug("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."), this._telemetryEnabled = !0) : (this._telemetryEnabled = !1, Z.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`));
|
|
2941
2887
|
}
|
|
2942
2888
|
get runtimeEnvironment() {
|
|
2943
2889
|
return this._runtimeEnvironment;
|
|
@@ -2951,7 +2897,7 @@ var Pi = class e {
|
|
|
2951
2897
|
setSource(e) {
|
|
2952
2898
|
this._source = e;
|
|
2953
2899
|
try {
|
|
2954
|
-
|
|
2900
|
+
vi() && localStorage.setItem("MCP_USE_TELEMETRY_SOURCE", e);
|
|
2955
2901
|
} catch {}
|
|
2956
2902
|
Z.debug(`Telemetry source set to: ${e}`);
|
|
2957
2903
|
}
|
|
@@ -2962,7 +2908,7 @@ var Pi = class e {
|
|
|
2962
2908
|
this._productVersion = e;
|
|
2963
2909
|
}
|
|
2964
2910
|
get isEnabled() {
|
|
2965
|
-
return this._telemetryEnabled
|
|
2911
|
+
return this._telemetryEnabled;
|
|
2966
2912
|
}
|
|
2967
2913
|
get userId() {
|
|
2968
2914
|
if (this._currUserId) return this._currUserId;
|
|
@@ -2970,56 +2916,31 @@ var Pi = class e {
|
|
|
2970
2916
|
if (this._storage) {
|
|
2971
2917
|
let e = this._storage.getUserId();
|
|
2972
2918
|
if (e) return this._currUserId = e, e;
|
|
2973
|
-
let t =
|
|
2919
|
+
let t = fi();
|
|
2974
2920
|
return this._storage.setUserId(t), this._currUserId = t, t;
|
|
2975
2921
|
}
|
|
2976
|
-
this._currUserId =
|
|
2922
|
+
this._currUserId = Ci();
|
|
2977
2923
|
} catch {
|
|
2978
2924
|
this._currUserId = this.UNKNOWN_USER_ID;
|
|
2979
2925
|
}
|
|
2980
2926
|
return this._currUserId;
|
|
2981
2927
|
}
|
|
2982
2928
|
async capture(e) {
|
|
2983
|
-
if (!this._telemetryEnabled
|
|
2929
|
+
if (!this._telemetryEnabled) return;
|
|
2984
2930
|
let t = this.userId, n = {
|
|
2985
2931
|
...e.properties,
|
|
2986
2932
|
mcp_use_version: this._productVersion ?? Ur(),
|
|
2987
2933
|
language: "typescript",
|
|
2988
2934
|
source: this._source,
|
|
2989
2935
|
runtime: this._runtimeEnvironment
|
|
2990
|
-
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
distinctId: t,
|
|
2997
|
-
properties: n
|
|
2998
|
-
});
|
|
2999
|
-
this._pending.add(r), r.finally(() => this._pending.delete(r));
|
|
3000
|
-
}
|
|
3001
|
-
if (this._scarfEnabled) {
|
|
3002
|
-
let r = bi({
|
|
3003
|
-
...n,
|
|
3004
|
-
user_id: t,
|
|
3005
|
-
event: e.name
|
|
3006
|
-
});
|
|
3007
|
-
this._pending.add(r), r.finally(() => this._pending.delete(r));
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
async trackPackageDownload(e) {
|
|
3011
|
-
if (!this._scarfEnabled || !this._fsBacked || !this._storage) return;
|
|
3012
|
-
let t = Ur(), n = this._storage.getDownloadedVersion(), r = !1, i = !1;
|
|
3013
|
-
n ? Ci(t, n) && (i = !0, this._storage.setDownloadedVersion(t)) : (i = !0, r = !0, this._storage.setDownloadedVersion(t)), i && await bi({
|
|
3014
|
-
...e || {},
|
|
3015
|
-
mcp_use_version: t,
|
|
3016
|
-
user_id: this.userId,
|
|
3017
|
-
event: "package_download",
|
|
3018
|
-
first_download: r,
|
|
3019
|
-
language: "typescript",
|
|
3020
|
-
source: this._source,
|
|
3021
|
-
runtime: this._runtimeEnvironment
|
|
2936
|
+
}, r = di({
|
|
2937
|
+
host: gi,
|
|
2938
|
+
apiKey: hi,
|
|
2939
|
+
event: e.name,
|
|
2940
|
+
distinctId: t,
|
|
2941
|
+
properties: n
|
|
3022
2942
|
});
|
|
2943
|
+
this._pending.add(r), r.finally(() => this._pending.delete(r));
|
|
3023
2944
|
}
|
|
3024
2945
|
async trackAgentExecution(e) {
|
|
3025
2946
|
this.isEnabled && await this.capture(new ri(e));
|
|
@@ -3076,9 +2997,9 @@ var Pi = class e {
|
|
|
3076
2997
|
});
|
|
3077
2998
|
}
|
|
3078
2999
|
identify(e, t) {
|
|
3079
|
-
this._currUserId = e, this._storage?.setUserId(e), this._telemetryEnabled &&
|
|
3080
|
-
host:
|
|
3081
|
-
apiKey:
|
|
3000
|
+
this._currUserId = e, this._storage?.setUserId(e), this._telemetryEnabled && di({
|
|
3001
|
+
host: gi,
|
|
3002
|
+
apiKey: hi,
|
|
3082
3003
|
event: "$identify",
|
|
3083
3004
|
distinctId: e,
|
|
3084
3005
|
properties: { $set: t ?? {} }
|
|
@@ -3097,21 +3018,21 @@ var Pi = class e {
|
|
|
3097
3018
|
Z.debug(`Error flushing telemetry captures: ${e}`);
|
|
3098
3019
|
}
|
|
3099
3020
|
}
|
|
3100
|
-
},
|
|
3101
|
-
function
|
|
3021
|
+
}, Ti = 5 * 6e4;
|
|
3022
|
+
function Ei(e, t = 0) {
|
|
3102
3023
|
if (!e || t > 5) return !1;
|
|
3103
3024
|
if (e instanceof E) return !0;
|
|
3104
3025
|
if (e instanceof Error) {
|
|
3105
3026
|
if (e.code === 401 || e.name === "UnauthorizedError") return !0;
|
|
3106
3027
|
let n = e.message ?? "";
|
|
3107
|
-
if (n.includes("401") || n.includes("Unauthorized") || e.cause &&
|
|
3028
|
+
if (n.includes("401") || n.includes("Unauthorized") || e.cause && Ei(e.cause, t + 1)) return !0;
|
|
3108
3029
|
let r = e.data;
|
|
3109
|
-
if (r?.cause &&
|
|
3030
|
+
if (r?.cause && Ei(r.cause, t + 1)) return !0;
|
|
3110
3031
|
}
|
|
3111
3032
|
return !1;
|
|
3112
3033
|
}
|
|
3113
|
-
async function
|
|
3114
|
-
let r = e, i = n.timeoutMs ??
|
|
3034
|
+
async function Di(e, t, n = {}) {
|
|
3035
|
+
let r = e, i = n.timeoutMs ?? Ti, a = n.fetchFn ?? r.getProxyFetch?.() ?? void 0;
|
|
3115
3036
|
if (!r.hasPendingFlow) {
|
|
3116
3037
|
let n = await b(e, {
|
|
3117
3038
|
serverUrl: t,
|
|
@@ -3128,9 +3049,9 @@ async function Li(e, t, n = {}) {
|
|
|
3128
3049
|
});
|
|
3129
3050
|
return;
|
|
3130
3051
|
}
|
|
3131
|
-
await
|
|
3052
|
+
await Oi(r, i);
|
|
3132
3053
|
}
|
|
3133
|
-
async function
|
|
3054
|
+
async function Oi(e, t) {
|
|
3134
3055
|
if (typeof window > "u") throw Error("OAuth redirect requires a browser environment or a provider with getAuthorizationCode()");
|
|
3135
3056
|
if (e.useRedirectFlow) return;
|
|
3136
3057
|
let n = e.getKey?.("tokens");
|
|
@@ -3154,7 +3075,7 @@ async function Ri(e, t) {
|
|
|
3154
3075
|
}
|
|
3155
3076
|
}
|
|
3156
3077
|
mr();
|
|
3157
|
-
var
|
|
3078
|
+
var ki = class {
|
|
3158
3079
|
connector;
|
|
3159
3080
|
autoConnect;
|
|
3160
3081
|
constructor(e, t = !0) {
|
|
@@ -3248,17 +3169,17 @@ var zi = class {
|
|
|
3248
3169
|
async request(e, t = null, n) {
|
|
3249
3170
|
return this.connector.request(e, t, n);
|
|
3250
3171
|
}
|
|
3251
|
-
},
|
|
3252
|
-
function
|
|
3253
|
-
|
|
3172
|
+
}, Ai;
|
|
3173
|
+
function ji(e, t) {
|
|
3174
|
+
Ai?.addServer(e, t);
|
|
3254
3175
|
}
|
|
3255
|
-
function
|
|
3256
|
-
|
|
3176
|
+
function Mi(e) {
|
|
3177
|
+
Ai?.removeServer(e);
|
|
3257
3178
|
}
|
|
3258
|
-
function
|
|
3179
|
+
function Ni(e) {
|
|
3259
3180
|
return !!e && typeof e == "object" && "redirectUrl" in e && "clientMetadata" in e;
|
|
3260
3181
|
}
|
|
3261
|
-
var
|
|
3182
|
+
var Pi = class {
|
|
3262
3183
|
config = {};
|
|
3263
3184
|
sessions = {};
|
|
3264
3185
|
activeSessions = [];
|
|
@@ -3269,10 +3190,10 @@ var Wi = class {
|
|
|
3269
3190
|
throw Error("fromDict must be implemented by concrete class");
|
|
3270
3191
|
}
|
|
3271
3192
|
addServer(e, t) {
|
|
3272
|
-
this.config.mcpServers = this.config.mcpServers || {}, this.config.mcpServers[e] = t,
|
|
3193
|
+
this.config.mcpServers = this.config.mcpServers || {}, this.config.mcpServers[e] = t, ji(e, t);
|
|
3273
3194
|
}
|
|
3274
3195
|
async removeServer(e) {
|
|
3275
|
-
this.config.mcpServers?.[e] && (await this.closeSession(e), delete this.config.mcpServers[e],
|
|
3196
|
+
this.config.mcpServers?.[e] && (await this.closeSession(e), delete this.config.mcpServers[e], Mi(e));
|
|
3276
3197
|
}
|
|
3277
3198
|
getServerNames() {
|
|
3278
3199
|
return Object.keys(this.config.mcpServers ?? {});
|
|
@@ -3293,17 +3214,17 @@ var Wi = class {
|
|
|
3293
3214
|
...r,
|
|
3294
3215
|
authProvider: i
|
|
3295
3216
|
};
|
|
3296
|
-
} else "authProvider" in r && r.authProvider &&
|
|
3217
|
+
} else "authProvider" in r && r.authProvider && Ni(r.authProvider) && (i = r.authProvider);
|
|
3297
3218
|
let a = async () => {
|
|
3298
|
-
let e = new
|
|
3219
|
+
let e = new ki(await Promise.resolve(this.createConnectorFromConfig(r)));
|
|
3299
3220
|
return t && await e.initialize(), e;
|
|
3300
3221
|
}, o;
|
|
3301
3222
|
try {
|
|
3302
3223
|
o = await a();
|
|
3303
3224
|
} catch (n) {
|
|
3304
3225
|
let s = r;
|
|
3305
|
-
if (!t || !i || !("url" in s) || !
|
|
3306
|
-
Z.info(`[MCPClient] Unauthorized connecting to '${e}'; completing OAuth\u2026`), await
|
|
3226
|
+
if (!t || !i || !("url" in s) || !Ei(n) || i.preventAutoAuth) throw n;
|
|
3227
|
+
Z.info(`[MCPClient] Unauthorized connecting to '${e}'; completing OAuth\u2026`), await Di(i, s.url), o = await a();
|
|
3307
3228
|
}
|
|
3308
3229
|
return this.sessions[e] = o, this.activeSessions.includes(e) || this.activeSessions.push(e), o;
|
|
3309
3230
|
}
|
|
@@ -3358,9 +3279,9 @@ var Wi = class {
|
|
|
3358
3279
|
await this.closeAllSessions();
|
|
3359
3280
|
}
|
|
3360
3281
|
};
|
|
3361
|
-
function
|
|
3282
|
+
function Fi(e) {
|
|
3362
3283
|
let t = Object.keys(e.mcpServers ?? {});
|
|
3363
|
-
|
|
3284
|
+
wi.getInstance().trackMCPClientInit({
|
|
3364
3285
|
codeMode: !1,
|
|
3365
3286
|
sandbox: !1,
|
|
3366
3287
|
allCallbacks: !1,
|
|
@@ -3370,12 +3291,12 @@ function Gi(e) {
|
|
|
3370
3291
|
isBrowser: !0
|
|
3371
3292
|
}).catch((e) => Z.debug(`Failed to track BrowserMCPClient init: ${e}`));
|
|
3372
3293
|
}
|
|
3373
|
-
var
|
|
3294
|
+
var Ii = class e extends Pi {
|
|
3374
3295
|
static getPackageVersion() {
|
|
3375
3296
|
return Ur();
|
|
3376
3297
|
}
|
|
3377
3298
|
constructor(e) {
|
|
3378
|
-
super(e),
|
|
3299
|
+
super(e), Fi(this.config);
|
|
3379
3300
|
}
|
|
3380
3301
|
static fromDict(t) {
|
|
3381
3302
|
return new e(t);
|
|
@@ -3407,8 +3328,8 @@ var Ki = class e extends Wi {
|
|
|
3407
3328
|
}
|
|
3408
3329
|
};
|
|
3409
3330
|
mr();
|
|
3410
|
-
var
|
|
3411
|
-
function
|
|
3331
|
+
var Li = "https://favicon.tools.mcp-use.com", Ri = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
3332
|
+
function zi(e) {
|
|
3412
3333
|
try {
|
|
3413
3334
|
let t = e.includes("://") ? e : `https://${e}`;
|
|
3414
3335
|
return new URL(t).hostname;
|
|
@@ -3416,10 +3337,10 @@ function Yi(e) {
|
|
|
3416
3337
|
return null;
|
|
3417
3338
|
}
|
|
3418
3339
|
}
|
|
3419
|
-
function
|
|
3340
|
+
function Bi(e) {
|
|
3420
3341
|
let t = e.toLowerCase();
|
|
3421
3342
|
if (t === "localhost" || t.endsWith(".localhost") || t === "host.docker.internal" || t === "0.0.0.0") return !0;
|
|
3422
|
-
if (!
|
|
3343
|
+
if (!Ri.test(t)) return !1;
|
|
3423
3344
|
if (t === "127.0.0.1" || t.startsWith("127.") || t.startsWith("10.") || t.startsWith("192.168.")) return !0;
|
|
3424
3345
|
let n = /^172\.(\d+)\./.exec(t);
|
|
3425
3346
|
if (n) {
|
|
@@ -3428,28 +3349,28 @@ function Xi(e) {
|
|
|
3428
3349
|
}
|
|
3429
3350
|
return !1;
|
|
3430
3351
|
}
|
|
3431
|
-
function
|
|
3352
|
+
function Vi(e) {
|
|
3432
3353
|
let t = e.split(".");
|
|
3433
3354
|
return Array.from({ length: t.length - 1 }, (e, n) => t.slice(n).join("."));
|
|
3434
3355
|
}
|
|
3435
|
-
function
|
|
3356
|
+
function Hi(e) {
|
|
3436
3357
|
return new Promise((t, n) => {
|
|
3437
3358
|
let r = new FileReader();
|
|
3438
3359
|
r.onloadend = () => t(r.result), r.onerror = n, r.readAsDataURL(e);
|
|
3439
3360
|
});
|
|
3440
3361
|
}
|
|
3441
|
-
async function
|
|
3362
|
+
async function Ui(e) {
|
|
3442
3363
|
try {
|
|
3443
|
-
let t =
|
|
3444
|
-
if (!t ||
|
|
3445
|
-
for (let e of
|
|
3446
|
-
let t = await fetch(`${
|
|
3364
|
+
let t = zi(e);
|
|
3365
|
+
if (!t || Bi(t)) return null;
|
|
3366
|
+
for (let e of Vi(t)) try {
|
|
3367
|
+
let t = await fetch(`${Li}/${e}?response=json`, { signal: AbortSignal.timeout(2e3) });
|
|
3447
3368
|
if (!t.ok) continue;
|
|
3448
3369
|
let n = await t.json();
|
|
3449
3370
|
if (n.source === "default") continue;
|
|
3450
3371
|
let r = n.url.replace(/^http:\/\//, "https://"), i = await fetch(r, { signal: AbortSignal.timeout(2e3) });
|
|
3451
3372
|
if (!i.ok) continue;
|
|
3452
|
-
return await
|
|
3373
|
+
return await Hi(await i.blob());
|
|
3453
3374
|
} catch {
|
|
3454
3375
|
continue;
|
|
3455
3376
|
}
|
|
@@ -3458,11 +3379,11 @@ async function $i(e) {
|
|
|
3458
3379
|
return console.warn("[favicon] Error detecting favicon:", e), null;
|
|
3459
3380
|
}
|
|
3460
3381
|
}
|
|
3461
|
-
var
|
|
3462
|
-
function
|
|
3382
|
+
var Wi = "inspector-server";
|
|
3383
|
+
function Gi(e, t) {
|
|
3463
3384
|
if (!e) throw Error(t);
|
|
3464
3385
|
}
|
|
3465
|
-
async function
|
|
3386
|
+
async function Ki(e) {
|
|
3466
3387
|
try {
|
|
3467
3388
|
let t = e.serverInfo.icons?.[0]?.src;
|
|
3468
3389
|
if (t) {
|
|
@@ -3477,7 +3398,7 @@ async function na(e) {
|
|
|
3477
3398
|
} : void 0), e.addLog("debug", "Server icon converted to base64")), r;
|
|
3478
3399
|
}
|
|
3479
3400
|
if (e.url) {
|
|
3480
|
-
let t = await
|
|
3401
|
+
let t = await Ui(e.url);
|
|
3481
3402
|
if (!e.isMounted()) return e.addLog("debug", "Connection aborted after favicon detection - component unmounted"), null;
|
|
3482
3403
|
if (t) return e.setServerInfo((e) => e ? {
|
|
3483
3404
|
...e,
|
|
@@ -3489,10 +3410,10 @@ async function na(e) {
|
|
|
3489
3410
|
return e.addLog("debug", "Icon loading failed (non-critical):", t), null;
|
|
3490
3411
|
}
|
|
3491
3412
|
}
|
|
3492
|
-
function
|
|
3413
|
+
function qi(e, t) {
|
|
3493
3414
|
return t ? `state=${e}` : `client disconnected (state=${e})`;
|
|
3494
3415
|
}
|
|
3495
|
-
function
|
|
3416
|
+
function Ji(e) {
|
|
3496
3417
|
return {
|
|
3497
3418
|
name: e.name,
|
|
3498
3419
|
version: e.version,
|
|
@@ -3500,11 +3421,11 @@ function ia(e) {
|
|
|
3500
3421
|
logo_uri: e.icons?.[0]?.src
|
|
3501
3422
|
};
|
|
3502
3423
|
}
|
|
3503
|
-
function
|
|
3424
|
+
function Yi(e) {
|
|
3504
3425
|
let t = (e instanceof Error ? e.message : String(e)).toLowerCase();
|
|
3505
3426
|
return t.includes("oauth discovery failed") || t.includes("oauth-authorization-server") || t.includes("not valid json") || t.includes("404") && (t.includes("openid-configuration") || t.includes("oauth-protected-resources") || t.includes("oauth-authorization-url") || t.includes("register")) || t.includes("invalid oauth error response") && t.includes("not found");
|
|
3506
3427
|
}
|
|
3507
|
-
function
|
|
3428
|
+
function Xi(e, t) {
|
|
3508
3429
|
if (t) return t;
|
|
3509
3430
|
if (e) try {
|
|
3510
3431
|
let t = new URL(e);
|
|
@@ -3513,8 +3434,8 @@ function oa(e, t) {
|
|
|
3513
3434
|
return;
|
|
3514
3435
|
}
|
|
3515
3436
|
}
|
|
3516
|
-
function
|
|
3517
|
-
let t =
|
|
3437
|
+
function Zi(e) {
|
|
3438
|
+
let t = Xi(e.gatewayUrl, e.oauthProxyUrl);
|
|
3518
3439
|
return {
|
|
3519
3440
|
provider: new ei(e.effectiveOAuthUrl, {
|
|
3520
3441
|
storageKeyPrefix: e.storageKeyPrefix,
|
|
@@ -3535,7 +3456,7 @@ function sa(e) {
|
|
|
3535
3456
|
oauthProxyUrl: t
|
|
3536
3457
|
};
|
|
3537
3458
|
}
|
|
3538
|
-
function
|
|
3459
|
+
function Qi(e) {
|
|
3539
3460
|
let t = null, n = Date.now(), r = !1, i = e.healthCheckIntervalMs ?? 1e4, a = e.healthCheckTimeoutMs ?? 3e4;
|
|
3540
3461
|
return t = setInterval(async () => {
|
|
3541
3462
|
if (!r) {
|
|
@@ -3571,79 +3492,79 @@ function ca(e) {
|
|
|
3571
3492
|
t &&= (clearInterval(t), null);
|
|
3572
3493
|
};
|
|
3573
3494
|
}
|
|
3574
|
-
function
|
|
3495
|
+
function $i(e, t) {
|
|
3575
3496
|
let n = e.connectionRef.current;
|
|
3576
|
-
if (e.stateRef.current !== "ready" || !e.hasClient() || !n) throw Error(`MCP client is not ready (${
|
|
3497
|
+
if (e.stateRef.current !== "ready" || !e.hasClient() || !n) throw Error(`MCP client is not ready (${qi(e.stateRef.current, e.hasClient())}). Cannot ${t}.`);
|
|
3577
3498
|
return n;
|
|
3578
3499
|
}
|
|
3579
|
-
function
|
|
3580
|
-
let t = (0,
|
|
3581
|
-
let i =
|
|
3500
|
+
function ea(e) {
|
|
3501
|
+
let t = (0, j.useCallback)(async (t, n, r) => {
|
|
3502
|
+
let i = $i(e, `call tool "${t}"`);
|
|
3582
3503
|
e.addLog("info", `Calling tool: ${t}`, n);
|
|
3583
3504
|
let a = Date.now();
|
|
3584
3505
|
try {
|
|
3585
3506
|
let o = await i.callTool(t, n || {}, r);
|
|
3586
|
-
return e.addLog("info", `Tool "${t}" call successful:`, o),
|
|
3507
|
+
return e.addLog("info", `Tool "${t}" call successful:`, o), wi.getInstance().trackUseMcpToolCall({
|
|
3587
3508
|
toolName: t,
|
|
3588
3509
|
success: !0,
|
|
3589
3510
|
executionTimeMs: Date.now() - a
|
|
3590
3511
|
}).catch(() => {}), o;
|
|
3591
3512
|
} catch (n) {
|
|
3592
|
-
throw e.addLog("error", `Tool "${t}" call failed:`, n),
|
|
3513
|
+
throw e.addLog("error", `Tool "${t}" call failed:`, n), wi.getInstance().trackUseMcpToolCall({
|
|
3593
3514
|
toolName: t,
|
|
3594
3515
|
success: !1,
|
|
3595
3516
|
errorType: n instanceof Error ? n.name : "UnknownError",
|
|
3596
3517
|
executionTimeMs: Date.now() - a
|
|
3597
3518
|
}).catch(() => {}), n;
|
|
3598
3519
|
}
|
|
3599
|
-
}, [e.addLog]), n = (0,
|
|
3600
|
-
let t =
|
|
3520
|
+
}, [e.addLog]), n = (0, j.useCallback)(async () => {
|
|
3521
|
+
let t = $i(e, "list resources");
|
|
3601
3522
|
e.addLog("info", "Listing resources");
|
|
3602
3523
|
let n = await t.listAllResources();
|
|
3603
3524
|
e.setResources(n.resources || []);
|
|
3604
|
-
}, [e.addLog]), r = (0,
|
|
3605
|
-
let n =
|
|
3525
|
+
}, [e.addLog]), r = (0, j.useCallback)(async (t) => {
|
|
3526
|
+
let n = $i(e, "read resource");
|
|
3606
3527
|
e.addLog("info", `Reading resource: ${t}`);
|
|
3607
3528
|
try {
|
|
3608
3529
|
let e = await n.readResource(t);
|
|
3609
|
-
return
|
|
3530
|
+
return wi.getInstance().trackUseMcpResourceRead({
|
|
3610
3531
|
resourceUri: t,
|
|
3611
3532
|
success: !0
|
|
3612
3533
|
}).catch(() => {}), e;
|
|
3613
3534
|
} catch (e) {
|
|
3614
|
-
throw
|
|
3535
|
+
throw wi.getInstance().trackUseMcpResourceRead({
|
|
3615
3536
|
resourceUri: t,
|
|
3616
3537
|
success: !1,
|
|
3617
3538
|
errorType: e instanceof Error ? e.name : "UnknownError"
|
|
3618
3539
|
}).catch(() => {}), e;
|
|
3619
3540
|
}
|
|
3620
|
-
}, [e.addLog]), i = (0,
|
|
3621
|
-
let t =
|
|
3541
|
+
}, [e.addLog]), i = (0, j.useCallback)(async () => {
|
|
3542
|
+
let t = $i(e, "list prompts");
|
|
3622
3543
|
e.addLog("info", "Listing prompts");
|
|
3623
3544
|
let n = await t.listPrompts();
|
|
3624
3545
|
e.setPrompts(n.prompts || []);
|
|
3625
|
-
}, [e.addLog]), a = (0,
|
|
3546
|
+
}, [e.addLog]), a = (0, j.useCallback)(async () => {
|
|
3626
3547
|
if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
|
|
3627
3548
|
e.setTools(await e.connectionRef.current.listTools() || []);
|
|
3628
3549
|
} catch (t) {
|
|
3629
3550
|
e.addLog("error", "Failed to refresh tools:", t);
|
|
3630
3551
|
}
|
|
3631
|
-
}, [e.addLog]), o = (0,
|
|
3552
|
+
}, [e.addLog]), o = (0, j.useCallback)(async () => {
|
|
3632
3553
|
if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
|
|
3633
3554
|
let t = await e.connectionRef.current.listAllResources();
|
|
3634
3555
|
e.setResources(t.resources || []);
|
|
3635
3556
|
} catch (t) {
|
|
3636
3557
|
e.addLog("warn", "Failed to refresh resources:", t);
|
|
3637
3558
|
}
|
|
3638
|
-
}, [e.addLog]), s = (0,
|
|
3559
|
+
}, [e.addLog]), s = (0, j.useCallback)(async () => {
|
|
3639
3560
|
if (!(e.stateRef.current !== "ready" || !e.connectionRef.current)) try {
|
|
3640
3561
|
let t = await e.connectionRef.current.listPrompts();
|
|
3641
3562
|
e.setPrompts(t.prompts || []);
|
|
3642
3563
|
} catch (t) {
|
|
3643
3564
|
e.addLog("warn", "Failed to refresh prompts:", t);
|
|
3644
3565
|
}
|
|
3645
|
-
}, [e.addLog]), c = (0,
|
|
3646
|
-
let t = await
|
|
3566
|
+
}, [e.addLog]), c = (0, j.useCallback)(async () => {
|
|
3567
|
+
let t = await $i(e, "refresh resource templates").listResourceTemplates();
|
|
3647
3568
|
e.isMounted() && e.setResourceTemplates(t.resourceTemplates || []);
|
|
3648
3569
|
}, [e.addLog]);
|
|
3649
3570
|
return {
|
|
@@ -3655,7 +3576,7 @@ function ua(e) {
|
|
|
3655
3576
|
refreshResources: o,
|
|
3656
3577
|
refreshPrompts: s,
|
|
3657
3578
|
refreshResourceTemplates: c,
|
|
3658
|
-
refreshAll: (0,
|
|
3579
|
+
refreshAll: (0, j.useCallback)(() => Promise.all([
|
|
3659
3580
|
a(),
|
|
3660
3581
|
o(),
|
|
3661
3582
|
c(),
|
|
@@ -3666,26 +3587,26 @@ function ua(e) {
|
|
|
3666
3587
|
c,
|
|
3667
3588
|
s
|
|
3668
3589
|
]),
|
|
3669
|
-
getPrompt: (0,
|
|
3670
|
-
complete: (0,
|
|
3590
|
+
getPrompt: (0, j.useCallback)(async (t, n) => $i(e, "get prompt").getPrompt(t, n || {}), [e.addLog]),
|
|
3591
|
+
complete: (0, j.useCallback)(async (t) => $i(e, "request completion").complete(t), [e.addLog])
|
|
3671
3592
|
};
|
|
3672
3593
|
}
|
|
3673
|
-
var
|
|
3674
|
-
function
|
|
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, D = w?.scope?.trim() || void 0,
|
|
3594
|
+
var ta = 3e3, na = 5e3;
|
|
3595
|
+
function ra(e) {
|
|
3596
|
+
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, D = w?.scope?.trim() || void 0, ie = (0, j.useMemo)(() => T ? { client_id: T } : void 0, [T]), O = (0, j.useMemo)(() => {
|
|
3676
3597
|
let e = `useMcp:${t || "no-url"}`, n = pr.get(e);
|
|
3677
3598
|
return u && (n.level = u), n;
|
|
3678
|
-
}, [t, u]),
|
|
3599
|
+
}, [t, u]), k = o ?? {}, ae = (0, j.useMemo)(() => Jr(y), [y]), A = C, oe = ne, se = (0, j.useMemo)(() => ({
|
|
3679
3600
|
name: "mcp-use",
|
|
3680
3601
|
title: "mcp-use",
|
|
3681
3602
|
version: Ur(),
|
|
3682
3603
|
description: "mcp-use is a complete TypeScript framework for building and using MCP",
|
|
3683
3604
|
icons: [{ src: "https://mcp-use.com/logo.png" }],
|
|
3684
3605
|
websiteUrl: "https://mcp-use.com"
|
|
3685
|
-
}), []),
|
|
3686
|
-
...
|
|
3606
|
+
}), []), M = (0, j.useMemo)(() => e.clientInfo ? {
|
|
3607
|
+
...se,
|
|
3687
3608
|
...e.clientInfo
|
|
3688
|
-
} :
|
|
3609
|
+
} : se, [e.clientInfo, se]), N = (0, j.useMemo)(() => Ji(M), [M]), ce = (0, j.useMemo)(() => {
|
|
3689
3610
|
if (!l) return {
|
|
3690
3611
|
enabled: !1,
|
|
3691
3612
|
proxyAddress: void 0
|
|
@@ -3702,14 +3623,14 @@ function pa(e) {
|
|
|
3702
3623
|
enabled: l.enabled !== !1 && !!e,
|
|
3703
3624
|
proxyAddress: e
|
|
3704
3625
|
};
|
|
3705
|
-
}, [l, s]),
|
|
3626
|
+
}, [l, s]), P = (0, j.useMemo)(() => f === !1 ? {
|
|
3706
3627
|
enabled: !1,
|
|
3707
3628
|
initialDelay: 0,
|
|
3708
3629
|
healthCheckInterval: !1,
|
|
3709
3630
|
healthCheckTimeout: 3e4
|
|
3710
3631
|
} : f === !0 ? {
|
|
3711
3632
|
enabled: !0,
|
|
3712
|
-
initialDelay:
|
|
3633
|
+
initialDelay: ta,
|
|
3713
3634
|
healthCheckInterval: 1e4,
|
|
3714
3635
|
healthCheckTimeout: 3e4
|
|
3715
3636
|
} : typeof f == "number" ? {
|
|
@@ -3719,91 +3640,91 @@ function pa(e) {
|
|
|
3719
3640
|
healthCheckTimeout: 3e4
|
|
3720
3641
|
} : {
|
|
3721
3642
|
enabled: f.enabled !== !1,
|
|
3722
|
-
initialDelay: f.initialDelay ??
|
|
3643
|
+
initialDelay: f.initialDelay ?? ta,
|
|
3723
3644
|
healthCheckInterval: f.healthCheckInterval ?? 1e4,
|
|
3724
3645
|
healthCheckTimeout: f.healthCheckTimeout ?? 3e4
|
|
3725
|
-
}, [f]), [
|
|
3726
|
-
(0,
|
|
3727
|
-
|
|
3646
|
+
}, [f]), [le, ue] = (0, j.useState)(void 0);
|
|
3647
|
+
(0, j.useEffect)(() => {
|
|
3648
|
+
ue(void 0);
|
|
3728
3649
|
}, [t, s]);
|
|
3729
|
-
let
|
|
3730
|
-
if (!
|
|
3650
|
+
let de = (0, j.useMemo)(() => {
|
|
3651
|
+
if (!le?.proxyAddress) return s;
|
|
3731
3652
|
let e = s?.headers ?? {};
|
|
3732
3653
|
return {
|
|
3733
|
-
...
|
|
3654
|
+
...le,
|
|
3734
3655
|
headers: {
|
|
3735
3656
|
...e,
|
|
3736
|
-
...
|
|
3657
|
+
...le.headers ?? {}
|
|
3737
3658
|
}
|
|
3738
3659
|
};
|
|
3739
|
-
}, [
|
|
3740
|
-
...
|
|
3741
|
-
...
|
|
3742
|
-
}), [
|
|
3743
|
-
|
|
3744
|
-
let et = (0,
|
|
3660
|
+
}, [le, s]), F = de?.proxyAddress, fe = de?.headers ?? {}, I = (0, j.useMemo)(() => t || "", [t]), L = (0, j.useMemo)(() => ({
|
|
3661
|
+
...fe,
|
|
3662
|
+
...k
|
|
3663
|
+
}), [fe, k]), [R, z] = (0, j.useState)("discovering"), [pe, me] = (0, j.useState)([]), [he, ge] = (0, j.useState)([]), [_e, ve] = (0, j.useState)([]), [ye, be] = (0, j.useState)([]), [xe, B] = (0, j.useState)(e._initialServerInfo?.name ? e._initialServerInfo : void 0), [Se, Ce] = (0, j.useState)(), [we, Te] = (0, j.useState)(void 0), [Ee, De] = (0, j.useState)(void 0), [V, 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)(R), 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);
|
|
3664
|
+
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;
|
|
3665
|
+
let et = (0, j.useCallback)(async (e) => Ye.current(e), []), tt = (0, j.useCallback)(async (e) => Xe.current(e), []), nt = (0, j.useCallback)((e) => {
|
|
3745
3666
|
$e.current?.(e);
|
|
3746
3667
|
}, []);
|
|
3747
|
-
(0,
|
|
3748
|
-
q.current =
|
|
3749
|
-
}, [
|
|
3668
|
+
(0, j.useEffect)(() => {
|
|
3669
|
+
q.current = R, Ge.current = f;
|
|
3670
|
+
}, [R, f]), (0, j.useEffect)(() => {
|
|
3750
3671
|
W.current = a ?? null;
|
|
3751
3672
|
}, [a]);
|
|
3752
|
-
let J = (0,
|
|
3673
|
+
let J = (0, j.useCallback)((e, t, ...n) => {
|
|
3753
3674
|
let r = n.length > 0 ? `${t} ${n.map((e) => JSON.stringify(e)).join(" ")}` : t, i = `[useMcp] ${r}`;
|
|
3754
3675
|
switch (e) {
|
|
3755
3676
|
case "error":
|
|
3756
|
-
|
|
3677
|
+
O.error(i);
|
|
3757
3678
|
break;
|
|
3758
3679
|
case "warn":
|
|
3759
|
-
|
|
3680
|
+
O.warn(i);
|
|
3760
3681
|
break;
|
|
3761
3682
|
case "info":
|
|
3762
|
-
|
|
3683
|
+
O.info(i);
|
|
3763
3684
|
break;
|
|
3764
3685
|
case "debug":
|
|
3765
|
-
|
|
3686
|
+
O.debug(i);
|
|
3766
3687
|
break;
|
|
3767
|
-
default:
|
|
3688
|
+
default: O.info(i);
|
|
3768
3689
|
}
|
|
3769
|
-
K.current &&
|
|
3690
|
+
K.current && Pe((t) => [...t.slice(-100), {
|
|
3770
3691
|
level: e,
|
|
3771
3692
|
message: r,
|
|
3772
3693
|
timestamp: Date.now()
|
|
3773
3694
|
}]);
|
|
3774
|
-
}, [
|
|
3695
|
+
}, [O]), rt = ea({
|
|
3775
3696
|
stateRef: q,
|
|
3776
3697
|
connectionRef: Re,
|
|
3777
3698
|
hasClient: () => U.current !== null,
|
|
3778
3699
|
isMounted: () => K.current,
|
|
3779
|
-
setTools:
|
|
3780
|
-
setResources:
|
|
3781
|
-
setResourceTemplates:
|
|
3782
|
-
setPrompts:
|
|
3700
|
+
setTools: me,
|
|
3701
|
+
setResources: ge,
|
|
3702
|
+
setResourceTemplates: ve,
|
|
3703
|
+
setPrompts: be,
|
|
3783
3704
|
addLog: J
|
|
3784
|
-
}), it = (0,
|
|
3705
|
+
}), it = (0, j.useCallback)(async (e = !1) => {
|
|
3785
3706
|
e || J("info", "Disconnecting..."), G.current = !1, He.current && clearTimeout(He.current), He.current = null;
|
|
3786
3707
|
let t = Ve.current, n = U.current;
|
|
3787
3708
|
if (n) try {
|
|
3788
|
-
let e =
|
|
3709
|
+
let e = Wi, t = n === U.current ? Re.current : null;
|
|
3789
3710
|
t && t._healthCheckCleanup && (t._healthCheckCleanup(), t._healthCheckCleanup = null), t && await n.closeSession(e);
|
|
3790
3711
|
} catch (t) {
|
|
3791
3712
|
e || J("warn", "Error closing connection:", t);
|
|
3792
3713
|
}
|
|
3793
3714
|
let r = Ve.current !== t;
|
|
3794
|
-
U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (
|
|
3795
|
-
}, [J]), Y = (0,
|
|
3715
|
+
U.current === n && !r && (U.current = null, Re.current = null), K.current && !e && !r && (z("discovering"), me([]), ge([]), ve([]), be([]), Me(void 0), H(void 0), Le(void 0), B(void 0), Ce(void 0), Te(void 0), De(void 0), Oe(void 0), Ae({}));
|
|
3716
|
+
}, [J]), Y = (0, j.useCallback)((e, n) => {
|
|
3796
3717
|
J("error", e, n ?? "");
|
|
3797
|
-
let r = n && "code" in n ? n.code : void 0, i =
|
|
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"),
|
|
3718
|
+
let r = n && "code" in n ? n.code : void 0, i = ce.enabled && !de?.proxyAddress, o = e.includes("CORS") || e.includes("blocked by CORS policy") || e.includes("Failed to fetch"), s = r === 400;
|
|
3719
|
+
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"), ue({ proxyAddress: ce.proxyAddress }), K.current && z("discovering"), setTimeout(() => {
|
|
3799
3720
|
K.current && qe.current?.();
|
|
3800
3721
|
}, 1e3), !0;
|
|
3801
3722
|
if (K.current) {
|
|
3802
|
-
J("info", "Setting state to FAILED:", e),
|
|
3723
|
+
J("info", "Setting state to FAILED:", e), z("failed"), Me(e);
|
|
3803
3724
|
let t = W.current?.getLastAttemptedAuthUrl?.();
|
|
3804
|
-
t && (
|
|
3725
|
+
t && (H(t), J("info", "Manual authentication URL may be available.", t));
|
|
3805
3726
|
}
|
|
3806
|
-
return G.current = !1, t &&
|
|
3727
|
+
return G.current = !1, t && wi.getInstance().trackUseMcpConnection({
|
|
3807
3728
|
url: t,
|
|
3808
3729
|
transportType: re,
|
|
3809
3730
|
success: !1,
|
|
@@ -3816,10 +3737,10 @@ function pa(e) {
|
|
|
3816
3737
|
J,
|
|
3817
3738
|
t,
|
|
3818
3739
|
re,
|
|
3819
|
-
|
|
3820
|
-
|
|
3740
|
+
ce,
|
|
3741
|
+
de,
|
|
3821
3742
|
a
|
|
3822
|
-
]), at = (0,
|
|
3743
|
+
]), at = (0, j.useCallback)(async () => {
|
|
3823
3744
|
if (!n || !t) {
|
|
3824
3745
|
J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag.");
|
|
3825
3746
|
return;
|
|
@@ -3832,42 +3753,42 @@ function pa(e) {
|
|
|
3832
3753
|
J("debug", "Connect called after unmount, aborting.");
|
|
3833
3754
|
return;
|
|
3834
3755
|
}
|
|
3835
|
-
if (G.current = !0, Ve.current += 1, Be.current += 1,
|
|
3836
|
-
let { provider: e, oauthProxyUrl: t } =
|
|
3837
|
-
effectiveOAuthUrl:
|
|
3756
|
+
if (G.current = !0, Ve.current += 1, Be.current += 1, Me(void 0), H(void 0), Ke.current = null, z("discovering"), me([]), ge([]), ve([]), be([]), B(void 0), Ce(void 0), Te(void 0), De(void 0), Oe(void 0), Ae({}), J("info", `Connecting attempt #${Be.current} to ${t}...`), !W.current) {
|
|
3757
|
+
let { provider: e, oauthProxyUrl: t } = Zi({
|
|
3758
|
+
effectiveOAuthUrl: I,
|
|
3838
3759
|
storageKeyPrefix: i,
|
|
3839
|
-
oauthClientConfig:
|
|
3760
|
+
oauthClientConfig: N,
|
|
3840
3761
|
callbackUrl: r,
|
|
3841
3762
|
preventAutoAuth: m,
|
|
3842
3763
|
useRedirectFlow: h,
|
|
3843
|
-
gatewayUrl:
|
|
3764
|
+
gatewayUrl: F,
|
|
3844
3765
|
oauthProxyUrl: c,
|
|
3845
3766
|
onPopupWindow: g,
|
|
3846
3767
|
proxyOAuthRequests: !0,
|
|
3847
|
-
staticClientInfo:
|
|
3768
|
+
staticClientInfo: ie,
|
|
3848
3769
|
clientMetadataUrl: E,
|
|
3849
3770
|
scope: D
|
|
3850
3771
|
});
|
|
3851
|
-
W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${
|
|
3772
|
+
W.current = e, t && J("debug", `OAuth BFF enabled: ${t}`), J("debug", `BrowserOAuthClientProvider initialized with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
|
|
3852
3773
|
}
|
|
3853
|
-
U.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (U.current = new
|
|
3774
|
+
U.current ? J("debug", "BrowserMCPClient already exists, reusing.") : (U.current = new Ii(), J("debug", "BrowserMCPClient initialized in connect."));
|
|
3854
3775
|
let e = async (n) => {
|
|
3855
3776
|
if (!K.current) return J("debug", "Connection attempt aborted - component unmounted"), "failed";
|
|
3856
3777
|
J("info", `Attempting connection with transport: ${n}`), J("debug", `Client ref status at start of tryConnectWithTransport: ${U.current ? "initialized" : "NULL"}`);
|
|
3857
3778
|
try {
|
|
3858
|
-
let e =
|
|
3779
|
+
let e = Wi, r = {
|
|
3859
3780
|
url: t,
|
|
3860
3781
|
timeout: _,
|
|
3861
|
-
clientInfo:
|
|
3782
|
+
clientInfo: M,
|
|
3862
3783
|
...(() => {
|
|
3863
3784
|
let e = W.current?.getProxyFetch?.(te) ?? te;
|
|
3864
3785
|
return e ? { fetch: e } : {};
|
|
3865
3786
|
})(),
|
|
3866
|
-
...
|
|
3787
|
+
...ae && { clientOptions: ae },
|
|
3867
3788
|
...x !== void 0 && { protocolNegotiation: x },
|
|
3868
3789
|
...p ? { reconnectionOptions: p } : f === !1 ? { reconnectionOptions: { maxRetries: 0 } } : {}
|
|
3869
3790
|
};
|
|
3870
|
-
if (
|
|
3791
|
+
if (F && (r.gatewayUrl = F, J("debug", `Using proxy gateway: ${F} for target: ${t}`)), L && Object.keys(L).length > 0 && (r.headers = L), !U.current) {
|
|
3871
3792
|
if (!K.current) return J("debug", "Connection aborted - component unmounted, client cleaned up"), "failed";
|
|
3872
3793
|
let e = /* @__PURE__ */ Error("Client not initialized - this is a bug in the connection flow");
|
|
3873
3794
|
throw J("error", "Client ref is null in tryConnectWithTransport but component is still mounted"), e;
|
|
@@ -3884,10 +3805,10 @@ function pa(e) {
|
|
|
3884
3805
|
});
|
|
3885
3806
|
let i = await U.current.connect(e);
|
|
3886
3807
|
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),
|
|
3888
|
-
gatewayUrl:
|
|
3808
|
+
J("info", "✅ Successfully connected to MCP server"), J("info", "Server info:", i.info.server), J("info", "Server capabilities:", i.info.capabilities), P.enabled && P.healthCheckInterval !== !1 && (i._healthCheckCleanup = Qi({
|
|
3809
|
+
gatewayUrl: F,
|
|
3889
3810
|
url: t,
|
|
3890
|
-
allHeaders:
|
|
3811
|
+
allHeaders: L,
|
|
3891
3812
|
getAuthHeaders: async () => {
|
|
3892
3813
|
try {
|
|
3893
3814
|
let e = await W.current?.tokens?.();
|
|
@@ -3901,57 +3822,62 @@ function pa(e) {
|
|
|
3901
3822
|
isMountedRef: K,
|
|
3902
3823
|
stateRef: q,
|
|
3903
3824
|
autoReconnectRef: Ge,
|
|
3904
|
-
setState:
|
|
3825
|
+
setState: z,
|
|
3905
3826
|
addLog: J,
|
|
3906
3827
|
connect: at,
|
|
3907
|
-
defaultReconnectDelay:
|
|
3908
|
-
healthCheckIntervalMs:
|
|
3909
|
-
healthCheckTimeoutMs:
|
|
3910
|
-
})),
|
|
3828
|
+
defaultReconnectDelay: P.initialDelay,
|
|
3829
|
+
healthCheckIntervalMs: P.healthCheckInterval,
|
|
3830
|
+
healthCheckTimeoutMs: P.healthCheckTimeout
|
|
3831
|
+
})), wi.getInstance().trackUseMcpConnection({
|
|
3911
3832
|
url: t,
|
|
3912
3833
|
transportType: n,
|
|
3913
3834
|
success: !0,
|
|
3914
3835
|
hasOAuth: !!W.current,
|
|
3915
3836
|
hasSampling: Ze.current,
|
|
3916
3837
|
hasElicitation: Qe.current
|
|
3917
|
-
}).catch(() => {}),
|
|
3838
|
+
}).catch(() => {}), me(i.tools || []);
|
|
3918
3839
|
let [a, o, s] = await Promise.all([
|
|
3919
3840
|
i.listAllResources(),
|
|
3920
3841
|
i.listPrompts(),
|
|
3921
3842
|
i.supports("resources") ? i.listResourceTemplates() : Promise.resolve({ resourceTemplates: [] })
|
|
3922
3843
|
]);
|
|
3923
3844
|
if (!K.current) return J("debug", "Connection aborted after discovery - component unmounted"), "failed";
|
|
3924
|
-
|
|
3845
|
+
ge(a.resources || []), be(o.prompts || []), ve(s.resourceTemplates || []);
|
|
3925
3846
|
let { server: c, capabilities: l, protocolEra: u, protocolVersion: d, instructions: m, extensions: h } = i.info;
|
|
3926
|
-
if (K.current && (
|
|
3847
|
+
if (K.current && (Te(u), De(d), Oe(m), Ae(h)), c) {
|
|
3927
3848
|
if (J("debug", "Server info:", c), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
|
|
3928
|
-
|
|
3849
|
+
B(c), ze.current = Ki({
|
|
3929
3850
|
serverInfo: c,
|
|
3930
3851
|
url: t,
|
|
3931
3852
|
isMounted: () => K.current,
|
|
3932
|
-
setServerInfo:
|
|
3853
|
+
setServerInfo: B,
|
|
3933
3854
|
addLog: J
|
|
3934
3855
|
});
|
|
3935
3856
|
}
|
|
3936
3857
|
if (l) {
|
|
3937
3858
|
if (J("debug", "Server capabilities:", l), !K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
|
|
3938
|
-
|
|
3859
|
+
Ce(l);
|
|
3939
3860
|
}
|
|
3940
3861
|
if (W.current) {
|
|
3941
3862
|
let e = await W.current.tokens?.();
|
|
3942
3863
|
if (!K.current) return J("debug", "Connection aborted after token fetch for auth tokens - component unmounted"), "failed";
|
|
3943
3864
|
if (e?.access_token) {
|
|
3944
|
-
let t = e.expires_in ? Date.now() + e.expires_in * 1e3 : void 0, n = null, r = null;
|
|
3865
|
+
let t = e.expires_in ? Date.now() + e.expires_in * 1e3 : void 0, n = null, r = null, i = null;
|
|
3945
3866
|
try {
|
|
3946
3867
|
n = await W.current.getTokenEndpoint?.() ?? null;
|
|
3947
3868
|
} catch {
|
|
3948
3869
|
n = null;
|
|
3949
3870
|
}
|
|
3950
3871
|
try {
|
|
3951
|
-
r = await W.current.
|
|
3872
|
+
r = await W.current.getResource?.() ?? null;
|
|
3952
3873
|
} catch {
|
|
3953
3874
|
r = null;
|
|
3954
3875
|
}
|
|
3876
|
+
try {
|
|
3877
|
+
i = await W.current.getClientCredentials?.() ?? null;
|
|
3878
|
+
} catch {
|
|
3879
|
+
i = null;
|
|
3880
|
+
}
|
|
3955
3881
|
if (!K.current) return J("debug", "Skipping state update - component unmounted"), "failed";
|
|
3956
3882
|
Le({
|
|
3957
3883
|
access_token: e.access_token,
|
|
@@ -3960,25 +3886,26 @@ function pa(e) {
|
|
|
3960
3886
|
refresh_token: e.refresh_token,
|
|
3961
3887
|
scope: e.scope,
|
|
3962
3888
|
...n ? { token_endpoint: n } : {},
|
|
3963
|
-
...r
|
|
3964
|
-
...
|
|
3889
|
+
...r ? { resource: r } : {},
|
|
3890
|
+
...i?.client_id ? { client_id: i.client_id } : {},
|
|
3891
|
+
...i?.client_secret ? { client_secret: i.client_secret } : {}
|
|
3965
3892
|
});
|
|
3966
3893
|
}
|
|
3967
3894
|
}
|
|
3968
|
-
return Ke.current = n,
|
|
3895
|
+
return Ke.current = n, z("ready"), "success";
|
|
3969
3896
|
} catch (r) {
|
|
3970
3897
|
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 && (
|
|
3972
|
-
let s =
|
|
3973
|
-
if (s &&
|
|
3974
|
-
if (s && (!
|
|
3898
|
+
if (o && W.current && m) return J("info", "OAuth already discovered (stored auth URL present); awaiting manual authentication."), K.current && (z("pending_auth"), H(o)), G.current = !1, "auth_redirect";
|
|
3899
|
+
let s = Yi(r), c = Ei(r);
|
|
3900
|
+
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";
|
|
3901
|
+
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";
|
|
3975
3902
|
if (c) {
|
|
3976
3903
|
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
3904
|
if (W.current) if (J("info", "Authentication required. OAuth provider available."), m) {
|
|
3978
3905
|
if (J("info", "Waiting for user to initiate authentication flow..."), K.current) {
|
|
3979
|
-
|
|
3906
|
+
z("pending_auth");
|
|
3980
3907
|
let e = W.current?.getLastAttemptedAuthUrl?.();
|
|
3981
|
-
e && (
|
|
3908
|
+
e && (H(e), J("info", "Retrieved stored auth URL for manual authentication"));
|
|
3982
3909
|
}
|
|
3983
3910
|
return G.current = !1, "auth_redirect";
|
|
3984
3911
|
} else {
|
|
@@ -4001,7 +3928,7 @@ function pa(e) {
|
|
|
4001
3928
|
return Y(`Automatic OAuth authentication failed: ${e instanceof Error ? e.message : String(e)}`, e instanceof Error ? e : Error(String(e))), "failed";
|
|
4002
3929
|
}
|
|
4003
3930
|
}
|
|
4004
|
-
return
|
|
3931
|
+
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");
|
|
4005
3932
|
}
|
|
4006
3933
|
return Y(a, i instanceof Error ? i : Error(String(i))) ? "auth_redirect" : "failed";
|
|
4007
3934
|
}
|
|
@@ -4014,44 +3941,44 @@ function pa(e) {
|
|
|
4014
3941
|
t,
|
|
4015
3942
|
i,
|
|
4016
3943
|
r,
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
3944
|
+
N.name,
|
|
3945
|
+
N.version,
|
|
3946
|
+
N.uri,
|
|
3947
|
+
N.logo_uri,
|
|
3948
|
+
ie,
|
|
4022
3949
|
E,
|
|
4023
3950
|
D,
|
|
4024
|
-
|
|
3951
|
+
k,
|
|
4025
3952
|
re,
|
|
4026
3953
|
m,
|
|
4027
3954
|
h,
|
|
4028
3955
|
g,
|
|
4029
3956
|
n,
|
|
4030
3957
|
_,
|
|
4031
|
-
|
|
4032
|
-
|
|
3958
|
+
M,
|
|
3959
|
+
ae,
|
|
4033
3960
|
x,
|
|
4034
|
-
|
|
3961
|
+
F,
|
|
4035
3962
|
c,
|
|
4036
|
-
|
|
4037
|
-
|
|
3963
|
+
L,
|
|
3964
|
+
I,
|
|
4038
3965
|
et,
|
|
4039
3966
|
tt,
|
|
4040
3967
|
nt
|
|
4041
3968
|
]);
|
|
4042
|
-
(0,
|
|
3969
|
+
(0, j.useEffect)(() => {
|
|
4043
3970
|
qe.current = at, Je.current = Y;
|
|
4044
3971
|
}, [at, Y]);
|
|
4045
|
-
let ot = (0,
|
|
3972
|
+
let ot = (0, j.useCallback)(() => {
|
|
4046
3973
|
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,
|
|
3974
|
+
}, [J]), st = (0, j.useCallback)(async () => {
|
|
4048
3975
|
J("info", "Manual authentication requested...");
|
|
4049
3976
|
let e = q.current;
|
|
4050
3977
|
if (e === "failed") J("info", "Attempting to reconnect and authenticate via retry..."), ot();
|
|
4051
3978
|
else if (e === "pending_auth") {
|
|
4052
3979
|
J("info", "Proceeding with authentication from pending state...");
|
|
4053
3980
|
try {
|
|
4054
|
-
if (
|
|
3981
|
+
if (Gi(W.current, "Auth Provider not available for manual auth"), Gi(t, "Server URL is required for authentication"), a) {
|
|
4055
3982
|
J("info", "Using provided authProvider for manual authentication");
|
|
4056
3983
|
let e = new URL(t), n = e.origin + e.pathname.replace(/\/+$/, "");
|
|
4057
3984
|
await b(W.current, {
|
|
@@ -4060,15 +3987,15 @@ function pa(e) {
|
|
|
4060
3987
|
}), qe.current?.();
|
|
4061
3988
|
return;
|
|
4062
3989
|
}
|
|
4063
|
-
J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`),
|
|
4064
|
-
let e = null, n = null, { provider: o, oauthProxyUrl: s } =
|
|
4065
|
-
effectiveOAuthUrl:
|
|
3990
|
+
J("info", `Cleared ${W.current.clearStorage?.() ?? 0} OAuth storage item(s) for fresh authentication`), z("authenticating");
|
|
3991
|
+
let e = null, n = null, { provider: o, oauthProxyUrl: s } = Zi({
|
|
3992
|
+
effectiveOAuthUrl: I,
|
|
4066
3993
|
storageKeyPrefix: i,
|
|
4067
|
-
oauthClientConfig:
|
|
3994
|
+
oauthClientConfig: N,
|
|
4068
3995
|
callbackUrl: r,
|
|
4069
3996
|
preventAutoAuth: !1,
|
|
4070
3997
|
useRedirectFlow: h,
|
|
4071
|
-
gatewayUrl:
|
|
3998
|
+
gatewayUrl: F,
|
|
4072
3999
|
oauthProxyUrl: c,
|
|
4073
4000
|
onPopupWindow: (t, r, i) => {
|
|
4074
4001
|
e = i;
|
|
@@ -4078,7 +4005,7 @@ function pa(e) {
|
|
|
4078
4005
|
g?.(t, r, i);
|
|
4079
4006
|
},
|
|
4080
4007
|
proxyOAuthRequests: !0,
|
|
4081
|
-
staticClientInfo:
|
|
4008
|
+
staticClientInfo: ie,
|
|
4082
4009
|
clientMetadataUrl: E,
|
|
4083
4010
|
scope: D
|
|
4084
4011
|
});
|
|
@@ -4093,7 +4020,7 @@ function pa(e) {
|
|
|
4093
4020
|
J("info", "OAuth flow initiated (popup/redirect):", e instanceof Error ? e.message : "Redirecting...");
|
|
4094
4021
|
}
|
|
4095
4022
|
let d = o.getLastAttemptedAuthUrl?.();
|
|
4096
|
-
if (d && (
|
|
4023
|
+
if (d && (H(d), J("info", "Updated auth URL for fallback:", d), !n)) try {
|
|
4097
4024
|
n = new URL(d).searchParams.get("state");
|
|
4098
4025
|
} catch {}
|
|
4099
4026
|
if (h) return;
|
|
@@ -4119,10 +4046,10 @@ function pa(e) {
|
|
|
4119
4046
|
J("info", "Authentication succeeded; reconnecting to MCP server..."), G.current = !1, qe.current?.();
|
|
4120
4047
|
break;
|
|
4121
4048
|
case "cancelled":
|
|
4122
|
-
J("warn", "Authentication popup was closed before completing. Returning to pending_auth."),
|
|
4049
|
+
J("warn", "Authentication popup was closed before completing. Returning to pending_auth."), z("pending_auth");
|
|
4123
4050
|
break;
|
|
4124
4051
|
case "timeout":
|
|
4125
|
-
J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."),
|
|
4052
|
+
J("warn", "Authentication timed out waiting for the popup. Returning to pending_auth."), z("pending_auth");
|
|
4126
4053
|
break;
|
|
4127
4054
|
case "error":
|
|
4128
4055
|
Y(`Authentication failed: ${p.error}`);
|
|
@@ -4131,39 +4058,39 @@ function pa(e) {
|
|
|
4131
4058
|
}
|
|
4132
4059
|
} catch (e) {
|
|
4133
4060
|
if (!K.current) return;
|
|
4134
|
-
|
|
4061
|
+
z("pending_auth"), J("error", `Manual authentication failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
4135
4062
|
}
|
|
4136
4063
|
} else if (e === "authenticating") {
|
|
4137
4064
|
J("warn", "Already attempting authentication. Check for blocked popups or wait for timeout.");
|
|
4138
4065
|
let e = W.current?.getLastAttemptedAuthUrl?.();
|
|
4139
|
-
e && !
|
|
4066
|
+
e && !Fe && (H(e), J("info", "Manual authentication URL retrieved:", e));
|
|
4140
4067
|
} else J("info", `Client not in a state requiring manual authentication trigger (state: ${e}). If needed, try disconnecting and reconnecting.`);
|
|
4141
4068
|
}, [
|
|
4142
4069
|
J,
|
|
4143
4070
|
ot,
|
|
4144
4071
|
Y,
|
|
4145
|
-
|
|
4072
|
+
Fe,
|
|
4146
4073
|
t,
|
|
4147
4074
|
h,
|
|
4148
4075
|
g,
|
|
4149
4076
|
i,
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4077
|
+
N.name,
|
|
4078
|
+
N.uri,
|
|
4079
|
+
N.logo_uri,
|
|
4080
|
+
ie,
|
|
4154
4081
|
E,
|
|
4155
4082
|
D,
|
|
4156
4083
|
r,
|
|
4157
|
-
|
|
4084
|
+
M,
|
|
4158
4085
|
a
|
|
4159
|
-
]), ct = (0,
|
|
4160
|
-
W.current?.clearStorage ? (J("info", `Cleared ${W.current.clearStorage()} item(s) from localStorage for ${t}.`),
|
|
4086
|
+
]), ct = (0, j.useCallback)(() => {
|
|
4087
|
+
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.");
|
|
4161
4088
|
}, [
|
|
4162
4089
|
t,
|
|
4163
4090
|
J,
|
|
4164
4091
|
it
|
|
4165
4092
|
]);
|
|
4166
|
-
(0,
|
|
4093
|
+
(0, j.useEffect)(() => {
|
|
4167
4094
|
if (typeof window > "u") return;
|
|
4168
4095
|
let e = (e, t) => {
|
|
4169
4096
|
if (We.current) {
|
|
@@ -4206,28 +4133,28 @@ function pa(e) {
|
|
|
4206
4133
|
}
|
|
4207
4134
|
He.current && clearTimeout(He.current);
|
|
4208
4135
|
};
|
|
4209
|
-
}, [J]), (0,
|
|
4210
|
-
if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."),
|
|
4136
|
+
}, [J]), (0, j.useEffect)(() => {
|
|
4137
|
+
if (K.current = !0, !n || !t) return J("debug", n ? "No server URL provided, skipping connection." : "Connection disabled via enabled flag."), z("discovering"), () => {
|
|
4211
4138
|
K.current = !1;
|
|
4212
4139
|
};
|
|
4213
4140
|
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 !==
|
|
4215
|
-
let { provider: e, oauthProxyUrl: t } =
|
|
4216
|
-
effectiveOAuthUrl:
|
|
4141
|
+
else if (!W.current || W.current.serverUrl !== I) {
|
|
4142
|
+
let { provider: e, oauthProxyUrl: t } = Zi({
|
|
4143
|
+
effectiveOAuthUrl: I,
|
|
4217
4144
|
storageKeyPrefix: i,
|
|
4218
|
-
oauthClientConfig:
|
|
4145
|
+
oauthClientConfig: N,
|
|
4219
4146
|
callbackUrl: r,
|
|
4220
4147
|
preventAutoAuth: m,
|
|
4221
4148
|
useRedirectFlow: h,
|
|
4222
|
-
gatewayUrl:
|
|
4149
|
+
gatewayUrl: F,
|
|
4223
4150
|
oauthProxyUrl: c,
|
|
4224
4151
|
onPopupWindow: g,
|
|
4225
4152
|
proxyOAuthRequests: !0,
|
|
4226
|
-
staticClientInfo:
|
|
4153
|
+
staticClientInfo: ie,
|
|
4227
4154
|
clientMetadataUrl: E,
|
|
4228
4155
|
scope: D
|
|
4229
4156
|
});
|
|
4230
|
-
W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${
|
|
4157
|
+
W.current = e, t && J("debug", `OAuth proxy URL in effect: ${t}`), J("debug", `BrowserOAuthClientProvider initialized/updated with URL: ${I}, proxy: ${t ? "enabled" : "disabled"}, gateway: ${F ? "enabled" : "disabled"}`);
|
|
4231
4158
|
}
|
|
4232
4159
|
return at(), () => {
|
|
4233
4160
|
K.current = !1, J("debug", "useMcp unmounting, disconnecting."), it(!0);
|
|
@@ -4237,54 +4164,54 @@ function pa(e) {
|
|
|
4237
4164
|
n,
|
|
4238
4165
|
i,
|
|
4239
4166
|
r,
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4167
|
+
N.name,
|
|
4168
|
+
N.version,
|
|
4169
|
+
N.uri,
|
|
4170
|
+
N.logo_uri,
|
|
4171
|
+
ie,
|
|
4245
4172
|
E,
|
|
4246
4173
|
D,
|
|
4247
4174
|
h,
|
|
4248
|
-
|
|
4249
|
-
|
|
4175
|
+
M,
|
|
4176
|
+
I,
|
|
4250
4177
|
s,
|
|
4251
4178
|
a
|
|
4252
4179
|
]);
|
|
4253
|
-
let lt = (0,
|
|
4254
|
-
(0,
|
|
4180
|
+
let lt = (0, j.useRef)(ot), ut = (0, j.useRef)(J);
|
|
4181
|
+
(0, j.useEffect)(() => {
|
|
4255
4182
|
lt.current = ot, ut.current = J;
|
|
4256
|
-
}, [ot, J]), (0,
|
|
4183
|
+
}, [ot, J]), (0, j.useEffect)(() => {
|
|
4257
4184
|
let e = null;
|
|
4258
|
-
if (
|
|
4185
|
+
if (R === "failed" && d && Be.current > 0) {
|
|
4259
4186
|
if (!Ue.current) {
|
|
4260
4187
|
Ue.current = !0;
|
|
4261
|
-
let t = typeof d == "number" ? d :
|
|
4188
|
+
let t = typeof d == "number" ? d : na;
|
|
4262
4189
|
ut.current("info", `Connection failed, auto-retrying in ${t}ms...`), e = setTimeout(() => {
|
|
4263
4190
|
Ue.current = !1, K.current && q.current === "failed" && lt.current();
|
|
4264
4191
|
}, t);
|
|
4265
4192
|
}
|
|
4266
|
-
} else
|
|
4193
|
+
} else R !== "failed" && (Ue.current = !1);
|
|
4267
4194
|
return () => {
|
|
4268
4195
|
e && (clearTimeout(e), Ue.current = !1);
|
|
4269
4196
|
};
|
|
4270
|
-
}, [
|
|
4271
|
-
let dt = (0,
|
|
4197
|
+
}, [R, d]);
|
|
4198
|
+
let dt = (0, j.useCallback)(async () => q.current === "ready" ? xe?.icon ? xe.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), [xe, J]);
|
|
4272
4199
|
return {
|
|
4273
|
-
state:
|
|
4274
|
-
name:
|
|
4275
|
-
tools:
|
|
4276
|
-
resources:
|
|
4277
|
-
resourceTemplates:
|
|
4278
|
-
prompts:
|
|
4279
|
-
serverInfo:
|
|
4280
|
-
capabilities:
|
|
4281
|
-
protocolEra:
|
|
4282
|
-
protocolVersion:
|
|
4283
|
-
instructions:
|
|
4284
|
-
extensions:
|
|
4285
|
-
error:
|
|
4286
|
-
log:
|
|
4287
|
-
authUrl:
|
|
4200
|
+
state: R,
|
|
4201
|
+
name: xe?.name || t || "",
|
|
4202
|
+
tools: pe,
|
|
4203
|
+
resources: he,
|
|
4204
|
+
resourceTemplates: _e,
|
|
4205
|
+
prompts: ye,
|
|
4206
|
+
serverInfo: xe,
|
|
4207
|
+
capabilities: Se,
|
|
4208
|
+
protocolEra: we,
|
|
4209
|
+
protocolVersion: Ee,
|
|
4210
|
+
instructions: V,
|
|
4211
|
+
extensions: ke,
|
|
4212
|
+
error: je,
|
|
4213
|
+
log: Ne,
|
|
4214
|
+
authUrl: Fe,
|
|
4288
4215
|
authTokens: Ie,
|
|
4289
4216
|
client: U.current,
|
|
4290
4217
|
...rt,
|
|
@@ -4295,11 +4222,11 @@ function pa(e) {
|
|
|
4295
4222
|
ensureIconLoaded: dt
|
|
4296
4223
|
};
|
|
4297
4224
|
}
|
|
4298
|
-
var
|
|
4299
|
-
function
|
|
4225
|
+
var ia = null;
|
|
4226
|
+
function aa() {
|
|
4300
4227
|
return typeof window < "u" && window.name.startsWith("mcp_auth_");
|
|
4301
4228
|
}
|
|
4302
|
-
function
|
|
4229
|
+
function oa(e, t, n) {
|
|
4303
4230
|
return {
|
|
4304
4231
|
type: Er,
|
|
4305
4232
|
success: e,
|
|
@@ -4308,7 +4235,7 @@ function ga(e, t, n) {
|
|
|
4308
4235
|
...n.serverUrlHash ? { serverUrlHash: n.serverUrlHash } : {}
|
|
4309
4236
|
};
|
|
4310
4237
|
}
|
|
4311
|
-
function
|
|
4238
|
+
function sa(e) {
|
|
4312
4239
|
if (typeof BroadcastChannel > "u") return;
|
|
4313
4240
|
let t;
|
|
4314
4241
|
try {
|
|
@@ -4323,7 +4250,7 @@ function _a(e) {
|
|
|
4323
4250
|
}, 0);
|
|
4324
4251
|
}
|
|
4325
4252
|
}
|
|
4326
|
-
function
|
|
4253
|
+
function ca(e, t, n, r) {
|
|
4327
4254
|
if (typeof document > "u") return;
|
|
4328
4255
|
document.body.innerHTML = "";
|
|
4329
4256
|
let i = document.createElement("div");
|
|
@@ -4339,7 +4266,7 @@ function va(e, t, n, r) {
|
|
|
4339
4266
|
}
|
|
4340
4267
|
document.body.appendChild(i);
|
|
4341
4268
|
}
|
|
4342
|
-
function
|
|
4269
|
+
function la(e) {
|
|
4343
4270
|
let t = `mcp:auth:state_${e}`, n = localStorage.getItem(t) ? t : null;
|
|
4344
4271
|
if (!n) {
|
|
4345
4272
|
let t = `:state_${e}`;
|
|
@@ -4364,14 +4291,14 @@ function ya(e) {
|
|
|
4364
4291
|
value: i
|
|
4365
4292
|
};
|
|
4366
4293
|
}
|
|
4367
|
-
function
|
|
4294
|
+
function ua(e, t) {
|
|
4368
4295
|
let n = new URL(e);
|
|
4369
4296
|
n.searchParams.set("auth_error", "oauth_callback_failed"), n.searchParams.set("auth_error_description", t), window.location.href = n.toString();
|
|
4370
4297
|
}
|
|
4371
|
-
function
|
|
4372
|
-
let i =
|
|
4298
|
+
function da(e, t, n, r) {
|
|
4299
|
+
let i = oa(e, t, r), a = n?.returnUrl, o = n?.flowType === "popup" || aa();
|
|
4373
4300
|
if (n?.flowType === "redirect" && a) {
|
|
4374
|
-
e ? window.location.href = a :
|
|
4301
|
+
e ? window.location.href = a : ua(a, t ?? "Authentication failed.");
|
|
4375
4302
|
return;
|
|
4376
4303
|
}
|
|
4377
4304
|
if (window.opener && !window.opener.closed) {
|
|
@@ -4379,50 +4306,50 @@ function xa(e, t, n, r) {
|
|
|
4379
4306
|
return;
|
|
4380
4307
|
}
|
|
4381
4308
|
if (o) {
|
|
4382
|
-
|
|
4309
|
+
sa(i), ca(e ? "Authentication Successful!" : "Authentication Error", e ? "You're authenticated. You can close this window and return to the app." : t ?? "Authentication failed.", !e, a);
|
|
4383
4310
|
try {
|
|
4384
4311
|
window.close();
|
|
4385
4312
|
} catch {}
|
|
4386
4313
|
return;
|
|
4387
4314
|
}
|
|
4388
4315
|
if (a) {
|
|
4389
|
-
e ? window.location.href = a :
|
|
4316
|
+
e ? window.location.href = a : ua(a, t ?? "Authentication failed.");
|
|
4390
4317
|
return;
|
|
4391
4318
|
}
|
|
4392
4319
|
if (!e) {
|
|
4393
|
-
|
|
4320
|
+
ca("Authentication Error", t ?? "Authentication failed.", !0);
|
|
4394
4321
|
return;
|
|
4395
4322
|
}
|
|
4396
4323
|
window.location.href = "/";
|
|
4397
4324
|
}
|
|
4398
|
-
function
|
|
4399
|
-
return
|
|
4325
|
+
function fa() {
|
|
4326
|
+
return ia ||= pa(), ia;
|
|
4400
4327
|
}
|
|
4401
|
-
async function
|
|
4328
|
+
async function pa() {
|
|
4402
4329
|
let e = new URLSearchParams(window.location.search), t = e.get("state"), n = null, r = null, i = null;
|
|
4403
4330
|
try {
|
|
4404
4331
|
if (!t) throw Error("OAuth callback is missing the state parameter.");
|
|
4405
|
-
let a =
|
|
4332
|
+
let a = la(t);
|
|
4406
4333
|
if (n = a.key, r = a.value, !r.expiry || r.expiry < Date.now()) throw localStorage.removeItem(n), Error("OAuth state has expired. Please start authentication again.");
|
|
4407
4334
|
if (!r.providerOptions) throw Error("Stored OAuth state is missing provider options.");
|
|
4408
4335
|
let { serverUrl: o, ...s } = r.providerOptions;
|
|
4409
4336
|
i = new ei(o, s), await new w(new URL(o), {
|
|
4410
4337
|
authProvider: i,
|
|
4411
4338
|
fetch: i.getProxyFetch()
|
|
4412
|
-
}).finishAuth(e), localStorage.removeItem(n),
|
|
4339
|
+
}).finishAuth(e), localStorage.removeItem(n), da(!0, void 0, r, {
|
|
4413
4340
|
state: t,
|
|
4414
4341
|
serverUrlHash: r.serverUrlHash
|
|
4415
4342
|
});
|
|
4416
4343
|
} catch (e) {
|
|
4417
4344
|
let a = e instanceof Error ? e.message : String(e);
|
|
4418
|
-
console.error("[mcp-callback] OAuth callback failed:", e), n && localStorage.removeItem(n), i && localStorage.removeItem(i.getKey("last_auth_url")),
|
|
4345
|
+
console.error("[mcp-callback] OAuth callback failed:", e), n && localStorage.removeItem(n), i && localStorage.removeItem(i.getKey("last_auth_url")), da(!1, a, r, {
|
|
4419
4346
|
state: t,
|
|
4420
4347
|
serverUrlHash: r?.serverUrlHash
|
|
4421
4348
|
});
|
|
4422
4349
|
}
|
|
4423
4350
|
}
|
|
4424
4351
|
mr();
|
|
4425
|
-
var
|
|
4352
|
+
var ma = [
|
|
4426
4353
|
"url",
|
|
4427
4354
|
"displayName",
|
|
4428
4355
|
"enabled",
|
|
@@ -4446,27 +4373,27 @@ var wa = [
|
|
|
4446
4373
|
"clientInfo",
|
|
4447
4374
|
"oauth"
|
|
4448
4375
|
];
|
|
4449
|
-
function
|
|
4376
|
+
function ha(e) {
|
|
4450
4377
|
let t = {};
|
|
4451
|
-
for (let n of
|
|
4378
|
+
for (let n of ma) {
|
|
4452
4379
|
let r = e[n];
|
|
4453
4380
|
r !== void 0 && (t[n] = r);
|
|
4454
4381
|
}
|
|
4455
4382
|
return t;
|
|
4456
4383
|
}
|
|
4457
|
-
function
|
|
4458
|
-
return
|
|
4384
|
+
function ga(e) {
|
|
4385
|
+
return ha(e);
|
|
4459
4386
|
}
|
|
4460
|
-
var
|
|
4461
|
-
function
|
|
4462
|
-
let [t, n] = (0,
|
|
4387
|
+
var _a = 500, va = 5 * 6e4;
|
|
4388
|
+
function ya(e) {
|
|
4389
|
+
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) => {
|
|
4463
4390
|
for (let t of l.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
|
|
4464
4391
|
l.current.clear();
|
|
4465
4392
|
for (let t of u.current.values()) clearTimeout(t.timeout), t.reject(Error(e));
|
|
4466
4393
|
u.current.clear(), i([]), o([]);
|
|
4467
4394
|
}, []);
|
|
4468
|
-
(0,
|
|
4469
|
-
let f = (0,
|
|
4395
|
+
(0, j.useEffect)(() => () => d("MCP server connection was removed"), [d]);
|
|
4396
|
+
let f = (0, j.useCallback)((t) => {
|
|
4470
4397
|
let r = {
|
|
4471
4398
|
id: globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`,
|
|
4472
4399
|
method: t.method,
|
|
@@ -4474,14 +4401,14 @@ function ka(e) {
|
|
|
4474
4401
|
timestamp: Date.now(),
|
|
4475
4402
|
read: !1
|
|
4476
4403
|
};
|
|
4477
|
-
n((e) => [r, ...e].slice(0,
|
|
4478
|
-
}, [e.onNotificationReceived]), p = (0,
|
|
4404
|
+
n((e) => [r, ...e].slice(0, _a)), e.onNotificationReceived?.(r);
|
|
4405
|
+
}, [e.onNotificationReceived]), p = (0, j.useCallback)((e, t) => {
|
|
4479
4406
|
let n = l.current.get(e);
|
|
4480
4407
|
n && (clearTimeout(n.timeout), l.current.delete(e), i((t) => t.filter((t) => t.id !== e)), n.resolve(t));
|
|
4481
|
-
}, []), m = (0,
|
|
4408
|
+
}, []), m = (0, j.useCallback)((e, t) => {
|
|
4482
4409
|
let n = l.current.get(e);
|
|
4483
4410
|
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,
|
|
4411
|
+
}, []), h = (0, j.useCallback)((t) => new Promise((n, r) => {
|
|
4485
4412
|
let a = `sampling-${s.current++}`, o = {
|
|
4486
4413
|
id: a,
|
|
4487
4414
|
request: {
|
|
@@ -4490,7 +4417,7 @@ function ka(e) {
|
|
|
4490
4417
|
},
|
|
4491
4418
|
timestamp: Date.now(),
|
|
4492
4419
|
serverName: e.serverName
|
|
4493
|
-
}, c = setTimeout(() => m(a, "Sampling request timed out"),
|
|
4420
|
+
}, c = setTimeout(() => m(a, "Sampling request timed out"), va);
|
|
4494
4421
|
l.current.set(a, {
|
|
4495
4422
|
resolve: n,
|
|
4496
4423
|
reject: r,
|
|
@@ -4500,19 +4427,19 @@ function ka(e) {
|
|
|
4500
4427
|
p,
|
|
4501
4428
|
e,
|
|
4502
4429
|
m
|
|
4503
|
-
]), g = (0,
|
|
4430
|
+
]), g = (0, j.useCallback)((e, t) => {
|
|
4504
4431
|
let n = u.current.get(e);
|
|
4505
4432
|
n && (clearTimeout(n.timeout), u.current.delete(e), o((t) => t.filter((t) => t.id !== e)), n.resolve(t));
|
|
4506
|
-
}, []), _ = (0,
|
|
4433
|
+
}, []), _ = (0, j.useCallback)((e, t) => {
|
|
4507
4434
|
let n = u.current.get(e);
|
|
4508
4435
|
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,
|
|
4436
|
+
}, []), v = (0, j.useCallback)((t) => new Promise((n, r) => {
|
|
4510
4437
|
let i = `elicitation-${c.current++}`, a = {
|
|
4511
4438
|
id: i,
|
|
4512
4439
|
request: t,
|
|
4513
4440
|
timestamp: Date.now(),
|
|
4514
4441
|
serverName: e.serverName
|
|
4515
|
-
}, s = setTimeout(() => _(i, "Elicitation request timed out"),
|
|
4442
|
+
}, s = setTimeout(() => _(i, "Elicitation request timed out"), va);
|
|
4516
4443
|
u.current.set(i, {
|
|
4517
4444
|
resolve: n,
|
|
4518
4445
|
reject: r,
|
|
@@ -4522,15 +4449,15 @@ function ka(e) {
|
|
|
4522
4449
|
g,
|
|
4523
4450
|
e,
|
|
4524
4451
|
_
|
|
4525
|
-
]), ee = (0,
|
|
4452
|
+
]), ee = (0, j.useCallback)((e) => {
|
|
4526
4453
|
n((t) => t.map((t) => t.id === e ? {
|
|
4527
4454
|
...t,
|
|
4528
4455
|
read: !0
|
|
4529
4456
|
} : t));
|
|
4530
|
-
}, []), te = (0,
|
|
4457
|
+
}, []), te = (0, j.useCallback)(() => n((e) => e.map((e) => ({
|
|
4531
4458
|
...e,
|
|
4532
4459
|
read: !0
|
|
4533
|
-
}))), []), y = (0,
|
|
4460
|
+
}))), []), y = (0, j.useCallback)(() => n([]), []);
|
|
4534
4461
|
return {
|
|
4535
4462
|
notifications: t,
|
|
4536
4463
|
pendingSamplingRequests: r,
|
|
@@ -4549,15 +4476,15 @@ function ka(e) {
|
|
|
4549
4476
|
rejectAll: d
|
|
4550
4477
|
};
|
|
4551
4478
|
}
|
|
4552
|
-
var Q = pr.get("McpClientProvider"),
|
|
4479
|
+
var Q = pr.get("McpClientProvider"), ba = (0, j.createContext)(null);
|
|
4553
4480
|
function $(e, t) {
|
|
4554
4481
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
4555
4482
|
}
|
|
4556
|
-
function
|
|
4557
|
-
return e.id === t.id && $(
|
|
4483
|
+
function xa(e, t) {
|
|
4484
|
+
return e.id === t.id && $(ha(e), ha(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
4485
|
}
|
|
4559
|
-
function
|
|
4560
|
-
let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0,
|
|
4486
|
+
function Sa({ 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 }) {
|
|
4487
|
+
let { displayName: h, onSamplingRequest: g, onElicitationRequest: _, onNotificationReceived: v, wrapTransport: ee } = t, te = (0, j.useMemo)(() => {
|
|
4561
4488
|
let { displayName: c, onSamplingRequest: l, onElicitationRequest: u, onNotificationReceived: d, wrapTransport: f, ...p } = t;
|
|
4562
4489
|
return {
|
|
4563
4490
|
...p,
|
|
@@ -4580,7 +4507,7 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4580
4507
|
a,
|
|
4581
4508
|
o,
|
|
4582
4509
|
s
|
|
4583
|
-
]), y = (0,
|
|
4510
|
+
]), y = (0, j.useMemo)(() => {
|
|
4584
4511
|
if (!(!f && !ee)) return (t) => {
|
|
4585
4512
|
let n = t;
|
|
4586
4513
|
return f && (n = f(n, e)), ee && (n = ee(n, e)), n;
|
|
@@ -4589,7 +4516,7 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4589
4516
|
f,
|
|
4590
4517
|
ee,
|
|
4591
4518
|
e
|
|
4592
|
-
]), b =
|
|
4519
|
+
]), b = ya({
|
|
4593
4520
|
serverId: e,
|
|
4594
4521
|
serverName: h || e,
|
|
4595
4522
|
onNotificationReceived: v,
|
|
@@ -4597,17 +4524,17 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4597
4524
|
onElicitationRequest: _,
|
|
4598
4525
|
onGlobalSamplingRequest: p,
|
|
4599
4526
|
onGlobalElicitationRequest: m
|
|
4600
|
-
}), x =
|
|
4527
|
+
}), x = ra({
|
|
4601
4528
|
...te,
|
|
4602
4529
|
onNotification: b.onNotification,
|
|
4603
4530
|
onSampling: b.onSampling,
|
|
4604
4531
|
onElicitation: b.onElicitation,
|
|
4605
4532
|
wrapTransport: y
|
|
4606
4533
|
});
|
|
4607
|
-
(0,
|
|
4534
|
+
(0, j.useEffect)(() => {
|
|
4608
4535
|
x.state !== "ready" && b.rejectAll("MCP server connection is no longer active");
|
|
4609
4536
|
}, [x.state, b.rejectAll]);
|
|
4610
|
-
let S = (0,
|
|
4537
|
+
let S = (0, j.useCallback)((t) => l(e, t), [e, l]), C = (0, j.useCallback)((n) => {
|
|
4611
4538
|
let r = t.proxyConfig?.proxyAddress?.trim();
|
|
4612
4539
|
return t.connectionMode === "proxy" && r ? l(e, {
|
|
4613
4540
|
proxyConfig: {
|
|
@@ -4622,12 +4549,12 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4622
4549
|
t.connectionMode,
|
|
4623
4550
|
t.proxyConfig,
|
|
4624
4551
|
l
|
|
4625
|
-
]), ne = (0,
|
|
4626
|
-
return (0,
|
|
4552
|
+
]), 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);
|
|
4553
|
+
return (0, j.useEffect)(() => {
|
|
4627
4554
|
re.current = c;
|
|
4628
|
-
}, [c]), (0,
|
|
4555
|
+
}, [c]), (0, j.useEffect)(() => {
|
|
4629
4556
|
let n = {
|
|
4630
|
-
...
|
|
4557
|
+
...ga(t),
|
|
4631
4558
|
...x,
|
|
4632
4559
|
id: e,
|
|
4633
4560
|
displayName: h || t.displayName || e,
|
|
@@ -4647,7 +4574,7 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4647
4574
|
setDisplayName: ne,
|
|
4648
4575
|
reconnect: w
|
|
4649
4576
|
}, r = T.current;
|
|
4650
|
-
!r || !
|
|
4577
|
+
!r || !xa(r, n) ? (T.current = n, re.current(n)) : Q.debug(`[McpServerWrapper ${e}] No meaningful changes detected, skipping onUpdate`);
|
|
4651
4578
|
}, [
|
|
4652
4579
|
e,
|
|
4653
4580
|
h,
|
|
@@ -4674,13 +4601,13 @@ function Ma({ id: e, options: t, defaultCallbackUrl: n, defaultOAuthProxyUrl: r,
|
|
|
4674
4601
|
w
|
|
4675
4602
|
]), null;
|
|
4676
4603
|
}
|
|
4677
|
-
function
|
|
4678
|
-
let [h, g] = (0,
|
|
4679
|
-
(0,
|
|
4604
|
+
function Ca({ 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 }) {
|
|
4605
|
+
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)([]);
|
|
4606
|
+
(0, j.useEffect)(() => {
|
|
4680
4607
|
S.current = _;
|
|
4681
4608
|
}, [_]);
|
|
4682
|
-
let C = (0,
|
|
4683
|
-
(0,
|
|
4609
|
+
let C = (0, j.useRef)({}), [ne, w] = (0, j.useState)(void 0), [re, T] = (0, j.useState)(!1);
|
|
4610
|
+
(0, j.useEffect)(() => {
|
|
4684
4611
|
if (!l || typeof window > "u") {
|
|
4685
4612
|
w(void 0), T(!0);
|
|
4686
4613
|
return;
|
|
@@ -4690,7 +4617,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4690
4617
|
}).catch((e) => {
|
|
4691
4618
|
Q.error("[McpClientProvider] Failed to load RPC logger:", e), w(void 0), T(!0);
|
|
4692
4619
|
});
|
|
4693
|
-
}, [l]), (0,
|
|
4620
|
+
}, [l]), (0, j.useEffect)(() => {
|
|
4694
4621
|
if (!re) {
|
|
4695
4622
|
Q.debug("[McpClientProvider] Waiting for RPC logging to be ready before loading servers");
|
|
4696
4623
|
return;
|
|
@@ -4734,10 +4661,10 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4734
4661
|
c,
|
|
4735
4662
|
t,
|
|
4736
4663
|
re
|
|
4737
|
-
]), (0,
|
|
4664
|
+
]), (0, j.useEffect)(() => {
|
|
4738
4665
|
!c || !y || (async () => {
|
|
4739
4666
|
try {
|
|
4740
|
-
let e = h.reduce((e, t) => (e[t.id] =
|
|
4667
|
+
let e = h.reduce((e, t) => (e[t.id] = ga(t.options), e), {});
|
|
4741
4668
|
await Promise.resolve(c.setServers(e));
|
|
4742
4669
|
} catch (e) {
|
|
4743
4670
|
Q.error("[McpClientProvider] Failed to save to storage:", e);
|
|
@@ -4748,7 +4675,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4748
4675
|
c,
|
|
4749
4676
|
y
|
|
4750
4677
|
]);
|
|
4751
|
-
let E = (0,
|
|
4678
|
+
let E = (0, j.useCallback)((e) => {
|
|
4752
4679
|
Q.debug(`[McpClientProvider] handleServerUpdate called for server ${e.id}`, {
|
|
4753
4680
|
toolCount: e.tools.length,
|
|
4754
4681
|
state: e.state
|
|
@@ -4763,7 +4690,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4763
4690
|
currentToolCount: i.tools.length,
|
|
4764
4691
|
updatedToolCount: e.tools.length,
|
|
4765
4692
|
stateChanged: a
|
|
4766
|
-
}),
|
|
4693
|
+
}), xa(i, e)) return Q.debug(`[McpClientProvider] No changes detected for server ${e.id}, skipping update`), n;
|
|
4767
4694
|
if (Q.debug(`[McpClientProvider] Updating server ${e.id} in state`), a && t.push(() => f?.(e.id, e.state)), o && e.serverInfo && c?.setServerMetadata) {
|
|
4768
4695
|
let t = {
|
|
4769
4696
|
name: e.serverInfo.name,
|
|
@@ -4786,12 +4713,12 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4786
4713
|
u,
|
|
4787
4714
|
f,
|
|
4788
4715
|
c
|
|
4789
|
-
]), D = (0,
|
|
4716
|
+
]), D = (0, j.useCallback)((e, t) => {
|
|
4790
4717
|
g((n) => n.find((t) => t.id === e) ? n : (Q.debug("[McpClientProvider] Adding new server to configs:", e), [...n, {
|
|
4791
4718
|
id: e,
|
|
4792
4719
|
options: t
|
|
4793
4720
|
}]));
|
|
4794
|
-
}, []),
|
|
4721
|
+
}, []), ie = (0, j.useCallback)(async (e, t) => {
|
|
4795
4722
|
let n = S.current.find((t) => t.id === e);
|
|
4796
4723
|
if (v((t) => t.filter((t) => t.id !== e)), g((t) => t.filter((t) => t.id !== e)), te((t) => {
|
|
4797
4724
|
let { [e]: n, ...r } = t;
|
|
@@ -4801,7 +4728,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4801
4728
|
t(e);
|
|
4802
4729
|
}
|
|
4803
4730
|
d?.(e);
|
|
4804
|
-
}, [l, d]),
|
|
4731
|
+
}, [l, d]), O = (0, j.useCallback)(async (e, t) => {
|
|
4805
4732
|
let n = h.find((t) => t.id === e);
|
|
4806
4733
|
if (!n) {
|
|
4807
4734
|
Q.warn(`[McpClientProvider] Cannot update server "${e}" - not found`);
|
|
@@ -4811,14 +4738,14 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4811
4738
|
...n.options,
|
|
4812
4739
|
...t
|
|
4813
4740
|
};
|
|
4814
|
-
$(
|
|
4741
|
+
$(ha(n.options), ha(r)) || (await S.current.find((t) => t.id === e)?.disconnect(), v((t) => t.filter((t) => t.id !== e)), g((t) => t.map((t) => t.id === e ? {
|
|
4815
4742
|
id: e,
|
|
4816
4743
|
options: r
|
|
4817
4744
|
} : t)), te((t) => ({
|
|
4818
4745
|
...t,
|
|
4819
4746
|
[e]: (t[e] ?? 0) + 1
|
|
4820
4747
|
})));
|
|
4821
|
-
}, [h]),
|
|
4748
|
+
}, [h]), k = (0, j.useCallback)(async (e) => {
|
|
4822
4749
|
if (!h.find((t) => t.id === e)) {
|
|
4823
4750
|
Q.warn(`[McpClientProvider] Cannot reconnect server "${e}" - not found`);
|
|
4824
4751
|
return;
|
|
@@ -4827,7 +4754,7 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4827
4754
|
...t,
|
|
4828
4755
|
[e]: (t[e] ?? 0) + 1
|
|
4829
4756
|
}));
|
|
4830
|
-
}, [h]),
|
|
4757
|
+
}, [h]), ae = (0, j.useCallback)(async (e, t) => new Promise((n) => {
|
|
4831
4758
|
let r = h.find((t) => t.id === e);
|
|
4832
4759
|
if (!r) {
|
|
4833
4760
|
Q.warn(`[McpClientProvider] Cannot update server metadata for "${e}" - not found`), n();
|
|
@@ -4847,33 +4774,33 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4847
4774
|
} : t);
|
|
4848
4775
|
return setTimeout(() => n(), 0), r;
|
|
4849
4776
|
});
|
|
4850
|
-
}), [h]),
|
|
4777
|
+
}), [h]), A = (0, j.useCallback)((e) => _.find((t) => t.id === e), [_]), oe = (0, j.useMemo)(() => ({
|
|
4851
4778
|
servers: _,
|
|
4852
4779
|
addServer: D,
|
|
4853
|
-
removeServer:
|
|
4854
|
-
updateServerMetadata:
|
|
4855
|
-
updateServer:
|
|
4856
|
-
getServer:
|
|
4780
|
+
removeServer: ie,
|
|
4781
|
+
updateServerMetadata: ae,
|
|
4782
|
+
updateServer: O,
|
|
4783
|
+
getServer: A,
|
|
4857
4784
|
storageLoaded: y
|
|
4858
4785
|
}), [
|
|
4859
4786
|
_,
|
|
4860
4787
|
D,
|
|
4861
|
-
O,
|
|
4862
|
-
j,
|
|
4863
|
-
k,
|
|
4864
4788
|
ie,
|
|
4789
|
+
ae,
|
|
4790
|
+
O,
|
|
4791
|
+
A,
|
|
4865
4792
|
y
|
|
4866
|
-
]), { capabilities:
|
|
4793
|
+
]), { capabilities: se, ...M } = s || {}, N = (0, j.useMemo)(() => Object.keys(M).length ? M : void 0, [s]), ce = (0, j.useMemo)(() => h.map((e) => {
|
|
4867
4794
|
let t = o ? {
|
|
4868
4795
|
...o,
|
|
4869
4796
|
...e.options
|
|
4870
4797
|
} : e.options;
|
|
4871
|
-
return
|
|
4798
|
+
return se && (t = {
|
|
4872
4799
|
...t,
|
|
4873
4800
|
clientOptions: {
|
|
4874
4801
|
...t.clientOptions,
|
|
4875
4802
|
capabilities: {
|
|
4876
|
-
...
|
|
4803
|
+
...se,
|
|
4877
4804
|
...t.clientOptions?.capabilities
|
|
4878
4805
|
}
|
|
4879
4806
|
}
|
|
@@ -4883,10 +4810,10 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4883
4810
|
};
|
|
4884
4811
|
}), [
|
|
4885
4812
|
h,
|
|
4886
|
-
|
|
4813
|
+
se,
|
|
4887
4814
|
o
|
|
4888
|
-
]),
|
|
4889
|
-
return /* @__PURE__ */
|
|
4815
|
+
]), P = typeof window < "u" && /\/oauth\/callback\/?$/.test(window.location.pathname);
|
|
4816
|
+
return /* @__PURE__ */ j.createElement(ba.Provider, { value: oe }, e, !P && ce.map((e) => /* @__PURE__ */ j.createElement(Sa, {
|
|
4890
4817
|
key: `${e.id}-v${ee[e.id] ?? 0}`,
|
|
4891
4818
|
id: e.id,
|
|
4892
4819
|
options: e.options,
|
|
@@ -4894,23 +4821,23 @@ function Na({ children: e, mcpServers: t, defaultCallbackUrl: n, defaultOAuthPro
|
|
|
4894
4821
|
defaultOAuthProxyUrl: r,
|
|
4895
4822
|
defaultProxyConfig: i,
|
|
4896
4823
|
defaultAutoProxyFallback: a,
|
|
4897
|
-
clientInfo:
|
|
4824
|
+
clientInfo: N,
|
|
4898
4825
|
cachedMetadata: C.current[e.id],
|
|
4899
4826
|
onUpdate: E,
|
|
4900
|
-
onUpdateConfig:
|
|
4901
|
-
onUpdateDisplayName: (e, t) =>
|
|
4902
|
-
onReconnect:
|
|
4827
|
+
onUpdateConfig: O,
|
|
4828
|
+
onUpdateDisplayName: (e, t) => ae(e, { name: t }),
|
|
4829
|
+
onReconnect: k,
|
|
4903
4830
|
rpcWrapTransport: ne,
|
|
4904
4831
|
onGlobalSamplingRequest: p,
|
|
4905
4832
|
onGlobalElicitationRequest: m
|
|
4906
4833
|
})));
|
|
4907
4834
|
}
|
|
4908
|
-
function
|
|
4909
|
-
let e = (0,
|
|
4835
|
+
function wa() {
|
|
4836
|
+
let e = (0, j.useContext)(ba);
|
|
4910
4837
|
if (!e) throw Error("useMcpClient must be used within a McpClientProvider");
|
|
4911
4838
|
return e;
|
|
4912
4839
|
}
|
|
4913
|
-
var
|
|
4840
|
+
var Ta = class {
|
|
4914
4841
|
constructor(e = "mcp-client-servers") {
|
|
4915
4842
|
this.storageKey = e, this.metadataKey = `${e}-metadata`;
|
|
4916
4843
|
}
|
|
@@ -4976,7 +4903,7 @@ var Fa = class {
|
|
|
4976
4903
|
}
|
|
4977
4904
|
};
|
|
4978
4905
|
wr();
|
|
4979
|
-
function
|
|
4906
|
+
function Ea(e) {
|
|
4980
4907
|
let t = {};
|
|
4981
4908
|
if (!e) return t;
|
|
4982
4909
|
for (let [n, r] of Object.entries(e)) if (typeof r == "string" && (r.trim().startsWith("[") || r.trim().startsWith("{"))) try {
|
|
@@ -4987,7 +4914,11 @@ function Ia(e) {
|
|
|
4987
4914
|
else t[n] = r;
|
|
4988
4915
|
return t;
|
|
4989
4916
|
}
|
|
4990
|
-
function
|
|
4917
|
+
var Da = "<script>\n(function () {\n var files = new Map();\n window.openai = window.openai || {};\n window.openai.uploadFile = async function (file) {\n var fileId = crypto.randomUUID();\n files.set(fileId, file);\n return { fileId: fileId };\n };\n window.openai.getFileDownloadUrl = async function (ref) {\n var file = files.get(ref.fileId);\n if (!file) {\n throw new Error(\"File not found: \" + ref.fileId);\n }\n return { downloadUrl: URL.createObjectURL(file) };\n };\n})();\n<\/script>";
|
|
4918
|
+
function Oa(e) {
|
|
4919
|
+
return e.includes("<head>") ? e.replace("<head>", "<head>" + Da) : e.includes("<HEAD>") ? e.replace("<HEAD>", "<HEAD>" + Da) : e.includes("<html>") ? e.replace("<html>", "<html><head>" + Da + "</head>") : e.includes("<HTML>") ? e.replace("<HTML>", "<HTML><head>" + Da + "</head>") : e.includes("<!DOCTYPE") || e.includes("<!doctype") ? e.replace(/(<!DOCTYPE[^>]*>|<!doctype[^>]*>)/i, "$1<head>" + Da + "</head>") : Da + e;
|
|
4920
|
+
}
|
|
4921
|
+
function ka(e) {
|
|
4991
4922
|
let { resourceResult: t, listingResource: n, cspMode: r, resourceUri: i } = e, a = (Array.isArray(t?.contents) ? t.contents : [])[0], o = "", s;
|
|
4992
4923
|
if (a && (s = a.mimeType, typeof a.text == "string" ? o = a.text : typeof a.blob == "string" && (o = atob(a.blob))), !o) throw Error("No HTML content in resource");
|
|
4993
4924
|
let c = n?._meta?.ui, l = a?._meta?.ui, u = c || l ? {
|
|
@@ -5005,7 +4936,7 @@ function La(e) {
|
|
|
5005
4936
|
mimeTypeWarning: h
|
|
5006
4937
|
};
|
|
5007
4938
|
}
|
|
5008
|
-
function
|
|
4939
|
+
function Aa(e, t) {
|
|
5009
4940
|
let { cspMode: n, permissions: r, widgetCsp: i } = t;
|
|
5010
4941
|
e.searchParams.set("v", JSON.stringify({
|
|
5011
4942
|
cspMode: n,
|
|
@@ -5013,77 +4944,92 @@ function Ra(e, t) {
|
|
|
5013
4944
|
widgetCsp: i
|
|
5014
4945
|
})), e.searchParams.set("csp_mode", n), r && Object.keys(r).length > 0 && e.searchParams.set("permissions", JSON.stringify(r)), i && Object.keys(i).length > 0 && e.searchParams.set("widget_csp", JSON.stringify(i));
|
|
5015
4946
|
}
|
|
5016
|
-
function
|
|
4947
|
+
function ja(e) {
|
|
5017
4948
|
let t = new URL("https://sandbox.invalid/");
|
|
5018
|
-
|
|
5019
|
-
let n =
|
|
4949
|
+
Aa(t, e);
|
|
4950
|
+
let n = Na(t.search);
|
|
5020
4951
|
return new URL(URL.createObjectURL(new Blob([n], { type: "text/html" })));
|
|
5021
4952
|
}
|
|
5022
|
-
var Ba = "<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <meta\n http-equiv=\"Content-Security-Policy\"\n content=\"default-src 'self'; img-src * data: blob: 'unsafe-inline'; media-src * blob: data:; font-src * blob: data:; script-src * 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data:; style-src * blob: data: 'unsafe-inline'; connect-src * data: blob: about:; frame-src * blob: data: http://localhost:* https://localhost:* http://127.0.0.1:* https://127.0.0.1:*;\"\n />\n <title>MCP Apps Sandbox Proxy</title>\n <style>\n html, body { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; }\n * { box-sizing: border-box; }\n iframe { display: block; background-color: transparent; border: 0px none transparent; padding: 0px; width: 100%; height: 100%; }\n </style>\n </head>\n <body>\n <script>\n function sanitizeDomain(domain) {\n if (typeof domain !== \"string\") return \"\";\n return domain.replace(/['\"<>;]/g, \"\").trim();\n }\n\n function buildAllowAttribute(permissions) {\n if (!permissions) return \"\";\n const allowList = [];\n if (permissions.camera) allowList.push(\"camera *\");\n if (permissions.microphone) allowList.push(\"microphone *\");\n if (permissions.geolocation) allowList.push(\"geolocation *\");\n if (permissions.clipboardWrite) allowList.push(\"clipboard-write *\");\n return allowList.join(\"; \");\n }\n\n function buildCSP(csp) {\n if (!csp) {\n return [\n \"default-src 'none'\",\n \"script-src 'unsafe-inline'\",\n \"style-src 'unsafe-inline'\",\n \"img-src data:\",\n \"font-src data:\",\n \"media-src data:\",\n \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"object-src 'none'\",\n \"base-uri 'none'\",\n ].join(\"; \");\n }\n\n const connectDomains = (csp.connectDomains || []).map(sanitizeDomain).filter(Boolean);\n const resourceDomains = (csp.resourceDomains || []).map(sanitizeDomain).filter(Boolean);\n const frameDomains = (csp.frameDomains || []).map(sanitizeDomain).filter(Boolean);\n const baseUriDomains = (csp.baseUriDomains || []).map(sanitizeDomain).filter(Boolean);\n const scriptDirectives = (csp.scriptDirectives || []).filter(function(d) { return typeof d === \"string\" && d.length > 0; });\n\n const connectSrc = connectDomains.length > 0 ? connectDomains.join(\" \") : \"'none'\";\n const resourceSrc = resourceDomains.length > 0 ? [\"data:\", \"blob:\", ...resourceDomains].join(\" \") : \"data: blob:\";\n const frameSrc = frameDomains.length > 0 ? frameDomains.join(\" \") : \"'none'\";\n const baseUri = baseUriDomains.length > 0 ? baseUriDomains.join(\" \") : \"'none'\";\n const scriptSrcParts = [\"'unsafe-inline'\", resourceSrc];\n if (scriptDirectives.length > 0) scriptSrcParts.push(scriptDirectives.join(\" \"));\n\n return [\n \"default-src 'none'\",\n \"script-src \" + scriptSrcParts.join(\" \"),\n \"style-src 'unsafe-inline' \" + resourceSrc,\n \"img-src \" + resourceSrc,\n \"font-src \" + resourceSrc,\n \"media-src \" + resourceSrc,\n \"connect-src \" + connectSrc,\n \"frame-src \" + frameSrc,\n \"object-src 'none'\",\n \"base-uri \" + baseUri,\n ].join(\"; \");\n }\n\n function buildViolationListenerScript() {\n return `<script>\ndocument.addEventListener('securitypolicyviolation', function(e) {\n var violation = {\n type: 'mcp-apps:csp-violation',\n directive: e.violatedDirective,\n blockedUri: e.blockedURI,\n sourceFile: e.sourceFile || null,\n lineNumber: e.lineNumber || null,\n columnNumber: e.columnNumber || null,\n effectiveDirective: e.effectiveDirective,\n originalPolicy: e.originalPolicy,\n disposition: e.disposition,\n timestamp: Date.now()\n };\n console.warn('[MCP Apps CSP Violation]', violation.directive, ':', violation.blockedUri);\n window.parent.postMessage(violation, '*');\n});\n\nfunction serializeConsoleArgs(args) {\n try {\n return Array.from(args || []).map(function(arg) {\n if (arg instanceof Error) {\n return {\n type: 'Error',\n message: arg.message,\n stack: arg.stack,\n name: arg.name,\n };\n }\n if (typeof arg === 'object' && arg !== null) {\n try {\n return JSON.parse(JSON.stringify(arg));\n } catch (e) {\n return String(arg);\n }\n }\n return arg;\n });\n } catch (e) {\n return [String(args)];\n }\n}\n\nfunction sendConsoleToParent(level, args) {\n try {\n window.parent.postMessage({\n type: 'iframe-console-log',\n level: level,\n args: serializeConsoleArgs(args),\n timestamp: new Date().toISOString(),\n url: window.location.href,\n }, '*');\n } catch (e) {}\n}\n\nvar originalConsoleError = console.error.bind(console);\nconsole.error = function() {\n var args = Array.from(arguments);\n originalConsoleError.apply(console, args);\n sendConsoleToParent('error', args);\n};\n\nwindow.addEventListener('error', function(event) {\n sendConsoleToParent('error', [{\n message: event.message,\n filename: event.filename,\n lineno: event.lineno,\n colno: event.colno,\n error: event.error ? {\n message: event.error.message,\n stack: event.error.stack,\n name: event.error.name,\n } : null,\n }]);\n});\n\nwindow.addEventListener('unhandledrejection', function(event) {\n sendConsoleToParent('error', [{\n message: 'Unhandled Promise Rejection',\n reason: event.reason ? String(event.reason) : 'Unknown',\n error: event.reason instanceof Error ? {\n message: event.reason.message,\n stack: event.reason.stack,\n name: event.reason.name,\n } : null,\n }]);\n});\n</` + `script>`;\n }\n\n function injectCSP(html, cspValue) {\n const cspMeta = '<meta http-equiv=\"Content-Security-Policy\" content=\"' + cspValue + '\">';\n const violationListener = buildViolationListenerScript();\n const injection = cspMeta + violationListener;\n\n if (html.includes(\"<head>\")) {\n return html.replace(\"<head>\", \"<head>\" + injection);\n } else if (html.includes(\"<HEAD>\")) {\n return html.replace(\"<HEAD>\", \"<HEAD>\" + injection);\n } else if (html.includes(\"<html>\")) {\n return html.replace(\"<html>\", \"<html><head>\" + injection + \"</head>\");\n } else if (html.includes(\"<HTML>\")) {\n return html.replace(\"<HTML>\", \"<HTML><head>\" + injection + \"</head>\");\n } else if (html.includes(\"<!DOCTYPE\") || html.includes(\"<!doctype\")) {\n return html.replace(/(<!DOCTYPE[^>]*>|<!doctype[^>]*>)/i, \"$1<head>\" + injection + \"</head>\");\n } else {\n return injection + html;\n }\n }\n\n // Query params from host (csp_mode, permissions, widget_csp). AppFrame only\n // sends { html, csp } in sandbox-resource-ready; we carry the rest on the URL.\n // Blob URLs cannot reliably carry search params, so the CDN shell injects\n // window.__SANDBOX_SEARCH__ via buildSandboxProxyBlobHtml.\n const query = new URLSearchParams(\n typeof window.__SANDBOX_SEARCH__ === \"string\"\n ? window.__SANDBOX_SEARCH__\n : location.search\n );\n const queryCspMode = query.get(\"csp_mode\") || \"permissive\";\n let queryPermissions = null;\n let queryWidgetCsp = null;\n try {\n const rawPerm = query.get(\"permissions\");\n if (rawPerm) queryPermissions = JSON.parse(rawPerm);\n } catch (e) {}\n try {\n const rawCsp = query.get(\"widget_csp\");\n if (rawCsp) queryWidgetCsp = JSON.parse(rawCsp);\n } catch (e) {}\n\n const inner = document.createElement(\"iframe\");\n inner.style = \"width:100%; height:100%; border:none;\";\n inner.setAttribute(\"sandbox\", \"allow-scripts allow-same-origin allow-forms\");\n document.body.appendChild(inner);\n\n window.addEventListener(\"message\", async (event) => {\n if (event.source === window.parent) {\n if (event.data && event.data.method === \"ui/notifications/sandbox-resource-ready\") {\n const params = event.data.params || {};\n const html = params.html;\n const sandbox = params.sandbox;\n // Prefer message csp when present; fall back to URL widget_csp\n const csp = params.csp != null ? params.csp : queryWidgetCsp;\n const permissions = params.permissions != null ? params.permissions : queryPermissions;\n const permissive =\n typeof params.permissive === \"boolean\"\n ? params.permissive\n : queryCspMode === \"permissive\";\n if (typeof sandbox === \"string\") {\n inner.setAttribute(\"sandbox\", sandbox);\n }\n const allowAttribute = buildAllowAttribute(permissions);\n if (allowAttribute) {\n inner.setAttribute(\"allow\", allowAttribute);\n }\n if (typeof html === \"string\") {\n if (permissive) {\n const permissiveCsp = [\n \"default-src * 'unsafe-inline' 'unsafe-eval' data: blob: filesystem: about:\",\n \"script-src * 'unsafe-inline' 'unsafe-eval' data: blob:\",\n \"style-src * 'unsafe-inline' data: blob:\",\n \"img-src * data: blob: https: http:\",\n \"media-src * data: blob: https: http:\",\n \"font-src * data: blob: https: http:\",\n \"connect-src * data: blob: https: http: ws: wss: about:\",\n \"frame-src * data: blob: https: http: about:\",\n \"object-src * data: blob:\",\n \"base-uri *\",\n \"form-action *\",\n ].join(\"; \");\n const processedHtml = injectCSP(html, permissiveCsp);\n inner.srcdoc = processedHtml;\n } else {\n const cspValue = buildCSP(csp);\n const processedHtml = injectCSP(html, cspValue);\n inner.srcdoc = processedHtml;\n }\n }\n } else {\n if (inner && inner.contentWindow) {\n inner.contentWindow.postMessage(event.data, \"*\");\n }\n }\n } else if (event.source === inner.contentWindow) {\n window.parent.postMessage(event.data, \"*\");\n }\n });\n\n window.parent.postMessage({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/sandbox-proxy-ready\",\n params: {},\n }, \"*\");\n <\/script>\n </body>\n</html>";
|
|
5023
|
-
function
|
|
4953
|
+
var Ma = "<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <meta\n http-equiv=\"Content-Security-Policy\"\n content=\"default-src 'self'; img-src * data: blob: 'unsafe-inline'; media-src * blob: data:; font-src * blob: data:; script-src * 'wasm-unsafe-eval' 'unsafe-inline' 'unsafe-eval' blob: data:; style-src * blob: data: 'unsafe-inline'; connect-src * data: blob: about:; frame-src * blob: data: http://localhost:* https://localhost:* http://127.0.0.1:* https://127.0.0.1:*;\"\n />\n <title>MCP Apps Sandbox Proxy</title>\n <style>\n html, body { margin: 0; padding: 0; height: 100%; width: 100%; overflow: hidden; }\n * { box-sizing: border-box; }\n iframe { display: block; background-color: transparent; border: 0px none transparent; padding: 0px; width: 100%; height: 100%; }\n </style>\n </head>\n <body>\n <script>\n function sanitizeDomain(domain) {\n if (typeof domain !== \"string\") return \"\";\n return domain.replace(/['\"<>;]/g, \"\").trim();\n }\n\n function buildAllowAttribute(permissions) {\n if (!permissions) return \"\";\n const allowList = [];\n if (permissions.camera) allowList.push(\"camera *\");\n if (permissions.microphone) allowList.push(\"microphone *\");\n if (permissions.geolocation) allowList.push(\"geolocation *\");\n if (permissions.clipboardWrite) allowList.push(\"clipboard-write *\");\n return allowList.join(\"; \");\n }\n\n function buildCSP(csp) {\n if (!csp) {\n return [\n \"default-src 'none'\",\n \"script-src 'unsafe-inline'\",\n \"style-src 'unsafe-inline'\",\n \"img-src data:\",\n \"font-src data:\",\n \"media-src data:\",\n \"connect-src 'none'\",\n \"frame-src 'none'\",\n \"object-src 'none'\",\n \"base-uri 'none'\",\n ].join(\"; \");\n }\n\n const connectDomains = (csp.connectDomains || []).map(sanitizeDomain).filter(Boolean);\n const resourceDomains = (csp.resourceDomains || []).map(sanitizeDomain).filter(Boolean);\n const frameDomains = (csp.frameDomains || []).map(sanitizeDomain).filter(Boolean);\n const baseUriDomains = (csp.baseUriDomains || []).map(sanitizeDomain).filter(Boolean);\n const scriptDirectives = (csp.scriptDirectives || []).filter(function(d) { return typeof d === \"string\" && d.length > 0; });\n\n const connectSrc = connectDomains.length > 0 ? connectDomains.join(\" \") : \"'none'\";\n const resourceSrc = resourceDomains.length > 0 ? [\"data:\", \"blob:\", ...resourceDomains].join(\" \") : \"data: blob:\";\n const frameSrc = frameDomains.length > 0 ? frameDomains.join(\" \") : \"'none'\";\n const baseUri = baseUriDomains.length > 0 ? baseUriDomains.join(\" \") : \"'none'\";\n const scriptSrcParts = [\"'unsafe-inline'\", resourceSrc];\n if (scriptDirectives.length > 0) scriptSrcParts.push(scriptDirectives.join(\" \"));\n\n return [\n \"default-src 'none'\",\n \"script-src \" + scriptSrcParts.join(\" \"),\n \"style-src 'unsafe-inline' \" + resourceSrc,\n \"img-src \" + resourceSrc,\n \"font-src \" + resourceSrc,\n \"media-src \" + resourceSrc,\n \"connect-src \" + connectSrc,\n \"frame-src \" + frameSrc,\n \"object-src 'none'\",\n \"base-uri \" + baseUri,\n ].join(\"; \");\n }\n\n function buildViolationListenerScript() {\n return `<script>\ndocument.addEventListener('securitypolicyviolation', function(e) {\n var violation = {\n type: 'mcp-apps:csp-violation',\n directive: e.violatedDirective,\n blockedUri: e.blockedURI,\n sourceFile: e.sourceFile || null,\n lineNumber: e.lineNumber || null,\n columnNumber: e.columnNumber || null,\n effectiveDirective: e.effectiveDirective,\n originalPolicy: e.originalPolicy,\n disposition: e.disposition,\n timestamp: Date.now()\n };\n console.warn('[MCP Apps CSP Violation]', violation.directive, ':', violation.blockedUri);\n window.parent.postMessage(violation, '*');\n});\n\nfunction serializeConsoleArgs(args) {\n try {\n return Array.from(args || []).map(function(arg) {\n if (arg instanceof Error) {\n return {\n type: 'Error',\n message: arg.message,\n stack: arg.stack,\n name: arg.name,\n };\n }\n if (typeof arg === 'object' && arg !== null) {\n try {\n return JSON.parse(JSON.stringify(arg));\n } catch (e) {\n return String(arg);\n }\n }\n return arg;\n });\n } catch (e) {\n return [String(args)];\n }\n}\n\nfunction sendConsoleToParent(level, args) {\n try {\n window.parent.postMessage({\n type: 'iframe-console-log',\n level: level,\n args: serializeConsoleArgs(args),\n timestamp: new Date().toISOString(),\n url: window.location.href,\n }, '*');\n } catch (e) {}\n}\n\nvar originalConsoleError = console.error.bind(console);\nconsole.error = function() {\n var args = Array.from(arguments);\n originalConsoleError.apply(console, args);\n sendConsoleToParent('error', args);\n};\n\nwindow.addEventListener('error', function(event) {\n sendConsoleToParent('error', [{\n message: event.message,\n filename: event.filename,\n lineno: event.lineno,\n colno: event.colno,\n error: event.error ? {\n message: event.error.message,\n stack: event.error.stack,\n name: event.error.name,\n } : null,\n }]);\n});\n\nwindow.addEventListener('unhandledrejection', function(event) {\n sendConsoleToParent('error', [{\n message: 'Unhandled Promise Rejection',\n reason: event.reason ? String(event.reason) : 'Unknown',\n error: event.reason instanceof Error ? {\n message: event.reason.message,\n stack: event.reason.stack,\n name: event.reason.name,\n } : null,\n }]);\n});\n</` + `script>`;\n }\n\n function injectCSP(html, cspValue) {\n const cspMeta = '<meta http-equiv=\"Content-Security-Policy\" content=\"' + cspValue + '\">';\n const violationListener = buildViolationListenerScript();\n const injection = cspMeta + violationListener;\n\n if (html.includes(\"<head>\")) {\n return html.replace(\"<head>\", \"<head>\" + injection);\n } else if (html.includes(\"<HEAD>\")) {\n return html.replace(\"<HEAD>\", \"<HEAD>\" + injection);\n } else if (html.includes(\"<html>\")) {\n return html.replace(\"<html>\", \"<html><head>\" + injection + \"</head>\");\n } else if (html.includes(\"<HTML>\")) {\n return html.replace(\"<HTML>\", \"<HTML><head>\" + injection + \"</head>\");\n } else if (html.includes(\"<!DOCTYPE\") || html.includes(\"<!doctype\")) {\n return html.replace(/(<!DOCTYPE[^>]*>|<!doctype[^>]*>)/i, \"$1<head>\" + injection + \"</head>\");\n } else {\n return injection + html;\n }\n }\n\n // Query params from host (csp_mode, permissions, widget_csp). AppFrame only\n // sends { html, csp } in sandbox-resource-ready; we carry the rest on the URL.\n // Blob URLs cannot reliably carry search params, so the CDN shell injects\n // window.__SANDBOX_SEARCH__ via buildSandboxProxyBlobHtml.\n const query = new URLSearchParams(\n typeof window.__SANDBOX_SEARCH__ === \"string\"\n ? window.__SANDBOX_SEARCH__\n : location.search\n );\n const queryCspMode = query.get(\"csp_mode\") || \"permissive\";\n let queryPermissions = null;\n let queryWidgetCsp = null;\n try {\n const rawPerm = query.get(\"permissions\");\n if (rawPerm) queryPermissions = JSON.parse(rawPerm);\n } catch (e) {}\n try {\n const rawCsp = query.get(\"widget_csp\");\n if (rawCsp) queryWidgetCsp = JSON.parse(rawCsp);\n } catch (e) {}\n\n const inner = document.createElement(\"iframe\");\n inner.style = \"width:100%; height:100%; border:none;\";\n inner.setAttribute(\"sandbox\", \"allow-scripts allow-same-origin allow-forms\");\n document.body.appendChild(inner);\n\n window.addEventListener(\"message\", async (event) => {\n if (event.source === window.parent) {\n if (event.data && event.data.method === \"ui/notifications/sandbox-resource-ready\") {\n const params = event.data.params || {};\n const html = params.html;\n const sandbox = params.sandbox;\n // Prefer message csp when present; fall back to URL widget_csp\n const csp = params.csp != null ? params.csp : queryWidgetCsp;\n const permissions = params.permissions != null ? params.permissions : queryPermissions;\n const permissive =\n typeof params.permissive === \"boolean\"\n ? params.permissive\n : queryCspMode === \"permissive\";\n if (typeof sandbox === \"string\") {\n inner.setAttribute(\"sandbox\", sandbox);\n }\n const allowAttribute = buildAllowAttribute(permissions);\n if (allowAttribute) {\n inner.setAttribute(\"allow\", allowAttribute);\n }\n if (typeof html === \"string\") {\n if (permissive) {\n const permissiveCsp = [\n \"default-src * 'unsafe-inline' 'unsafe-eval' data: blob: filesystem: about:\",\n \"script-src * 'unsafe-inline' 'unsafe-eval' data: blob:\",\n \"style-src * 'unsafe-inline' data: blob:\",\n \"img-src * data: blob: https: http:\",\n \"media-src * data: blob: https: http:\",\n \"font-src * data: blob: https: http:\",\n \"connect-src * data: blob: https: http: ws: wss: about:\",\n \"frame-src * data: blob: https: http: about:\",\n \"object-src * data: blob:\",\n \"base-uri *\",\n \"form-action *\",\n ].join(\"; \");\n const processedHtml = injectCSP(html, permissiveCsp);\n inner.srcdoc = processedHtml;\n } else {\n const cspValue = buildCSP(csp);\n const processedHtml = injectCSP(html, cspValue);\n inner.srcdoc = processedHtml;\n }\n }\n } else {\n if (inner && inner.contentWindow) {\n inner.contentWindow.postMessage(event.data, \"*\");\n }\n }\n } else if (event.source === inner.contentWindow) {\n window.parent.postMessage(event.data, \"*\");\n }\n });\n\n window.parent.postMessage({\n jsonrpc: \"2.0\",\n method: \"ui/notifications/sandbox-proxy-ready\",\n params: {},\n }, \"*\");\n <\/script>\n </body>\n</html>";
|
|
4954
|
+
function Na(e) {
|
|
5024
4955
|
let t = "<script>window.__SANDBOX_SEARCH__ = " + JSON.stringify(e).replace(/</g, "\\u003c") + ";<\/script>";
|
|
5025
|
-
return
|
|
4956
|
+
return Ma.replace("<body>", "<body>" + t);
|
|
5026
4957
|
}
|
|
5027
|
-
var
|
|
5028
|
-
"fixed top-4 left-1/2 -translate-x-1/2 z-[
|
|
4958
|
+
var Pa = "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", Fa = [
|
|
4959
|
+
"fixed top-4 left-1/2 -translate-x-1/2 z-[200]",
|
|
5029
4960
|
"rounded-3xl w-full min-w-[300px] h-[400px]",
|
|
5030
4961
|
"shadow-2xl border overflow-hidden",
|
|
5031
4962
|
"bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",
|
|
5032
4963
|
"flex flex-col"
|
|
5033
|
-
].join(" "),
|
|
5034
|
-
function
|
|
5035
|
-
(0,
|
|
4964
|
+
].join(" "), Ia = "data-mcp-widget-fullscreen", La = "data-mcp-widget-display-mode";
|
|
4965
|
+
function Ra(e) {
|
|
4966
|
+
(0, j.useEffect)(() => {
|
|
5036
4967
|
if (!(typeof document > "u")) {
|
|
5037
|
-
if (e === "pip" || e === "fullscreen") return document.documentElement.setAttribute(
|
|
5038
|
-
document.documentElement.removeAttribute(
|
|
4968
|
+
if (e === "pip" || e === "fullscreen") return document.documentElement.setAttribute(La, e), e === "fullscreen" ? document.documentElement.setAttribute(Ia, "") : document.documentElement.removeAttribute(Ia), () => {
|
|
4969
|
+
document.documentElement.removeAttribute(La), document.documentElement.removeAttribute(Ia);
|
|
5039
4970
|
};
|
|
5040
|
-
document.documentElement.removeAttribute(
|
|
4971
|
+
document.documentElement.removeAttribute(La), document.documentElement.removeAttribute(Ia);
|
|
5041
4972
|
}
|
|
5042
4973
|
}, [e]);
|
|
5043
4974
|
}
|
|
5044
|
-
function
|
|
4975
|
+
function za({ displayMode: e, setDisplayMode: t }) {
|
|
5045
4976
|
let n = e === "fullscreen", r = e === "pip";
|
|
5046
|
-
return
|
|
5047
|
-
handleDisplayModeChange: (0,
|
|
5048
|
-
fullscreenShellClassName: n ?
|
|
5049
|
-
pipShellClassName: r ?
|
|
4977
|
+
return Ra(e), {
|
|
4978
|
+
handleDisplayModeChange: (0, j.useCallback)((e) => t(e), [t]),
|
|
4979
|
+
fullscreenShellClassName: n ? Pa : void 0,
|
|
4980
|
+
pipShellClassName: r ? Fa : void 0,
|
|
5050
4981
|
isFullscreen: n,
|
|
5051
4982
|
isPip: r
|
|
5052
4983
|
};
|
|
5053
4984
|
}
|
|
5054
|
-
var
|
|
4985
|
+
var Ba = {
|
|
5055
4986
|
PIP_MAX_WIDTH: 700,
|
|
5056
|
-
DEFAULT_HEIGHT: 400
|
|
4987
|
+
DEFAULT_HEIGHT: 400,
|
|
4988
|
+
FULLSCREEN_HEADER_HEIGHT: 50
|
|
5057
4989
|
};
|
|
5058
|
-
function
|
|
4990
|
+
function Va(e) {
|
|
5059
4991
|
let t = e?.ui;
|
|
5060
4992
|
return t && typeof t == "object" && "resourceUri" in t && typeof t.resourceUri == "string" ? t.resourceUri : null;
|
|
5061
4993
|
}
|
|
5062
|
-
function
|
|
5063
|
-
return
|
|
4994
|
+
function Ha(e) {
|
|
4995
|
+
return Va(e) !== null;
|
|
5064
4996
|
}
|
|
5065
|
-
function
|
|
4997
|
+
function Ua(e) {
|
|
5066
4998
|
return e === er;
|
|
5067
4999
|
}
|
|
5068
|
-
var
|
|
5000
|
+
var Wa = {
|
|
5069
5001
|
name: "mcp-use-client",
|
|
5070
5002
|
version: "2.0.0"
|
|
5071
|
-
},
|
|
5003
|
+
}, Ga = 6e5, Ka = "ui/notifications/sandbox-proxy-ready", qa = {
|
|
5072
5004
|
openLinks: {},
|
|
5073
5005
|
serverTools: {},
|
|
5074
5006
|
serverResources: {},
|
|
5075
5007
|
logging: {},
|
|
5076
|
-
updateModelContext: { text: {} }
|
|
5008
|
+
updateModelContext: { text: {} },
|
|
5009
|
+
message: { text: {} }
|
|
5077
5010
|
};
|
|
5078
|
-
function
|
|
5011
|
+
function Ja() {
|
|
5012
|
+
return /* @__PURE__ */ j.createElement("svg", {
|
|
5013
|
+
width: "14",
|
|
5014
|
+
height: "14",
|
|
5015
|
+
viewBox: "0 0 24 24",
|
|
5016
|
+
fill: "none",
|
|
5017
|
+
stroke: "currentColor",
|
|
5018
|
+
strokeWidth: "2",
|
|
5019
|
+
strokeLinecap: "round",
|
|
5020
|
+
strokeLinejoin: "round",
|
|
5021
|
+
"aria-hidden": !0
|
|
5022
|
+
}, /* @__PURE__ */ j.createElement("path", { d: "M18 6 6 18" }), /* @__PURE__ */ j.createElement("path", { d: "m6 6 12 12" }));
|
|
5023
|
+
}
|
|
5024
|
+
function Ya(e) {
|
|
5079
5025
|
return new Promise((t) => {
|
|
5080
5026
|
let n = (r) => {
|
|
5081
|
-
r.source === e.contentWindow && r.data?.method ===
|
|
5027
|
+
r.source === e.contentWindow && r.data?.method === Ka && (window.removeEventListener("message", n), t());
|
|
5082
5028
|
};
|
|
5083
5029
|
window.addEventListener("message", n);
|
|
5084
5030
|
});
|
|
5085
5031
|
}
|
|
5086
|
-
function
|
|
5032
|
+
function Xa(e) {
|
|
5087
5033
|
let t = e.oninitialized;
|
|
5088
5034
|
return new Promise((n) => {
|
|
5089
5035
|
e.oninitialized = (...r) => {
|
|
@@ -5091,67 +5037,76 @@ function ro(e) {
|
|
|
5091
5037
|
};
|
|
5092
5038
|
});
|
|
5093
5039
|
}
|
|
5094
|
-
function
|
|
5095
|
-
let n =
|
|
5040
|
+
function Za(e, t) {
|
|
5041
|
+
let n = Ea(t);
|
|
5096
5042
|
return Object.keys(n).length > 0 ? {
|
|
5097
5043
|
...typeof e == "object" && e ? e : {},
|
|
5098
5044
|
structuredContent: n
|
|
5099
5045
|
} : e ?? null;
|
|
5100
5046
|
}
|
|
5101
|
-
function
|
|
5102
|
-
let
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5047
|
+
function Qa({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInput: i, toolOutput: a, partialToolInput: o, customProps: s, cancelled: c, hostInfo: l = Wa, 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 = Ga, mockOpenAiFileApis: w = !1, onInlineHeightChange: re, fullscreenHeader: T, renderFullscreenClose: E, className: D, testId: ie = "mcp-app-frame", invoking: O, invoked: k }) {
|
|
5048
|
+
let ae = (0, j.useRef)(null), A = (0, j.useRef)(null), oe = (0, j.useRef)(null), se = (0, j.useRef)(/* @__PURE__ */ new Map()), M = (0, j.useRef)(t.kind === "live" ? t.connection : null), [N, ce] = (0, j.useState)(null), [P, le] = (0, j.useState)(null), [ue, de] = (0, j.useState)(null), [F, fe] = (0, j.useState)(0), [I, L] = (0, j.useState)(!0), [R, z] = (0, j.useState)(Ba.DEFAULT_HEIGHT), [pe, me] = (0, j.useState)("inline"), he = p ?? pe, ge = (0, j.useMemo)(() => !u || u.displayMode === he ? u : {
|
|
5049
|
+
...u,
|
|
5050
|
+
displayMode: he
|
|
5051
|
+
}, [u, he]), _e = (0, j.useRef)(ge);
|
|
5052
|
+
_e.current = ge;
|
|
5053
|
+
let ve = (0, j.useRef)(_);
|
|
5054
|
+
ve.current = _;
|
|
5055
|
+
let ye = (0, j.useRef)(i);
|
|
5056
|
+
ye.current = i;
|
|
5057
|
+
let be = (0, j.useRef)(o);
|
|
5058
|
+
be.current = o;
|
|
5059
|
+
let xe = (0, j.useRef)(a);
|
|
5060
|
+
xe.current = a;
|
|
5061
|
+
let B = (0, j.useRef)(s);
|
|
5062
|
+
B.current = s;
|
|
5063
|
+
let Se = (0, j.useRef)(S);
|
|
5064
|
+
Se.current = S;
|
|
5065
|
+
let Ce = (0, j.useRef)(v);
|
|
5066
|
+
Ce.current = v;
|
|
5067
|
+
let we = (0, j.useRef)(ee);
|
|
5068
|
+
we.current = ee;
|
|
5069
|
+
let Te = (0, j.useRef)(b);
|
|
5070
|
+
Te.current = b;
|
|
5071
|
+
let Ee = (0, j.useRef)(x);
|
|
5072
|
+
Ee.current = x;
|
|
5073
|
+
let De = (0, j.useRef)(te);
|
|
5074
|
+
De.current = te;
|
|
5075
|
+
let V = (0, j.useRef)(y);
|
|
5076
|
+
V.current = y;
|
|
5077
|
+
let Oe = (0, j.useRef)(re);
|
|
5078
|
+
Oe.current = re;
|
|
5079
|
+
let ke = (0, j.useRef)(n);
|
|
5080
|
+
ke.current = n;
|
|
5081
|
+
let Ae = (0, j.useRef)(f);
|
|
5082
|
+
Ae.current = f;
|
|
5083
|
+
let je = (0, j.useRef)(w);
|
|
5084
|
+
je.current = w;
|
|
5085
|
+
let Me = (0, j.useCallback)((e) => {
|
|
5086
|
+
let t = ke.current;
|
|
5087
|
+
return t ? typeof t == "function" ? t(e) : t : ja({
|
|
5088
|
+
cspMode: Ae.current,
|
|
5134
5089
|
permissions: e.permissions,
|
|
5135
5090
|
widgetCsp: e.declaredCsp
|
|
5136
5091
|
});
|
|
5137
|
-
}, []), { handleDisplayModeChange:
|
|
5138
|
-
containerRef:
|
|
5139
|
-
displayMode:
|
|
5140
|
-
setDisplayMode: (0,
|
|
5141
|
-
m ? m(e) :
|
|
5092
|
+
}, []), { handleDisplayModeChange: Ne, fullscreenShellClassName: Pe, pipShellClassName: Fe, isFullscreen: H, isPip: Ie } = za({
|
|
5093
|
+
containerRef: oe,
|
|
5094
|
+
displayMode: he,
|
|
5095
|
+
setDisplayMode: (0, j.useCallback)((e) => {
|
|
5096
|
+
m ? m(e) : me(e);
|
|
5142
5097
|
}, [m])
|
|
5143
|
-
}),
|
|
5144
|
-
|
|
5145
|
-
let
|
|
5146
|
-
|
|
5147
|
-
let
|
|
5148
|
-
t.kind === "live" && (
|
|
5098
|
+
}), Le = (0, j.useRef)(Ne);
|
|
5099
|
+
Le.current = Ne;
|
|
5100
|
+
let U = (0, j.useRef)(he);
|
|
5101
|
+
U.current = he;
|
|
5102
|
+
let Re = t.kind === "live" ? t.resourceUri : void 0, W = t.kind === "preloaded" ? t.html : void 0;
|
|
5103
|
+
t.kind === "live" && (M.current = t.connection), (0, j.useEffect)(() => {
|
|
5149
5104
|
let e = !1;
|
|
5150
|
-
|
|
5105
|
+
V.current?.({ status: "resolving" });
|
|
5151
5106
|
let n = (e) => {
|
|
5152
|
-
|
|
5153
|
-
let t =
|
|
5154
|
-
|
|
5107
|
+
ce(e), V.current?.({ status: "sandbox-loading" });
|
|
5108
|
+
let t = Me(e);
|
|
5109
|
+
le((e) => e?.href === t.href ? e : t), Se.current?.(e);
|
|
5155
5110
|
};
|
|
5156
5111
|
if (t.kind === "preloaded") {
|
|
5157
5112
|
n({
|
|
@@ -5167,11 +5122,11 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5167
5122
|
return;
|
|
5168
5123
|
}
|
|
5169
5124
|
let { connection: r, resourceUri: i } = t;
|
|
5170
|
-
return
|
|
5125
|
+
return M.current = r, (async () => {
|
|
5171
5126
|
try {
|
|
5172
5127
|
let t = await r.readResource(i);
|
|
5173
5128
|
if (e) return;
|
|
5174
|
-
let a = r.resources?.find((e) => e.uri === i), o =
|
|
5129
|
+
let a = r.resources?.find((e) => e.uri === i), o = ka({
|
|
5175
5130
|
resourceResult: t,
|
|
5176
5131
|
listingResource: a,
|
|
5177
5132
|
cspMode: f,
|
|
@@ -5179,7 +5134,7 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5179
5134
|
});
|
|
5180
5135
|
if (!o.mimeTypeValid) {
|
|
5181
5136
|
let e = o.mimeTypeWarning || "Invalid MIME type - SEP-1865 requires \"text/html;profile=mcp-app\"";
|
|
5182
|
-
|
|
5137
|
+
de(e), V.current?.({
|
|
5183
5138
|
status: "error",
|
|
5184
5139
|
error: e
|
|
5185
5140
|
});
|
|
@@ -5188,7 +5143,7 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5188
5143
|
n(o);
|
|
5189
5144
|
} catch (t) {
|
|
5190
5145
|
if (e) return;
|
|
5191
|
-
|
|
5146
|
+
de(t instanceof Error ? t.message : "Failed to prepare view"), V.current?.({
|
|
5192
5147
|
status: "error",
|
|
5193
5148
|
error: t instanceof Error ? t.message : "Failed to prepare view"
|
|
5194
5149
|
});
|
|
@@ -5198,30 +5153,35 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5198
5153
|
};
|
|
5199
5154
|
}, [
|
|
5200
5155
|
t.kind,
|
|
5201
|
-
|
|
5202
|
-
|
|
5156
|
+
Re,
|
|
5157
|
+
W,
|
|
5203
5158
|
f,
|
|
5204
|
-
|
|
5205
|
-
]), (0,
|
|
5206
|
-
let e =
|
|
5207
|
-
|
|
5208
|
-
|
|
5159
|
+
Me
|
|
5160
|
+
]), (0, j.useEffect)(() => {
|
|
5161
|
+
let e = P;
|
|
5162
|
+
if (!e || e.protocol !== "blob:") return;
|
|
5163
|
+
let t = se.current.get(e.href);
|
|
5164
|
+
return t && (clearTimeout(t), se.current.delete(e.href)), () => {
|
|
5165
|
+
let t = setTimeout(() => {
|
|
5166
|
+
URL.revokeObjectURL(e.href), se.current.delete(e.href);
|
|
5167
|
+
}, 1e3);
|
|
5168
|
+
se.current.set(e.href, t);
|
|
5209
5169
|
};
|
|
5210
|
-
}, [
|
|
5211
|
-
let
|
|
5170
|
+
}, [P]);
|
|
5171
|
+
let ze = P?.protocol === "blob:", G = !P || ze ? null : (() => {
|
|
5212
5172
|
try {
|
|
5213
|
-
return
|
|
5173
|
+
return P.origin;
|
|
5214
5174
|
} catch {
|
|
5215
5175
|
return null;
|
|
5216
5176
|
}
|
|
5217
5177
|
})();
|
|
5218
|
-
(0,
|
|
5219
|
-
if (!
|
|
5178
|
+
(0, j.useEffect)(() => {
|
|
5179
|
+
if (!G && !ze) return;
|
|
5220
5180
|
let e = (e) => {
|
|
5221
|
-
let t =
|
|
5222
|
-
if (t?.contentWindow && e.source === t.contentWindow && !(!
|
|
5181
|
+
let t = ae.current;
|
|
5182
|
+
if (t?.contentWindow && e.source === t.contentWindow && !(!ze && e.origin !== G && G !== "*")) {
|
|
5223
5183
|
if (e.data?.type === "mcp-apps:csp-violation") {
|
|
5224
|
-
|
|
5184
|
+
Ee.current?.({
|
|
5225
5185
|
directive: e.data.directive,
|
|
5226
5186
|
effectiveDirective: e.data.effectiveDirective,
|
|
5227
5187
|
blockedUri: e.data.blockedUri,
|
|
@@ -5233,33 +5193,38 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5233
5193
|
});
|
|
5234
5194
|
return;
|
|
5235
5195
|
}
|
|
5236
|
-
e.data?.type === "iframe-console-log" &&
|
|
5196
|
+
e.data?.type === "iframe-console-log" && we.current && we.current({
|
|
5237
5197
|
level: e.data.level ?? "log",
|
|
5238
5198
|
data: e.data.args
|
|
5239
5199
|
});
|
|
5240
5200
|
}
|
|
5241
5201
|
};
|
|
5242
5202
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
5243
|
-
}, [
|
|
5244
|
-
if (!
|
|
5245
|
-
let t =
|
|
5203
|
+
}, [G, ze]), (0, j.useEffect)(() => {
|
|
5204
|
+
if (!N || !P) return;
|
|
5205
|
+
let t = ae.current;
|
|
5246
5206
|
if (!t) return;
|
|
5247
5207
|
let n = !1, r = null;
|
|
5248
5208
|
return (async () => {
|
|
5249
5209
|
try {
|
|
5250
|
-
|
|
5251
|
-
let i = tr(
|
|
5210
|
+
V.current?.({ status: "connecting" }), t.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
|
|
5211
|
+
let i = tr(N.permissions);
|
|
5252
5212
|
i && t.setAttribute("allow", i);
|
|
5253
|
-
let a =
|
|
5254
|
-
if (
|
|
5213
|
+
let a = Ya(t);
|
|
5214
|
+
if (P.protocol === "blob:") {
|
|
5215
|
+
let e = await (await fetch(P.href)).text();
|
|
5216
|
+
if (n) return;
|
|
5217
|
+
t.srcdoc = e;
|
|
5218
|
+
} else t.src = P.href;
|
|
5219
|
+
if (await a, n) return;
|
|
5255
5220
|
r = new rr(null, l, {
|
|
5256
|
-
...d ??
|
|
5221
|
+
...d ?? qa,
|
|
5257
5222
|
sandbox: {
|
|
5258
|
-
csp: f === "permissive" ? void 0 :
|
|
5259
|
-
permissions:
|
|
5223
|
+
csp: f === "permissive" ? void 0 : N.csp,
|
|
5224
|
+
permissions: N.permissions
|
|
5260
5225
|
}
|
|
5261
|
-
}, { hostContext:
|
|
5262
|
-
let n =
|
|
5226
|
+
}, { hostContext: _e.current }), r.onmessage = async ({ content: e }) => (e.length > 0 && ve.current && ve.current(e), {}), r.onopenlink = async ({ url: e }) => (e && window.open(e, "_blank", "noopener,noreferrer"), {}), r.oncalltool = (async ({ name: e, arguments: t }) => {
|
|
5227
|
+
let n = M.current;
|
|
5263
5228
|
if (!n) throw Error("Server connection not available");
|
|
5264
5229
|
try {
|
|
5265
5230
|
return await n.callTool(e, t || {}, {
|
|
@@ -5270,47 +5235,51 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5270
5235
|
throw r?.sendToolCancelled({ reason: e instanceof Error ? e.message : String(e) }), e;
|
|
5271
5236
|
}
|
|
5272
5237
|
}), r.onreadresource = (async ({ uri: e }) => {
|
|
5273
|
-
let t =
|
|
5238
|
+
let t = M.current;
|
|
5274
5239
|
if (!t) throw Error("Server connection not available");
|
|
5275
5240
|
return await t.readResource(e);
|
|
5276
5241
|
}), r.onlistresources = (async () => {
|
|
5277
|
-
let e =
|
|
5242
|
+
let e = M.current;
|
|
5278
5243
|
if (!e) throw Error("Server connection not available");
|
|
5279
5244
|
return { resources: [...e.resources ?? []] };
|
|
5280
5245
|
}), r.onrequestdisplaymode = async ({ mode: e }) => {
|
|
5281
|
-
let t = e ?? "inline", n = (
|
|
5246
|
+
let t = e ?? "inline", n = (_e.current?.availableDisplayModes ?? [
|
|
5282
5247
|
"inline",
|
|
5283
5248
|
"pip",
|
|
5284
5249
|
"fullscreen"
|
|
5285
|
-
]).includes(t) ? t :
|
|
5286
|
-
return await
|
|
5287
|
-
}, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (
|
|
5250
|
+
]).includes(t) ? t : U.current;
|
|
5251
|
+
return await Le.current(n), { mode: n };
|
|
5252
|
+
}, r.onupdatemodelcontext = async ({ content: e, structuredContent: t }) => (Ce.current?.({
|
|
5288
5253
|
content: e,
|
|
5289
5254
|
structuredContent: t
|
|
5290
|
-
}), {}), r.onloggingmessage = async ({ level: e, data: t }) => (
|
|
5255
|
+
}), {}), r.onloggingmessage = async ({ level: e, data: t }) => (we.current?.({
|
|
5291
5256
|
level: e,
|
|
5292
5257
|
data: t
|
|
5293
5258
|
}), {}), r.onsizechange = async ({ height: e }) => {
|
|
5294
|
-
|
|
5259
|
+
U.current === "inline" && e !== void 0 && (z(e), Oe.current?.(e));
|
|
5295
5260
|
};
|
|
5296
|
-
let o =
|
|
5261
|
+
let o = Xa(r), s = new $n(t.contentWindow, t.contentWindow);
|
|
5297
5262
|
if (C && (s = C(s, e)), await r.connect(s), n || (await r.sendSandboxResourceReady({
|
|
5298
|
-
html:
|
|
5299
|
-
csp:
|
|
5300
|
-
permissions:
|
|
5263
|
+
html: je.current ? Oa(N.html) : N.html,
|
|
5264
|
+
csp: N.csp,
|
|
5265
|
+
permissions: N.permissions
|
|
5301
5266
|
}), await o, n)) return;
|
|
5302
|
-
|
|
5303
|
-
let c =
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5267
|
+
A.current = r, fe((e) => e + 1), V.current?.({ status: "initialized" });
|
|
5268
|
+
let c = be.current;
|
|
5269
|
+
if (c) r.sendToolInputPartial({ arguments: c });
|
|
5270
|
+
else {
|
|
5271
|
+
let e = {
|
|
5272
|
+
...ye.current,
|
|
5273
|
+
...Ea(B.current)
|
|
5274
|
+
};
|
|
5275
|
+
r.sendToolInput({ arguments: e });
|
|
5276
|
+
}
|
|
5277
|
+
let u = Za(xe.current, B.current);
|
|
5278
|
+
u && r.sendToolResult(u), V.current?.({ status: "ready" });
|
|
5310
5279
|
} catch (e) {
|
|
5311
5280
|
if (!n) {
|
|
5312
5281
|
let t = e instanceof Error ? e.message : "Failed to connect view";
|
|
5313
|
-
|
|
5282
|
+
de(t), Te.current?.(t), V.current?.({
|
|
5314
5283
|
status: "error",
|
|
5315
5284
|
error: t
|
|
5316
5285
|
});
|
|
@@ -5319,99 +5288,132 @@ function ao({ viewId: e, source: t, sandboxUrl: n, toolName: r = "view", toolInp
|
|
|
5319
5288
|
})(), () => {
|
|
5320
5289
|
n = !0;
|
|
5321
5290
|
let e = r;
|
|
5322
|
-
|
|
5291
|
+
A.current = null, e && (V.current?.({ status: "tearing-down" }), (async () => {
|
|
5323
5292
|
try {
|
|
5324
5293
|
await Promise.race([e.teardownResource({}), new Promise((e, t) => setTimeout(() => t(/* @__PURE__ */ Error("teardown timeout")), 2e3))]);
|
|
5325
5294
|
} catch {} finally {
|
|
5326
|
-
e.close().catch(() => {}),
|
|
5295
|
+
e.close().catch(() => {}), V.current?.({ status: "closed" });
|
|
5327
5296
|
}
|
|
5328
5297
|
})());
|
|
5329
5298
|
};
|
|
5330
5299
|
}, [
|
|
5331
|
-
j,
|
|
5332
5300
|
N,
|
|
5301
|
+
P,
|
|
5333
5302
|
l,
|
|
5334
5303
|
d,
|
|
5335
5304
|
f,
|
|
5336
5305
|
e,
|
|
5337
5306
|
C,
|
|
5338
|
-
ne
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5307
|
+
ne,
|
|
5308
|
+
w
|
|
5309
|
+
]), (0, j.useEffect)(() => {
|
|
5310
|
+
let e = A.current;
|
|
5311
|
+
!e || F === 0 || !ge || e.setHostContext(ge);
|
|
5312
|
+
}, [ge, F]), (0, j.useEffect)(() => {
|
|
5313
|
+
let e = A.current;
|
|
5314
|
+
!e || F === 0 || !o || e.sendToolInputPartial({ arguments: o });
|
|
5315
|
+
}, [F, o]), (0, j.useEffect)(() => {
|
|
5316
|
+
let e = A.current;
|
|
5317
|
+
if (!e || F === 0 || o) return;
|
|
5348
5318
|
let t = {
|
|
5349
5319
|
...i,
|
|
5350
|
-
...
|
|
5320
|
+
...Ea(s)
|
|
5351
5321
|
};
|
|
5352
5322
|
e.sendToolInput({ arguments: t });
|
|
5353
5323
|
}, [
|
|
5354
|
-
|
|
5324
|
+
F,
|
|
5355
5325
|
i,
|
|
5326
|
+
o,
|
|
5356
5327
|
s
|
|
5357
|
-
]), (0,
|
|
5358
|
-
let e =
|
|
5359
|
-
if (!e ||
|
|
5360
|
-
let t =
|
|
5328
|
+
]), (0, j.useEffect)(() => {
|
|
5329
|
+
let e = A.current;
|
|
5330
|
+
if (!e || F === 0) return;
|
|
5331
|
+
let t = Za(a, s);
|
|
5361
5332
|
t && e.sendToolResult(t);
|
|
5362
5333
|
}, [
|
|
5363
|
-
|
|
5334
|
+
F,
|
|
5364
5335
|
a,
|
|
5365
5336
|
s
|
|
5366
|
-
]), (0,
|
|
5367
|
-
let e =
|
|
5368
|
-
!e ||
|
|
5369
|
-
}, [c,
|
|
5370
|
-
let
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
}, [
|
|
5374
|
-
if (
|
|
5375
|
-
let e = setTimeout(() =>
|
|
5337
|
+
]), (0, j.useEffect)(() => {
|
|
5338
|
+
let e = A.current;
|
|
5339
|
+
!e || F === 0 || !c || e.sendToolCancelled({ reason: "Cancelled by user" });
|
|
5340
|
+
}, [c, F]);
|
|
5341
|
+
let K = (0, j.useRef)(!1);
|
|
5342
|
+
(0, j.useEffect)(() => {
|
|
5343
|
+
K.current || F === 0 || (K.current = !0, De.current?.());
|
|
5344
|
+
}, [F]), (0, j.useEffect)(() => {
|
|
5345
|
+
if (F === 0 || !I) return;
|
|
5346
|
+
let e = setTimeout(() => L(!1), 300);
|
|
5376
5347
|
return () => clearTimeout(e);
|
|
5377
|
-
}, [
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5348
|
+
}, [F, I]);
|
|
5349
|
+
let Be = N !== null && N.prefersBorder && he !== "fullscreen";
|
|
5350
|
+
if (ue) return /* @__PURE__ */ j.createElement("div", { className: D }, /* @__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: ", ue)));
|
|
5351
|
+
if (!N) return /* @__PURE__ */ j.createElement("div", { className: D }, /* @__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…")));
|
|
5352
|
+
let Ve = Pe ?? Fe ?? "flex group flex-1 items-center justify-center", He = {
|
|
5353
|
+
height: H || Ie ? "100%" : `${R}px`,
|
|
5381
5354
|
width: "100%",
|
|
5382
|
-
maxWidth:
|
|
5383
|
-
transition:
|
|
5384
|
-
},
|
|
5385
|
-
ref:
|
|
5386
|
-
className:
|
|
5387
|
-
style:
|
|
5388
|
-
height:
|
|
5389
|
-
maxWidth:
|
|
5355
|
+
maxWidth: he === "inline" ? `${h}px` : "100%",
|
|
5356
|
+
transition: H || Ie ? void 0 : "height 300ms ease-out"
|
|
5357
|
+
}, Ue = /* @__PURE__ */ j.createElement("div", {
|
|
5358
|
+
ref: oe,
|
|
5359
|
+
className: H ? `${Ve} flex flex-col` : Ve,
|
|
5360
|
+
style: Ie ? {
|
|
5361
|
+
height: Ba.DEFAULT_HEIGHT,
|
|
5362
|
+
maxWidth: Ba.PIP_MAX_WIDTH,
|
|
5390
5363
|
zIndex: 100
|
|
5391
|
-
} :
|
|
5392
|
-
},
|
|
5364
|
+
} : H ? { zIndex: 100 } : void 0
|
|
5365
|
+
}, H && /* @__PURE__ */ j.createElement("header", {
|
|
5366
|
+
className: "grid shrink-0 items-center border-b border-zinc-200 bg-background px-3 dark:border-zinc-700",
|
|
5367
|
+
style: {
|
|
5368
|
+
height: Ba.FULLSCREEN_HEADER_HEIGHT,
|
|
5369
|
+
gridTemplateColumns: "auto 1fr auto"
|
|
5370
|
+
}
|
|
5371
|
+
}, E ? E({
|
|
5372
|
+
onClick: () => void Ne("inline"),
|
|
5373
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
5374
|
+
"aria-label": "Exit fullscreen"
|
|
5375
|
+
}) : /* @__PURE__ */ j.createElement("button", {
|
|
5376
|
+
type: "button",
|
|
5377
|
+
"data-testid": "debugger-exit-fullscreen-button",
|
|
5378
|
+
"aria-label": "Exit fullscreen",
|
|
5379
|
+
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",
|
|
5380
|
+
onClick: () => void Ne("inline")
|
|
5381
|
+
}, /* @__PURE__ */ j.createElement(Ja, null)), /* @__PURE__ */ j.createElement("div", { className: "flex min-w-0 items-center justify-center gap-2 px-2" }, T?.iconUrl ? /* @__PURE__ */ j.createElement("img", {
|
|
5382
|
+
src: T.iconUrl,
|
|
5383
|
+
alt: "",
|
|
5384
|
+
className: "size-6 shrink-0 rounded-md object-contain"
|
|
5385
|
+
}) : null, /* @__PURE__ */ j.createElement("span", { className: "truncate text-sm font-medium text-foreground" }, T?.title ?? r)), /* @__PURE__ */ j.createElement("div", {
|
|
5386
|
+
className: "size-8 shrink-0",
|
|
5387
|
+
"aria-hidden": !0
|
|
5388
|
+
})), Ie && (E ? /* @__PURE__ */ j.createElement("div", {
|
|
5389
|
+
className: "absolute right-3 top-3",
|
|
5390
|
+
style: { zIndex: 110 }
|
|
5391
|
+
}, E({
|
|
5392
|
+
onClick: () => void Ne("inline"),
|
|
5393
|
+
"data-testid": "debugger-exit-pip-button",
|
|
5394
|
+
"aria-label": "Exit picture-in-picture"
|
|
5395
|
+
})) : /* @__PURE__ */ j.createElement("button", {
|
|
5393
5396
|
type: "button",
|
|
5394
|
-
"data-testid":
|
|
5395
|
-
"aria-label":
|
|
5396
|
-
className: "absolute right-3 top-3 z-[110] flex size-8 items-center justify-center rounded-full border border-border bg-background/90 text-
|
|
5397
|
+
"data-testid": "debugger-exit-pip-button",
|
|
5398
|
+
"aria-label": "Exit picture-in-picture",
|
|
5399
|
+
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",
|
|
5397
5400
|
style: { zIndex: 110 },
|
|
5398
|
-
onClick: () => void
|
|
5399
|
-
},
|
|
5400
|
-
"data-testid":
|
|
5401
|
+
onClick: () => void Ne("inline")
|
|
5402
|
+
}, /* @__PURE__ */ j.createElement(Ja, null))), /* @__PURE__ */ j.createElement("div", { className: H ? "relative flex min-h-0 w-full flex-1 flex-col" : Ie ? "relative w-full h-full min-h-0 flex flex-1 flex-col" : "relative w-full flex flex-1 justify-center items-center" }, I && /* @__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…")), !Ie && !H && (O || k) && /* @__PURE__ */ j.createElement("div", { className: "absolute -top-8 left-2 z-10 whitespace-nowrap pointer-events-none text-xs text-muted-foreground" }, O && !a ? O : k), /* @__PURE__ */ j.createElement("div", {
|
|
5403
|
+
"data-testid": ie,
|
|
5401
5404
|
"data-mcp-app-tool": r,
|
|
5402
|
-
className:
|
|
5403
|
-
style:
|
|
5404
|
-
}, /* @__PURE__ */
|
|
5405
|
-
ref:
|
|
5405
|
+
className: he === "fullscreen" ? "w-full h-full overflow-hidden" : "w-full overflow-hidden",
|
|
5406
|
+
style: He
|
|
5407
|
+
}, /* @__PURE__ */ j.createElement("iframe", {
|
|
5408
|
+
ref: ae,
|
|
5406
5409
|
title: `MCP App: ${r}`,
|
|
5407
|
-
className: "w-full h-full border-
|
|
5408
|
-
style: { border: j.prefersBorder && z !== "fullscreen" ? void 0 : "none" }
|
|
5410
|
+
className: Be ? "w-full h-full bg-transparent border border-border rounded-xl" : "w-full h-full bg-transparent border-0"
|
|
5409
5411
|
}))));
|
|
5410
|
-
return /* @__PURE__ */
|
|
5412
|
+
return /* @__PURE__ */ j.createElement("div", { className: D }, Ue);
|
|
5411
5413
|
}
|
|
5412
|
-
function
|
|
5413
|
-
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.className !== t.className || e.onReady !== t.onReady || e.onLifecycleChange !== t.onLifecycleChange);
|
|
5414
|
+
function $a(e, t) {
|
|
5415
|
+
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);
|
|
5414
5416
|
}
|
|
5415
|
-
var
|
|
5417
|
+
var eo = (0, j.memo)(Qa, $a);
|
|
5416
5418
|
//#endregion
|
|
5417
|
-
export { _r as a,
|
|
5419
|
+
export { _r as a, Ha as c, wa as d, yr as i, fa as l, Ca as n, Va as o, eo as r, Ua as s, Ta as t, vr as u };
|