@mcp-use/inspector 12.0.4-canary.1 → 20.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -6
- package/dist/cdn/AnimatePresence-B4HhIdgq.js +393 -0
- package/dist/cdn/ChatTab-5ya_YTFV.js +13218 -0
- package/dist/cdn/CheckboxIndicator-BF2cKfbA.js +251 -0
- package/dist/cdn/ConnectionSettingsForm-iwNW86ZU.js +873 -0
- package/dist/cdn/ConnectionSettingsTab-CeK83dxn.js +145 -0
- package/dist/cdn/ElicitationTab-upPXq2q7.js +654 -0
- package/dist/cdn/FormContext-Cl51-7O7.js +135 -0
- package/dist/cdn/InspectorContext-DzXtgyTx.js +143 -0
- package/dist/cdn/JSONDisplay-D3RcyO9z.js +324 -0
- package/dist/cdn/ListTabHeader-8lULn-90.js +88 -0
- package/dist/cdn/ManufactOAuthCallback-DEM8mhWD.js +31 -0
- package/dist/cdn/NotificationsTab-CWopTIzT.js +290 -0
- package/dist/cdn/OAuthCallback-BxuOVgdb.js +58 -0
- package/dist/cdn/PromptsTab-Cspfnl6n.js +4400 -0
- package/dist/cdn/ResourcesTab-BczUMFil.js +584 -0
- package/dist/cdn/SamplingTab-6u5s845G.js +658 -0
- package/dist/cdn/ServerMetadataTab-DS0eiyyD.js +244 -0
- package/dist/cdn/StatusIcon-BGXOEU2u.js +66 -0
- package/dist/cdn/ToolsTab-CUhwP4rZ.js +2067 -0
- package/dist/cdn/ViewPreview-CxJc1Kht.js +237 -0
- package/dist/cdn/WidgetDebugContext-D4usL_MA.js +324 -0
- package/dist/cdn/WidgetWrapper-BJJtLqMb.js +2211 -0
- package/dist/cdn/apple-touch-icon.png +0 -0
- package/dist/cdn/basePath-B8HuhIMu.js +25 -0
- package/dist/cdn/bell-CGjAO_0s.js +10 -0
- package/dist/cdn/browser-CbQIH4w2.js +42 -0
- package/dist/cdn/brush-B_mKhyxG.js +17 -0
- package/dist/cdn/bundle-mjs-B0nmHDtp.js +1953 -0
- package/dist/cdn/card-DqjqAq0o.js +41 -0
- package/dist/cdn/cfWorker-Bxcs9rNe.js +10799 -0
- package/dist/cdn/checkbox-B4oUG6Rr.js +20 -0
- package/dist/cdn/chunk-BO2N2NFS-Cy167e0X.js +17500 -0
- package/dist/cdn/chunk-QUQL4437-XnDcYQEx.js +1508 -0
- package/dist/cdn/clock-CmUbSx_B.js +12 -0
- package/dist/cdn/code-V_0nf5rg.js +10 -0
- package/dist/cdn/createLucideIcon-C5fZZ6oB.js +38 -0
- package/dist/cdn/dialog-Dnl-pZsY.js +1028 -0
- package/dist/cdn/dist-DjXr_YO3.js +616 -0
- package/dist/cdn/dist-mRDqCgKU.js +2305 -0
- package/dist/cdn/external-link-CjmfT6rW.js +17 -0
- package/dist/cdn/eye-B7H96av8.js +29 -0
- package/dist/cdn/favicon-96x96.png +0 -0
- package/dist/cdn/favicon-black.svg +5 -8
- package/dist/cdn/favicon-white.svg +4 -7
- package/dist/cdn/favicon.ico +0 -0
- package/dist/cdn/favicon.svg +5 -0
- package/dist/cdn/folder-open-B3lu2rG_.js +7 -0
- package/dist/cdn/hash-BVQnWi7q.js +33 -0
- package/dist/cdn/highlighted-body-OFNGDK62-CoReNbTX.js +36 -0
- package/dist/cdn/history-Csw4rb44.js +17 -0
- package/dist/cdn/index-browser-CVUwR-Bu.js +1934 -0
- package/dist/cdn/info-CNiOwqkf.js +19 -0
- package/dist/cdn/input-BLxOA7V-.js +10215 -0
- package/dist/cdn/inspector-settings-layout-0VDsjeqb.js +4 -0
- package/dist/cdn/inspector.css +1 -2
- package/dist/cdn/inspector.js +10854 -133726
- package/dist/cdn/jsx-runtime-CIxvMpEo.js +180 -0
- package/dist/cdn/label-CBvG613A.js +60 -0
- package/dist/cdn/loader-circle-BLy9A_pp.js +7 -0
- package/dist/cdn/manufact-auth-0TVxpeTA.js +387 -0
- package/dist/cdn/maximize-2-CH5Lq90B.js +21 -0
- package/dist/cdn/maximize-BALCV_ep.js +21 -0
- package/dist/cdn/mermaid-GHXKKRXX-DgVIbk-D.js +2 -0
- package/dist/cdn/message-square-BnxdpJxZ.js +7 -0
- package/dist/cdn/not-found-BcNNsTjS.js +34 -0
- package/dist/cdn/pdf-CxFT9FER.js +16291 -0
- package/dist/cdn/play-vuZ5PLnI.js +7 -0
- package/dist/cdn/popover-C_SSrXT0.js +2005 -0
- package/dist/cdn/react-BIs9pQ3H.js +926 -0
- package/dist/cdn/react-yUi9mVK4.js +5411 -0
- package/dist/cdn/refresh-cw-BXY-Pa0U.js +21 -0
- package/dist/cdn/save-Tgil_AJZ.js +34 -0
- package/dist/cdn/schemaHelpers-DTV38jGq.js +16 -0
- package/dist/cdn/select-BZ_IoKxg.js +2594 -0
- package/dist/cdn/servers-Dm72iTpY.js +26 -0
- package/dist/cdn/shared-uMiV6Fx1.js +1700 -0
- package/dist/cdn/sheet-CerCdhxz.js +78 -0
- package/dist/cdn/site.webmanifest +21 -0
- package/dist/cdn/sparkles-BntO2rDR.js +23 -0
- package/dist/cdn/spinner-CWcJhIY_.js +15 -0
- package/dist/cdn/square-check-big-BvwQ17Bl.js +10 -0
- package/dist/cdn/switch-DtQOLb9R.js +664 -0
- package/dist/cdn/tabs-subtle-C5cy35sY.js +787 -0
- package/dist/cdn/telemetry-Ct6pVkM1.js +240 -0
- package/dist/cdn/textarea-Bj-CT7hC.js +14 -0
- package/dist/cdn/trash-2-RwpJY5SL.js +25 -0
- package/dist/cdn/useAriaLabelledBy-Bm9qHGK6.js +29 -0
- package/dist/cdn/useCompositeItem-CNJ6MXdi.js +26 -0
- package/dist/cdn/useConfig-CwxZ6Quj.js +208 -0
- package/dist/cdn/useHostedSession-BA39Aegc.js +153 -0
- package/dist/cdn/useMCPPrompts-D3_Hla_z.js +104 -0
- package/dist/cdn/useSavedRequests-Ci2I919u.js +51 -0
- package/dist/cdn/useViewHostProps-C7vjco2m.js +348 -0
- package/dist/cdn/web-app-manifest-192x192.png +0 -0
- package/dist/cdn/web-app-manifest-512x512.png +0 -0
- package/dist/cdn/wrench-DzGmCfnb.js +7 -0
- package/dist/cdn/x-C3vRQIYu.js +10 -0
- package/dist/cdn/zap-Mb-pbw2X.js +10 -0
- package/dist/cli.js +1060 -3601
- package/dist/client/auth/manufact-auth.d.ts +30 -0
- package/dist/client/auth/manufact-auth.d.ts.map +1 -0
- package/dist/client/chat-history/ChatHistoryHeader.d.ts +4 -0
- package/dist/client/chat-history/ChatHistoryHeader.d.ts.map +1 -0
- package/dist/client/chat-history/ChatHistoryPanel.d.ts +28 -0
- package/dist/client/chat-history/ChatHistoryPanel.d.ts.map +1 -0
- package/dist/client/chat-history/ChatHistoryRail.d.ts +5 -0
- package/dist/client/chat-history/ChatHistoryRail.d.ts.map +1 -0
- package/dist/client/chat-history/ChatList.d.ts +18 -0
- package/dist/client/chat-history/ChatList.d.ts.map +1 -0
- package/dist/client/chat-history/ChatTitleReveal.d.ts +10 -0
- package/dist/client/chat-history/ChatTitleReveal.d.ts.map +1 -0
- package/dist/client/chat-history/chat-events-to-inspector-messages.d.ts +13 -0
- package/dist/client/chat-history/chat-events-to-inspector-messages.d.ts.map +1 -0
- package/dist/client/chat-history/chat-title.d.ts +10 -0
- package/dist/client/chat-history/chat-title.d.ts.map +1 -0
- package/dist/client/chat-history/providers/local-storage.d.ts +21 -0
- package/dist/client/chat-history/providers/local-storage.d.ts.map +1 -0
- package/dist/client/chat-history/types.d.ts +39 -0
- package/dist/client/chat-history/types.d.ts.map +1 -0
- package/dist/client/chat-history/useChatHistory.d.ts +20 -0
- package/dist/client/chat-history/useChatHistory.d.ts.map +1 -0
- package/dist/client/chat-history/useChatTitleGeneration.d.ts +17 -0
- package/dist/client/chat-history/useChatTitleGeneration.d.ts.map +1 -0
- package/dist/client/components/AddToClientDropdown.d.ts.map +1 -1
- package/dist/client/components/ChatTab.d.ts +28 -3
- package/dist/client/components/ChatTab.d.ts.map +1 -1
- package/dist/client/components/IframeConsole.d.ts.map +1 -1
- package/dist/client/components/MCPAppsDebugControls.d.ts +2 -18
- package/dist/client/components/MCPAppsDebugControls.d.ts.map +1 -1
- package/dist/client/components/PromptsTab.d.ts +1 -1
- package/dist/client/components/PromptsTab.d.ts.map +1 -1
- package/dist/client/components/ResourcesTab.d.ts +1 -1
- package/dist/client/components/ResourcesTab.d.ts.map +1 -1
- package/dist/client/components/ToolsTab.d.ts +3 -3
- package/dist/client/components/ToolsTab.d.ts.map +1 -1
- package/dist/client/components/chat/AssistantMessage.d.ts +2 -1
- package/dist/client/components/chat/AssistantMessage.d.ts.map +1 -1
- package/dist/client/components/chat/ChatHeader.d.ts +20 -2
- package/dist/client/components/chat/ChatHeader.d.ts.map +1 -1
- package/dist/client/components/chat/ChatInput.d.ts +6 -2
- package/dist/client/components/chat/ChatInput.d.ts.map +1 -1
- package/dist/client/components/chat/ChatInputArea.d.ts +31 -3
- package/dist/client/components/chat/ChatInputArea.d.ts.map +1 -1
- package/dist/client/components/chat/ChatLandingForm.d.ts +5 -42
- package/dist/client/components/chat/ChatLandingForm.d.ts.map +1 -1
- package/dist/client/components/chat/ChatScrollToBottomButton.d.ts +7 -0
- package/dist/client/components/chat/ChatScrollToBottomButton.d.ts.map +1 -0
- package/dist/client/components/chat/ChatTraceView.d.ts +7 -0
- package/dist/client/components/chat/ChatTraceView.d.ts.map +1 -0
- package/dist/client/components/chat/ConfigurationDialog.d.ts +12 -2
- package/dist/client/components/chat/ConfigurationDialog.d.ts.map +1 -1
- package/dist/client/components/chat/ConfigureEmptyState.d.ts +2 -5
- package/dist/client/components/chat/ConfigureEmptyState.d.ts.map +1 -1
- package/dist/client/components/chat/CopyButton.d.ts.map +1 -1
- package/dist/client/components/chat/FloatingChatElicitation.d.ts +10 -0
- package/dist/client/components/chat/FloatingChatElicitation.d.ts.map +1 -0
- package/dist/client/components/chat/MessageList.d.ts +6 -11
- package/dist/client/components/chat/MessageList.d.ts.map +1 -1
- package/dist/client/components/chat/MessageMetaActions.d.ts +7 -0
- package/dist/client/components/chat/MessageMetaActions.d.ts.map +1 -0
- package/dist/client/components/chat/PromptsDropdown.d.ts +1 -1
- package/dist/client/components/chat/PromptsDropdown.d.ts.map +1 -1
- package/dist/client/components/chat/StreamingAssistantContent.d.ts +7 -0
- package/dist/client/components/chat/StreamingAssistantContent.d.ts.map +1 -0
- package/dist/client/components/chat/SystemPromptButton.d.ts +11 -0
- package/dist/client/components/chat/SystemPromptButton.d.ts.map +1 -0
- package/dist/client/components/chat/ToolCallDisplay.d.ts.map +1 -1
- package/dist/client/components/chat/ToolResultRenderer.d.ts +2 -9
- package/dist/client/components/chat/ToolResultRenderer.d.ts.map +1 -1
- package/dist/client/components/chat/ToolSelector.d.ts.map +1 -1
- package/dist/client/components/chat/UserMessage.d.ts +2 -1
- package/dist/client/components/chat/UserMessage.d.ts.map +1 -1
- package/dist/client/components/chat/chat-bar-styles.d.ts +6 -0
- package/dist/client/components/chat/chat-bar-styles.d.ts.map +1 -0
- package/dist/client/components/chat/conversion.d.ts +1 -1
- package/dist/client/components/chat/conversion.d.ts.map +1 -1
- package/dist/client/components/chat/freeTier.d.ts +11 -0
- package/dist/client/components/chat/freeTier.d.ts.map +1 -1
- package/dist/client/components/chat/providerMeta.d.ts +10 -1
- package/dist/client/components/chat/providerMeta.d.ts.map +1 -1
- package/dist/client/components/chat/streamdown-code-slim.d.ts +4 -0
- package/dist/client/components/chat/streamdown-code-slim.d.ts.map +1 -0
- package/dist/client/components/chat/system-prompt/local-storage.d.ts +5 -0
- package/dist/client/components/chat/system-prompt/local-storage.d.ts.map +1 -0
- package/dist/client/components/chat/system-prompt/types.d.ts +8 -0
- package/dist/client/components/chat/system-prompt/types.d.ts.map +1 -0
- package/dist/client/components/chat/system-prompt/useLocalSystemPrompt.d.ts +3 -0
- package/dist/client/components/chat/system-prompt/useLocalSystemPrompt.d.ts.map +1 -0
- package/dist/client/components/chat/system-prompt-default.d.ts +2 -0
- package/dist/client/components/chat/system-prompt-default.d.ts.map +1 -0
- package/dist/client/components/chat/trace.d.ts +84 -0
- package/dist/client/components/chat/trace.d.ts.map +1 -0
- package/dist/client/components/chat/types.d.ts +2 -1
- package/dist/client/components/chat/types.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessages.d.ts +4 -0
- package/dist/client/components/chat/useChatMessages.d.ts.map +1 -1
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts +14 -2
- package/dist/client/components/chat/useChatMessagesClientSide.d.ts.map +1 -1
- package/dist/client/components/chat/useChatScrollToBottom.d.ts +13 -0
- package/dist/client/components/chat/useChatScrollToBottom.d.ts.map +1 -0
- package/dist/client/components/chat/useConfig.d.ts +2 -2
- package/dist/client/components/chat/useConfig.d.ts.map +1 -1
- package/dist/client/components/chat/useHostedChatMode.d.ts +14 -0
- package/dist/client/components/chat/useHostedChatMode.d.ts.map +1 -0
- package/dist/client/components/chat/useManagedCloudModel.d.ts +14 -0
- package/dist/client/components/chat/useManagedCloudModel.d.ts.map +1 -0
- package/dist/client/components/chat/utils.d.ts +0 -4
- package/dist/client/components/chat/utils.d.ts.map +1 -1
- package/dist/client/components/elicitation/shared/ElicitationAskUserPanel.d.ts +12 -0
- package/dist/client/components/elicitation/shared/ElicitationAskUserPanel.d.ts.map +1 -0
- package/dist/client/components/elicitation/shared/elicitationToAskUserQuestions.d.ts +9 -0
- package/dist/client/components/elicitation/shared/elicitationToAskUserQuestions.d.ts.map +1 -0
- package/dist/client/components/prompts/PromptExecutionPanel.d.ts +1 -1
- package/dist/client/components/prompts/PromptExecutionPanel.d.ts.map +1 -1
- package/dist/client/components/prompts/PromptInputForm.d.ts +1 -1
- package/dist/client/components/prompts/PromptInputForm.d.ts.map +1 -1
- package/dist/client/components/prompts/PromptResultDisplay.d.ts +1 -1
- package/dist/client/components/prompts/PromptResultDisplay.d.ts.map +1 -1
- package/dist/client/components/prompts/PromptsList.d.ts +1 -1
- package/dist/client/components/prompts/PromptsList.d.ts.map +1 -1
- package/dist/client/components/prompts/SavedPromptsList.d.ts.map +1 -1
- package/dist/client/components/resources/PropsConfigDialog.d.ts +1 -1
- package/dist/client/components/resources/PropsConfigDialog.d.ts.map +1 -1
- package/dist/client/components/resources/ResourceResultDisplay.d.ts +1 -1
- package/dist/client/components/resources/ResourceResultDisplay.d.ts.map +1 -1
- package/dist/client/components/resources/ResourcesList.d.ts +1 -1
- package/dist/client/components/resources/ResourcesList.d.ts.map +1 -1
- package/dist/client/components/shared/CollapsibleJSON.d.ts +6 -0
- package/dist/client/components/shared/CollapsibleJSON.d.ts.map +1 -0
- package/dist/client/components/shared/InspectorScrollArea.d.ts +9 -0
- package/dist/client/components/shared/InspectorScrollArea.d.ts.map +1 -0
- package/dist/client/components/shared/JSONDisplay.d.ts +5 -1
- package/dist/client/components/shared/JSONDisplay.d.ts.map +1 -1
- package/dist/client/components/shared/ListItem.d.ts +1 -3
- package/dist/client/components/shared/ListItem.d.ts.map +1 -1
- package/dist/client/components/shared/ListTabHeader.d.ts +4 -1
- package/dist/client/components/shared/ListTabHeader.d.ts.map +1 -1
- package/dist/client/components/shared/MarkdownRenderer.d.ts.map +1 -1
- package/dist/client/components/shared/SearchTabHeader.d.ts +28 -0
- package/dist/client/components/shared/SearchTabHeader.d.ts.map +1 -0
- package/dist/client/components/shared/StatusIcon.d.ts +12 -0
- package/dist/client/components/shared/StatusIcon.d.ts.map +1 -0
- package/dist/client/components/shared/index.d.ts +4 -1
- package/dist/client/components/shared/index.d.ts.map +1 -1
- package/dist/client/components/tools/SavedRequestsList.d.ts.map +1 -1
- package/dist/client/components/tools/ToolExecutionPanel.d.ts +1 -1
- package/dist/client/components/tools/ToolExecutionPanel.d.ts.map +1 -1
- package/dist/client/components/tools/ToolInputForm.d.ts +1 -1
- package/dist/client/components/tools/ToolInputForm.d.ts.map +1 -1
- package/dist/client/components/tools/ToolResultDisplay.d.ts +0 -6
- package/dist/client/components/tools/ToolResultDisplay.d.ts.map +1 -1
- package/dist/client/components/tools/ToolsList.d.ts +1 -1
- package/dist/client/components/tools/ToolsList.d.ts.map +1 -1
- package/dist/client/components/tools/useToolExecution.d.ts +26 -0
- package/dist/client/components/tools/useToolExecution.d.ts.map +1 -0
- package/dist/client/components/tools/useToolsTabNavigation.d.ts +35 -0
- package/dist/client/components/tools/useToolsTabNavigation.d.ts.map +1 -0
- package/dist/client/components/ui/WidgetWrapper.d.ts +2 -2
- package/dist/client/components/ui/WidgetWrapper.d.ts.map +1 -1
- package/dist/client/components/ui/alert-dialog.d.ts +8 -5
- package/dist/client/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/client/components/ui/ask-user-questions.d.ts +80 -0
- package/dist/client/components/ui/ask-user-questions.d.ts.map +1 -0
- package/dist/client/components/ui/badge.d.ts +32 -7
- package/dist/client/components/ui/badge.d.ts.map +1 -1
- package/dist/client/components/ui/button.d.ts +31 -11
- package/dist/client/components/ui/button.d.ts.map +1 -1
- package/dist/client/components/ui/chat-message.d.ts +23 -0
- package/dist/client/components/ui/chat-message.d.ts.map +1 -0
- package/dist/client/components/ui/checkbox.d.ts +2 -3
- package/dist/client/components/ui/checkbox.d.ts.map +1 -1
- package/dist/client/components/ui/client-icons.d.ts +0 -4
- package/dist/client/components/ui/client-icons.d.ts.map +1 -1
- package/dist/client/components/ui/command.d.ts +13 -64
- package/dist/client/components/ui/command.d.ts.map +1 -1
- package/dist/client/components/ui/dialog.d.ts +36 -12
- package/dist/client/components/ui/dialog.d.ts.map +1 -1
- package/dist/client/components/ui/dropdown-menu.d.ts +17 -48
- package/dist/client/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/client/components/ui/dropdown.d.ts +30 -0
- package/dist/client/components/ui/dropdown.d.ts.map +1 -0
- package/dist/client/components/ui/file-thumbnail.d.ts +9 -0
- package/dist/client/components/ui/file-thumbnail.d.ts.map +1 -0
- package/dist/client/components/ui/label.d.ts +1 -2
- package/dist/client/components/ui/label.d.ts.map +1 -1
- package/dist/client/components/ui/menu-item.d.ts +52 -0
- package/dist/client/components/ui/menu-item.d.ts.map +1 -0
- package/dist/client/components/ui/mesh-tab-background.d.ts +10 -0
- package/dist/client/components/ui/mesh-tab-background.d.ts.map +1 -0
- package/dist/client/components/ui/not-found.d.ts.map +1 -1
- package/dist/client/components/ui/popover.d.ts +4 -5
- package/dist/client/components/ui/popover.d.ts.map +1 -1
- package/dist/client/components/ui/scroll-area.d.ts +4 -0
- package/dist/client/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/client/components/ui/select.d.ts +50 -9
- package/dist/client/components/ui/select.d.ts.map +1 -1
- package/dist/client/components/ui/sheet.d.ts +9 -7
- package/dist/client/components/ui/sheet.d.ts.map +1 -1
- package/dist/client/components/ui/skeleton.d.ts +4 -0
- package/dist/client/components/ui/skeleton.d.ts.map +1 -0
- package/dist/client/components/ui/spinner.d.ts +1 -1
- package/dist/client/components/ui/spinner.d.ts.map +1 -1
- package/dist/client/components/ui/switch.d.ts +19 -7
- package/dist/client/components/ui/switch.d.ts.map +1 -1
- package/dist/client/components/ui/tabs-subtle.d.ts +25 -0
- package/dist/client/components/ui/tabs-subtle.d.ts.map +1 -0
- package/dist/client/components/ui/tooltip.d.ts +41 -6
- package/dist/client/components/ui/tooltip.d.ts.map +1 -1
- package/dist/client/context/InspectorContext.d.ts +6 -10
- package/dist/client/context/InspectorContext.d.ts.map +1 -1
- package/dist/client/context/WidgetDebugContext.d.ts +2 -3
- package/dist/client/context/WidgetDebugContext.d.ts.map +1 -1
- package/dist/client/hooks/use-merge-split.d.ts +36 -0
- package/dist/client/hooks/use-merge-split.d.ts.map +1 -0
- package/dist/client/hooks/use-proximity-hover-index.d.ts +27 -0
- package/dist/client/hooks/use-proximity-hover-index.d.ts.map +1 -0
- package/dist/client/hooks/use-proximity-hover.d.ts +26 -0
- package/dist/client/hooks/use-proximity-hover.d.ts.map +1 -0
- package/dist/client/hooks/use-touch-primary.d.ts +2 -0
- package/dist/client/hooks/use-touch-primary.d.ts.map +1 -0
- package/dist/client/hooks/useHostedSession.d.ts +4 -14
- package/dist/client/hooks/useHostedSession.d.ts.map +1 -1
- package/dist/client/hooks/useMCPPrompts.d.ts +1 -1
- package/dist/client/hooks/useMCPPrompts.d.ts.map +1 -1
- package/dist/client/hooks/useMcpAppsHostContext.d.ts +2 -2
- package/dist/client/hooks/useMcpAppsHostContext.d.ts.map +1 -1
- package/dist/client/hooks/usePropsLLM.d.ts +1 -1
- package/dist/client/hooks/usePropsLLM.d.ts.map +1 -1
- package/dist/client/hooks/useSavedRequests.d.ts +6 -0
- package/dist/client/hooks/useSavedRequests.d.ts.map +1 -0
- package/dist/client/hooks/useViewHostProps.d.ts +19 -0
- package/dist/client/hooks/useViewHostProps.d.ts.map +1 -0
- package/dist/client/index.d.ts +19 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +19306 -16141
- package/dist/client/lib/elevated.d.ts +28 -0
- package/dist/client/lib/elevated.d.ts.map +1 -0
- package/dist/client/lib/font-weight.d.ts +10 -0
- package/dist/client/lib/font-weight.d.ts.map +1 -0
- package/dist/client/lib/icon-context.d.ts +15 -0
- package/dist/client/lib/icon-context.d.ts.map +1 -0
- package/dist/client/lib/shape-context.d.ts +21 -0
- package/dist/client/lib/shape-context.d.ts.map +1 -0
- package/dist/client/lib/springs.d.ts +32 -0
- package/dist/client/lib/springs.d.ts.map +1 -0
- package/dist/client/lib/surface-classes.d.ts +2 -0
- package/dist/client/lib/surface-classes.d.ts.map +1 -0
- package/dist/client/lib/surface-context.d.ts +7 -0
- package/dist/client/lib/surface-context.d.ts.map +1 -0
- package/dist/client/lib/utils.d.ts +1 -1
- package/dist/client/lib/utils.d.ts.map +1 -1
- package/dist/client/mcp-apps/csp.d.ts +26 -0
- package/dist/client/mcp-apps/csp.d.ts.map +1 -0
- package/dist/client/mcp-apps/debug/csp-suggestions.d.ts +17 -0
- package/dist/client/mcp-apps/debug/csp-suggestions.d.ts.map +1 -0
- package/dist/client/mcp-apps/logging-transport.d.ts +13 -0
- package/dist/client/mcp-apps/logging-transport.d.ts.map +1 -0
- package/dist/client/rpc-traffic-coalesce.d.ts +7 -0
- package/dist/client/rpc-traffic-coalesce.d.ts.map +1 -0
- package/dist/client/rpc-traffic-store.d.ts +37 -0
- package/dist/client/rpc-traffic-store.d.ts.map +1 -0
- package/dist/client/telemetry/capture.d.ts +7 -0
- package/dist/client/telemetry/capture.d.ts.map +1 -0
- package/dist/client/telemetry/events.d.ts +1 -1
- package/dist/client/telemetry/events.d.ts.map +1 -1
- package/dist/client/telemetry/index.d.ts +2 -1
- package/dist/client/telemetry/index.d.ts.map +1 -1
- package/dist/client/telemetry/init.d.ts +2 -0
- package/dist/client/telemetry/init.d.ts.map +1 -0
- package/dist/client/telemetry/utils.d.ts +5 -0
- package/dist/client/telemetry/utils.d.ts.map +1 -1
- package/dist/client/types/message-content-block.d.ts +19 -0
- package/dist/client/types/message-content-block.d.ts.map +1 -0
- package/dist/client/types/pending-requests.d.ts +17 -0
- package/dist/client/types/pending-requests.d.ts.map +1 -0
- package/dist/client/utils/basePath.d.ts +34 -0
- package/dist/client/utils/basePath.d.ts.map +1 -0
- package/dist/client/utils/browser.d.ts +5 -0
- package/dist/client/utils/browser.d.ts.map +1 -0
- package/dist/client/utils/format.d.ts +4 -0
- package/dist/client/utils/format.d.ts.map +1 -0
- package/dist/client/utils/highlightJson.d.ts +11 -0
- package/dist/client/utils/highlightJson.d.ts.map +1 -0
- package/dist/client/utils/jsonUtils.d.ts +4 -0
- package/dist/client/utils/jsonUtils.d.ts.map +1 -1
- package/dist/client/utils/mcpClientUtils.d.ts.map +1 -1
- package/dist/client/utils/servers.d.ts +14 -0
- package/dist/client/utils/servers.d.ts.map +1 -0
- package/dist/server/cdn-shell.d.ts +18 -0
- package/dist/server/cdn-shell.d.ts.map +1 -0
- package/dist/server/cdn-shell.js +10 -0
- package/dist/server/chunk-5B3SXGZP.js +43 -0
- package/dist/server/chunk-6XWDZEFF.js +194 -0
- package/dist/server/chunk-ESODOPDD.js +50 -0
- package/dist/server/chunk-IKTZUWSX.js +0 -0
- package/dist/server/{chunk-57KIBVKX.js → chunk-J67FVPHF.js} +27 -26
- package/dist/server/chunk-K2F2AJOI.js +619 -0
- package/dist/server/chunk-K2V2SDQD.js +40 -0
- package/dist/server/{chunk-R4ISUE7T.js → chunk-THQ67TSE.js} +31 -32
- package/dist/server/chunk-TPHRVELX.js +130 -0
- package/dist/server/chunk-WFT4JHYI.js +24 -0
- package/dist/server/cli.js +23 -25
- package/dist/server/create-dev-api-app.d.ts +4 -0
- package/dist/server/create-dev-api-app.d.ts.map +1 -0
- package/dist/server/create-dev-api-app.js +11 -0
- package/dist/server/favicon-links.d.ts +12 -0
- package/dist/server/favicon-links.d.ts.map +1 -0
- package/dist/server/favicon-links.js +11 -0
- package/dist/server/favicon-static.d.ts +4 -0
- package/dist/server/favicon-static.d.ts.map +1 -0
- package/dist/server/favicon-static.js +8 -0
- package/dist/server/index.d.ts +3 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +13 -17
- package/dist/server/middleware.d.ts +14 -3
- package/dist/server/middleware.d.ts.map +1 -1
- package/dist/server/middleware.js +9 -9
- package/dist/server/proxy/index.d.ts +3 -0
- package/dist/server/proxy/index.d.ts.map +1 -0
- package/dist/server/proxy/index.js +12 -0
- package/dist/server/proxy/mcp-proxy.d.ts +99 -0
- package/dist/server/proxy/mcp-proxy.d.ts.map +1 -0
- package/dist/server/proxy/mcp-proxy.js +8 -0
- package/dist/server/proxy/oauth-proxy.d.ts +26 -0
- package/dist/server/proxy/oauth-proxy.d.ts.map +1 -0
- package/dist/server/proxy/oauth-proxy.js +9 -0
- package/dist/server/proxy-routes.d.ts +16 -0
- package/dist/server/proxy-routes.d.ts.map +1 -0
- package/dist/server/proxy-routes.js +10 -0
- package/dist/server/rpc-log-bus.js +73 -3
- package/dist/server/server.d.ts +3 -8
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +15 -92
- package/dist/server/version.js +1 -1
- package/dist/server/vite-dev-api-plugin.d.ts +4 -0
- package/dist/server/vite-dev-api-plugin.d.ts.map +1 -0
- package/dist/server/vite-dev-api-plugin.js +30 -0
- package/dist/web/apple-touch-icon.png +0 -0
- package/dist/web/assets/AnimatePresence-CthXziG2.js +9 -0
- package/dist/web/assets/ChatTab-CiAqtqhj.js +460 -0
- package/dist/web/assets/ConnectionSettingsTab-CTh6MFKE.js +1 -0
- package/dist/web/assets/ElicitationTab-B3Eg0_Jm.js +1 -0
- package/dist/web/assets/FormContext-Cqc_A12u.js +1 -0
- package/dist/web/assets/ListTabHeader-G-nQX18m.js +1 -0
- package/dist/web/assets/ManufactOAuthCallback-B-tdkUA2.js +1 -0
- package/dist/web/assets/NotificationsTab-BgLjxuos.js +1 -0
- package/dist/web/assets/OAuthCallback-Bp-jLoQs.js +1 -0
- package/dist/web/assets/PromptsTab-CA-SZs43.js +61 -0
- package/dist/web/assets/ResourcesTab-DdMIW_af.js +2 -0
- package/dist/web/assets/SamplingTab-DjyDG01W.js +1 -0
- package/dist/web/assets/ServerMetadataTab-Q4PlqP_B.js +1 -0
- package/dist/web/assets/ToolsTab-BHk8GCmd.js +8 -0
- package/dist/web/assets/ViewPreview-DWtmwzCb.js +1 -0
- package/dist/web/assets/WidgetWrapper-B43lqbld.js +34 -0
- package/dist/web/assets/brush--0LobUi4.js +1 -0
- package/dist/web/assets/bundle-mjs-8puS6ou7.js +1 -0
- package/dist/web/assets/checkbox-_GzEPQic.js +1 -0
- package/dist/web/assets/chunk-BO2N2NFS-BdIeB5Lr.js +131 -0
- package/dist/web/assets/code-tME-5H6D.js +1 -0
- package/dist/web/assets/createLucideIcon-B3b8EU0b.js +1 -0
- package/dist/web/assets/dist-DQjEDTKs.js +21 -0
- package/dist/web/assets/highlighted-body-OFNGDK62-Dp3e1QHL.js +1 -0
- package/dist/web/assets/index-Bbn-6QR2.js +475 -0
- package/dist/web/assets/index-BjH-Qp85.css +1 -0
- package/dist/web/assets/input-CjmxOFr6.js +1 -0
- package/dist/web/assets/inspector-settings-layout-yjKRJDai.js +1 -0
- package/dist/web/assets/jsx-runtime-Cjj9sGSy.js +1 -0
- package/dist/web/assets/label-B5Q_Zr8M.js +1 -0
- package/dist/web/assets/maximize-2-BTT9QQU9.js +1 -0
- package/dist/web/assets/maximize-_O55kFcr.js +1 -0
- package/dist/web/assets/mermaid-GHXKKRXX-yq1lkD3x.js +1 -0
- package/dist/web/assets/pdf-C3cfS_Ha.js +54 -0
- package/dist/web/assets/react-CU_d2d5K.js +1 -0
- package/dist/web/assets/refresh-cw-C9wQl8_d.js +1 -0
- package/dist/web/assets/save-B-MsgxX9.js +1 -0
- package/dist/web/assets/schemaHelpers-DLNTQr_6.js +1 -0
- package/dist/web/assets/select-C0xlfLAa.js +1 -0
- package/dist/web/assets/shared-Dfwy7nyg.js +1 -0
- package/dist/web/assets/sheet-CRPrEqAa.js +1 -0
- package/dist/web/assets/sparkles-2OAsc1aP.js +1 -0
- package/dist/web/assets/tabs-subtle-Dxgism9f.js +1 -0
- package/dist/web/assets/textarea-Ci09-en6.js +1 -0
- package/dist/web/assets/useConfig-b1f_iVFH.js +1 -0
- package/dist/web/assets/useMCPPrompts-CPskz9af.js +1 -0
- package/dist/web/assets/useViewHostProps-BgsQ2yYl.js +1 -0
- package/dist/web/assets/zap-Du2Uc5pa.js +1 -0
- package/dist/web/favicon-96x96.png +0 -0
- package/dist/web/favicon-black.svg +5 -8
- package/dist/web/favicon-white.svg +4 -7
- package/dist/web/favicon.ico +0 -0
- package/dist/web/favicon.svg +5 -0
- package/dist/web/index.html +13 -20
- package/dist/web/site.webmanifest +21 -0
- package/dist/web/web-app-manifest-192x192.png +0 -0
- package/dist/web/web-app-manifest-512x512.png +0 -0
- package/package.json +29 -30
- package/dist/client/components/FullscreenNavbar.d.ts +0 -9
- package/dist/client/components/FullscreenNavbar.d.ts.map +0 -1
- package/dist/client/components/LoginModal.d.ts +0 -11
- package/dist/client/components/LoginModal.d.ts.map +0 -1
- package/dist/client/components/MCPAppsRenderer.d.ts +0 -53
- package/dist/client/components/MCPAppsRenderer.d.ts.map +0 -1
- package/dist/client/components/McpUIRenderer.d.ts +0 -19
- package/dist/client/components/McpUIRenderer.d.ts.map +0 -1
- package/dist/client/components/OpenAIComponentRenderer.d.ts +0 -51
- package/dist/client/components/OpenAIComponentRenderer.d.ts.map +0 -1
- package/dist/client/components/chat/InlineElicitationCard.d.ts +0 -10
- package/dist/client/components/chat/InlineElicitationCard.d.ts.map +0 -1
- package/dist/client/components/chat/MCPUIResource.d.ts +0 -11
- package/dist/client/components/chat/MCPUIResource.d.ts.map +0 -1
- package/dist/client/components/elicitation/shared/ElicitationFormFields.d.ts +0 -21
- package/dist/client/components/elicitation/shared/ElicitationFormFields.d.ts.map +0 -1
- package/dist/client/components/elicitation/shared/index.d.ts +0 -3
- package/dist/client/components/elicitation/shared/index.d.ts.map +0 -1
- package/dist/client/components/elicitation/shared/useElicitationForm.d.ts +0 -23
- package/dist/client/components/elicitation/shared/useElicitationForm.d.ts.map +0 -1
- package/dist/client/components/logging/JsonRpcLoggerView.d.ts +0 -20
- package/dist/client/components/logging/JsonRpcLoggerView.d.ts.map +0 -1
- package/dist/client/components/prompts/PromptsTabHeader.d.ts +0 -17
- package/dist/client/components/prompts/PromptsTabHeader.d.ts.map +0 -1
- package/dist/client/components/prompts/index.d.ts +0 -6
- package/dist/client/components/prompts/index.d.ts.map +0 -1
- package/dist/client/components/resources/ResourcesTabHeader.d.ts +0 -16
- package/dist/client/components/resources/ResourcesTabHeader.d.ts.map +0 -1
- package/dist/client/components/resources/index.d.ts +0 -4
- package/dist/client/components/resources/index.d.ts.map +0 -1
- package/dist/client/components/shared/RpcPanel.d.ts +0 -21
- package/dist/client/components/shared/RpcPanel.d.ts.map +0 -1
- package/dist/client/components/tools/ToolsTabHeader.d.ts +0 -17
- package/dist/client/components/tools/ToolsTabHeader.d.ts.map +0 -1
- package/dist/client/components/tools/index.d.ts +0 -7
- package/dist/client/components/tools/index.d.ts.map +0 -1
- package/dist/client/components/ui/SandboxedIframe.d.ts +0 -64
- package/dist/client/components/ui/SandboxedIframe.d.ts.map +0 -1
- package/dist/client/components/ui/aurora-background.d.ts +0 -9
- package/dist/client/components/ui/aurora-background.d.ts.map +0 -1
- package/dist/client/constants/iframe.d.ts +0 -9
- package/dist/client/constants/iframe.d.ts.map +0 -1
- package/dist/client/constants/index.d.ts +0 -7
- package/dist/client/constants/index.d.ts.map +0 -1
- package/dist/client/constants/mcp-apps.d.ts +0 -39
- package/dist/client/constants/mcp-apps.d.ts.map +0 -1
- package/dist/client/hooks/usePrismTheme.d.ts +0 -5
- package/dist/client/hooks/usePrismTheme.d.ts.map +0 -1
- package/dist/client/lib/use-sandbox-remount-generation.d.ts +0 -9
- package/dist/client/lib/use-sandbox-remount-generation.d.ts.map +0 -1
- package/dist/client/lib/widget-fullscreen.d.ts +0 -17
- package/dist/client/lib/widget-fullscreen.d.ts.map +0 -1
- package/dist/client/telemetry/telemetry.d.ts +0 -42
- package/dist/client/telemetry/telemetry.d.ts.map +0 -1
- package/dist/client/types/elicitation.d.ts +0 -9
- package/dist/client/types/elicitation.d.ts.map +0 -1
- package/dist/client/utils/clipboard.d.ts +0 -6
- package/dist/client/utils/clipboard.d.ts.map +0 -1
- package/dist/client/utils/iframeConsoleInterceptor.d.ts +0 -6
- package/dist/client/utils/iframeConsoleInterceptor.d.ts.map +0 -1
- package/dist/client/utils/widget-detection.d.ts +0 -31
- package/dist/client/utils/widget-detection.d.ts.map +0 -1
- package/dist/llm/__tests__/messageFormat.test.d.ts +0 -2
- package/dist/llm/__tests__/messageFormat.test.d.ts.map +0 -1
- package/dist/llm/__tests__/providerToolResults.test.d.ts +0 -2
- package/dist/llm/__tests__/providerToolResults.test.d.ts.map +0 -1
- package/dist/llm/__tests__/toolResultParts.test.d.ts +0 -2
- package/dist/llm/__tests__/toolResultParts.test.d.ts.map +0 -1
- package/dist/llm/messageFormat.d.ts +0 -48
- package/dist/llm/messageFormat.d.ts.map +0 -1
- package/dist/llm/ndjson.d.ts +0 -5
- package/dist/llm/ndjson.d.ts.map +0 -1
- package/dist/llm/providers/anthropic.d.ts +0 -19
- package/dist/llm/providers/anthropic.d.ts.map +0 -1
- package/dist/llm/providers/google.d.ts +0 -19
- package/dist/llm/providers/google.d.ts.map +0 -1
- package/dist/llm/providers/index.d.ts +0 -19
- package/dist/llm/providers/index.d.ts.map +0 -1
- package/dist/llm/providers/ollama/index.d.ts +0 -18
- package/dist/llm/providers/ollama/index.d.ts.map +0 -1
- package/dist/llm/providers/ollama/utils.d.ts +0 -7
- package/dist/llm/providers/ollama/utils.d.ts.map +0 -1
- package/dist/llm/providers/openai.d.ts +0 -19
- package/dist/llm/providers/openai.d.ts.map +0 -1
- package/dist/llm/schemaUtils.d.ts +0 -2
- package/dist/llm/schemaUtils.d.ts.map +0 -1
- package/dist/llm/sse.d.ts +0 -15
- package/dist/llm/sse.d.ts.map +0 -1
- package/dist/llm/toolLoop.d.ts +0 -40
- package/dist/llm/toolLoop.d.ts.map +0 -1
- package/dist/llm/toolResultParts.d.ts +0 -28
- package/dist/llm/toolResultParts.d.ts.map +0 -1
- package/dist/llm/types.d.ts +0 -102
- package/dist/llm/types.d.ts.map +0 -1
- package/dist/server/chunk-A4VH7AIP.js +0 -738
- package/dist/server/chunk-CVECQ7BJ.js +0 -78
- package/dist/server/chunk-IDMHJUEM.js +0 -42
- package/dist/server/chunk-JWSNP6DN.js +0 -164
- package/dist/server/chunk-LJ4XSPDK.js +0 -322
- package/dist/server/chunk-OBMEB36B.js +0 -71
- package/dist/server/chunk-PJNKFX2R.js +0 -2351
- package/dist/server/chunk-QQ37LGLJ.js +0 -127
- package/dist/server/chunk-UTW44YSH.js +0 -322
- package/dist/server/file-utils.d.ts +0 -11
- package/dist/server/file-utils.d.ts.map +0 -1
- package/dist/server/file-utils.js +0 -11
- package/dist/server/routes/mcp-apps.d.ts +0 -12
- package/dist/server/routes/mcp-apps.d.ts.map +0 -1
- package/dist/server/shared-routes.d.ts +0 -11
- package/dist/server/shared-routes.d.ts.map +0 -1
- package/dist/server/shared-routes.js +0 -11
- package/dist/server/shared-static.d.ts +0 -57
- package/dist/server/shared-static.d.ts.map +0 -1
- package/dist/server/shared-static.js +0 -11
- package/dist/server/shared-utils.d.ts +0 -175
- package/dist/server/shared-utils.d.ts.map +0 -1
- package/dist/server/shared-utils.js +0 -21
- package/dist/server/transport-wrapper.d.ts +0 -6
- package/dist/server/transport-wrapper.d.ts.map +0 -1
- package/dist/server/transport-wrapper.js +0 -68
- package/dist/server/tunnel.d.ts +0 -11
- package/dist/server/tunnel.d.ts.map +0 -1
- package/dist/server/tunnel.js +0 -13
- package/dist/web/assets/1c-Ck39aYGA.js +0 -1
- package/dist/web/assets/abnf-BuzL1jyp.js +0 -1
- package/dist/web/assets/accesslog-C4d8zjYK.js +0 -1
- package/dist/web/assets/actionscript-yhwXJGpA.js +0 -1
- package/dist/web/assets/ada-DS7GMjM1.js +0 -1
- package/dist/web/assets/angelscript-BNqWtPa-.js +0 -1
- package/dist/web/assets/apache-CDWq3Rq5.js +0 -1
- package/dist/web/assets/applescript-8S6EVXRM.js +0 -1
- package/dist/web/assets/arcade-DC7EGdDp.js +0 -1
- package/dist/web/assets/arduino-8rhiPNbi.js +0 -1
- package/dist/web/assets/armasm-CXSk1xrZ.js +0 -1
- package/dist/web/assets/asciidoc-Cky4dUsA.js +0 -1
- package/dist/web/assets/aspectj-Dq_7W5m_.js +0 -1
- package/dist/web/assets/autohotkey-BNhcw-Zd.js +0 -1
- package/dist/web/assets/autoit-B6QVlGNy.js +0 -1
- package/dist/web/assets/avrasm-CHV0d4It.js +0 -1
- package/dist/web/assets/awk-DCB3Eg4O.js +0 -1
- package/dist/web/assets/axapta-Dxohu7yY.js +0 -1
- package/dist/web/assets/bash-Bvq6q0eu.js +0 -1
- package/dist/web/assets/basic-B6HvpaoU.js +0 -1
- package/dist/web/assets/bnf-CuNWJiZD.js +0 -1
- package/dist/web/assets/brainfuck-CwbwmNek.js +0 -3
- package/dist/web/assets/c-J3NpqNLd.js +0 -1
- package/dist/web/assets/c-like-CEyttHu3.js +0 -1
- package/dist/web/assets/cal-De1Inhwg.js +0 -1
- package/dist/web/assets/capnproto-Dfm52ju9.js +0 -1
- package/dist/web/assets/ceylon-C7k7iR7b.js +0 -1
- package/dist/web/assets/clean-BApy5Jiy.js +0 -1
- package/dist/web/assets/clojure-D99J3Nqd.js +0 -1
- package/dist/web/assets/clojure-repl-C-7y8JbJ.js +0 -1
- package/dist/web/assets/cmake-Cyp9hqgM.js +0 -1
- package/dist/web/assets/coffeescript-Di8oatND.js +0 -1
- package/dist/web/assets/coq-CTcQXuml.js +0 -1
- package/dist/web/assets/core-Dn-Gjdkn.js +0 -4
- package/dist/web/assets/cos-B5PyisGk.js +0 -1
- package/dist/web/assets/cpp-CpoL8Vn2.js +0 -1
- package/dist/web/assets/crmsh-BzEJ2UMf.js +0 -1
- package/dist/web/assets/crystal-DwthdjeS.js +0 -1
- package/dist/web/assets/csharp-DX0uiYC_.js +0 -1
- package/dist/web/assets/csp-Dz_hLI0l.js +0 -1
- package/dist/web/assets/css-CBX-iPig.js +0 -1
- package/dist/web/assets/d-BFcEc2Wd.js +0 -1
- package/dist/web/assets/dart-XM_3t8vN.js +0 -1
- package/dist/web/assets/delphi-DoGEkNsl.js +0 -1
- package/dist/web/assets/diff-DmFtonrj.js +0 -1
- package/dist/web/assets/django-BdZ5M382.js +0 -1
- package/dist/web/assets/dns-D08imUXg.js +0 -1
- package/dist/web/assets/dockerfile-B5VmPrWY.js +0 -1
- package/dist/web/assets/dos-CGSFxCkI.js +0 -1
- package/dist/web/assets/dsconfig-ca2r_GVK.js +0 -1
- package/dist/web/assets/dts-JQegxFM5.js +0 -1
- package/dist/web/assets/dust-Djaschl2.js +0 -1
- package/dist/web/assets/ebnf-CZryUL-X.js +0 -1
- package/dist/web/assets/elixir-D0_cpeEe.js +0 -1
- package/dist/web/assets/elm-CeVRiPaW.js +0 -1
- package/dist/web/assets/erb-xkDOjk65.js +0 -1
- package/dist/web/assets/erlang-Bjd1hpKB.js +0 -1
- package/dist/web/assets/erlang-repl-CAHsxSfj.js +0 -1
- package/dist/web/assets/excel-kF3e3kEL.js +0 -1
- package/dist/web/assets/fix-DcDIoRCK.js +0 -1
- package/dist/web/assets/flix-Ho4BNqBJ.js +0 -1
- package/dist/web/assets/fortran-14t4qTUY.js +0 -1
- package/dist/web/assets/fsharp-L5i6f6LO.js +0 -1
- package/dist/web/assets/gams-B1FvFmVr.js +0 -1
- package/dist/web/assets/gauss-DhPFrKEG.js +0 -1
- package/dist/web/assets/gcode-fU_PdGTz.js +0 -1
- package/dist/web/assets/gherkin-D35RpAlM.js +0 -1
- package/dist/web/assets/glsl-Ce3B2spn.js +0 -1
- package/dist/web/assets/gml-q_8zkRjy.js +0 -1
- package/dist/web/assets/go-tjnmgxFo.js +0 -1
- package/dist/web/assets/golo-D0DdehTP.js +0 -1
- package/dist/web/assets/gradle-BuEALrHh.js +0 -1
- package/dist/web/assets/groovy-BwBwLxy1.js +0 -1
- package/dist/web/assets/haml-BBZG2pIn.js +0 -1
- package/dist/web/assets/handlebars-CBCTIWBg.js +0 -1
- package/dist/web/assets/haskell-Ddd09HDp.js +0 -1
- package/dist/web/assets/haxe-B2rZ5fx2.js +0 -1
- package/dist/web/assets/hsp-I8h4zcwW.js +0 -1
- package/dist/web/assets/htmlbars-BU4KGKFH.js +0 -1
- package/dist/web/assets/http-DN5nyOjy.js +0 -1
- package/dist/web/assets/hy-CpeSsEuG.js +0 -1
- package/dist/web/assets/index-C4BqUITd.css +0 -2
- package/dist/web/assets/index-C8FrI8_O.js +0 -848
- package/dist/web/assets/inform7-BE7aHqNb.js +0 -1
- package/dist/web/assets/ini-Z84ip27g.js +0 -1
- package/dist/web/assets/irpf90-CVwarimj.js +0 -1
- package/dist/web/assets/isbl-ghISknvV.js +0 -1
- package/dist/web/assets/java-CEw02vbP.js +0 -1
- package/dist/web/assets/javascript-gThRHhsu.js +0 -1
- package/dist/web/assets/jboss-cli-C9bhouu8.js +0 -1
- package/dist/web/assets/json-CajKCx8k.js +0 -1
- package/dist/web/assets/julia-DoYLhEhE.js +0 -1
- package/dist/web/assets/julia-repl-BZUBP0N8.js +0 -1
- package/dist/web/assets/kotlin-DwLRtiOv.js +0 -2
- package/dist/web/assets/lasso-DzjodXDX.js +0 -1
- package/dist/web/assets/latex-TLlwzbIz.js +0 -1
- package/dist/web/assets/ldif-CCayDc2m.js +0 -1
- package/dist/web/assets/leaf-Bz7MjUha.js +0 -1
- package/dist/web/assets/less-5c3Sx665.js +0 -1
- package/dist/web/assets/lisp-nrbFh6lg.js +0 -1
- package/dist/web/assets/livecodeserver-B6AET3RQ.js +0 -1
- package/dist/web/assets/livescript-DluKBsMk.js +0 -1
- package/dist/web/assets/llvm-7haFOmp0.js +0 -1
- package/dist/web/assets/lsl-vQhUcPVp.js +0 -1
- package/dist/web/assets/lua-D6YEEohY.js +0 -1
- package/dist/web/assets/makefile-ps86vsQu.js +0 -1
- package/dist/web/assets/markdown-D4av7eDS.js +0 -1
- package/dist/web/assets/mathematica-KZAZ3f_4.js +0 -1
- package/dist/web/assets/matlab-DvaEq_2L.js +0 -1
- package/dist/web/assets/maxima-DmpshiQZ.js +0 -1
- package/dist/web/assets/mel-B-mMlzQm.js +0 -1
- package/dist/web/assets/mercury-C7wy29Qr.js +0 -1
- package/dist/web/assets/mipsasm-BWGxDN2L.js +0 -1
- package/dist/web/assets/mizar-BO0ByJsv.js +0 -1
- package/dist/web/assets/module-3nkmv-tD.js +0 -4
- package/dist/web/assets/mojolicious-DQzQPzHI.js +0 -1
- package/dist/web/assets/monkey-zmRhai32.js +0 -1
- package/dist/web/assets/moonscript-I4NDcPGQ.js +0 -1
- package/dist/web/assets/n1ql-DWiekVW7.js +0 -1
- package/dist/web/assets/nginx-DzGKMR5i.js +0 -1
- package/dist/web/assets/nim-CkSCDiz8.js +0 -1
- package/dist/web/assets/nix-ZeFazZ2H.js +0 -1
- package/dist/web/assets/node-repl-CPsBepeY.js +0 -1
- package/dist/web/assets/nsis-CPX7KHgX.js +0 -1
- package/dist/web/assets/objectivec-C9QgxLTf.js +0 -1
- package/dist/web/assets/ocaml-C3nG7mvn.js +0 -1
- package/dist/web/assets/openscad-DeCdwUSM.js +0 -1
- package/dist/web/assets/oxygene-DYdFEz9Q.js +0 -1
- package/dist/web/assets/parser3-ZcIhJT1P.js +0 -1
- package/dist/web/assets/perl-C6XfEYw8.js +0 -1
- package/dist/web/assets/pf-8XkdEzY8.js +0 -1
- package/dist/web/assets/pgsql-DAhhqJ5S.js +0 -1
- package/dist/web/assets/php-CSilrJt2.js +0 -1
- package/dist/web/assets/php-template-BNZ8XzCJ.js +0 -1
- package/dist/web/assets/plaintext-Bh7iCuMT.js +0 -1
- package/dist/web/assets/pony-CSAjk_Rh.js +0 -1
- package/dist/web/assets/powershell-5tevpPDi.js +0 -1
- package/dist/web/assets/processing-B5UBw4db.js +0 -1
- package/dist/web/assets/profile-BYWKRUf-.js +0 -1
- package/dist/web/assets/prolog-Z-kheNQb.js +0 -1
- package/dist/web/assets/properties-CP2GAgCT.js +0 -1
- package/dist/web/assets/protobuf-DwaP-ZBz.js +0 -1
- package/dist/web/assets/puppet-DCo1p-e1.js +0 -1
- package/dist/web/assets/purebasic-B4oTIbaC.js +0 -1
- package/dist/web/assets/python-Cxw0FOMN.js +0 -1
- package/dist/web/assets/python-repl-BggDorti.js +0 -1
- package/dist/web/assets/q-D0x0YPyq.js +0 -1
- package/dist/web/assets/qml-Dphl0SMd.js +0 -1
- package/dist/web/assets/r-D_JMfTn3.js +0 -1
- package/dist/web/assets/reasonml-CXdNSKcE.js +0 -1
- package/dist/web/assets/rib-D3-TlPeW.js +0 -1
- package/dist/web/assets/roboconf-DEm7cd22.js +0 -1
- package/dist/web/assets/routeros-DdjuRfl6.js +0 -1
- package/dist/web/assets/rpc-logger-TPNV75J4-C40n6UNr.js +0 -1
- package/dist/web/assets/rsl-BrnG8AH0.js +0 -1
- package/dist/web/assets/ruby-aB1innqz.js +0 -1
- package/dist/web/assets/ruleslanguage-BPmfiapH.js +0 -1
- package/dist/web/assets/rust-DqQz2VhN.js +0 -1
- package/dist/web/assets/sas-D4-lEVkU.js +0 -1
- package/dist/web/assets/scala-77Na58um.js +0 -1
- package/dist/web/assets/scheme-2Qe3EDmu.js +0 -1
- package/dist/web/assets/scilab-DZps5Q31.js +0 -1
- package/dist/web/assets/scss-B3Vtu9UP.js +0 -1
- package/dist/web/assets/shell-CrQcV8OK.js +0 -1
- package/dist/web/assets/smali-BTfpnEqn.js +0 -2
- package/dist/web/assets/smalltalk-CpIWoTp_.js +0 -1
- package/dist/web/assets/sml-DoJUdr8i.js +0 -1
- package/dist/web/assets/sqf-Bs26a1hR.js +0 -1
- package/dist/web/assets/sql-BXs9CZyk.js +0 -1
- package/dist/web/assets/sql_more-CQVJyFAZ.js +0 -1
- package/dist/web/assets/stan-B6HH5NgR.js +0 -1
- package/dist/web/assets/stata-VKr1FNBF.js +0 -3
- package/dist/web/assets/step21-Ba6oj9Wj.js +0 -1
- package/dist/web/assets/stylus-DhJmSeI6.js +0 -1
- package/dist/web/assets/subunit-B0bGuVIS.js +0 -3
- package/dist/web/assets/swift-C5NITCOW.js +0 -1
- package/dist/web/assets/taggerscript-DzMn6Q_H.js +0 -1
- package/dist/web/assets/tap-D-CsbE0z.js +0 -1
- package/dist/web/assets/tcl-mxaB-b0O.js +0 -1
- package/dist/web/assets/thrift-D15bAw3O.js +0 -1
- package/dist/web/assets/tp-CYW80aaN.js +0 -1
- package/dist/web/assets/twig-DUx5lHKo.js +0 -1
- package/dist/web/assets/typescript-FKxWpH0A.js +0 -1
- package/dist/web/assets/vala-C8SPe1Je.js +0 -1
- package/dist/web/assets/vbnet-DPOz3qH4.js +0 -1
- package/dist/web/assets/vbscript-BFMfNF7s.js +0 -1
- package/dist/web/assets/vbscript-html-3FBmwJu9.js +0 -1
- package/dist/web/assets/verilog-CiVb5cnG.js +0 -1
- package/dist/web/assets/vhdl-BQaFQ0Ys.js +0 -1
- package/dist/web/assets/vim-k5mEfOIE.js +0 -1
- package/dist/web/assets/x86asm-B-SWMOrZ.js +0 -1
- package/dist/web/assets/xl-BpV7JOX6.js +0 -1
- package/dist/web/assets/xml-7_gIAAop.js +0 -1
- package/dist/web/assets/xquery-D3UKuxgH.js +0 -1
- package/dist/web/assets/yaml-CL8bO3oj.js +0 -1
- package/dist/web/assets/zephir-foimhbl6.js +0 -1
|
@@ -0,0 +1,1934 @@
|
|
|
1
|
+
import { i as e } from "./react-BIs9pQ3H.js";
|
|
2
|
+
import { a as t, c as n, i as r, l as i, n as a, o, r as s, t as c } from "./cfWorker-Bxcs9rNe.js";
|
|
3
|
+
//#region ../client/dist/index-browser.js
|
|
4
|
+
var l = /* @__PURE__ */ e({
|
|
5
|
+
BaseConnector: () => q,
|
|
6
|
+
BrowserOAuthClientProvider: () => B,
|
|
7
|
+
DialectJsonSchemaValidator: () => K,
|
|
8
|
+
HttpConnector: () => Y,
|
|
9
|
+
MCPClient: () => ze,
|
|
10
|
+
MCPConnection: () => $,
|
|
11
|
+
MCPSession: () => $,
|
|
12
|
+
POSTHOG_API_KEY: () => se,
|
|
13
|
+
POSTHOG_HOST: () => oe,
|
|
14
|
+
SCARF_GATEWAY_URL: () => T,
|
|
15
|
+
Tel: () => L,
|
|
16
|
+
Telemetry: () => I,
|
|
17
|
+
VERSION: () => x,
|
|
18
|
+
capturePostHog: () => O,
|
|
19
|
+
captureScarf: () => k,
|
|
20
|
+
completeOAuthFlow: () => W,
|
|
21
|
+
createOAuthProvider: () => V,
|
|
22
|
+
getPackageVersion: () => S,
|
|
23
|
+
isUnauthorized: () => U,
|
|
24
|
+
logger: () => b,
|
|
25
|
+
normalizeClientInfo: () => Q,
|
|
26
|
+
resolveCallbacks: () => X,
|
|
27
|
+
setTelemetrySource: () => R,
|
|
28
|
+
shouldAutoProvisionOAuth: () => Z,
|
|
29
|
+
telFetch: () => w
|
|
30
|
+
}), u;
|
|
31
|
+
function d(e) {
|
|
32
|
+
u = e;
|
|
33
|
+
}
|
|
34
|
+
function f(e, t) {
|
|
35
|
+
u?.addServer(e, t);
|
|
36
|
+
}
|
|
37
|
+
function p(e) {
|
|
38
|
+
u?.removeServer(e);
|
|
39
|
+
}
|
|
40
|
+
var m;
|
|
41
|
+
function h(e) {
|
|
42
|
+
m = e;
|
|
43
|
+
}
|
|
44
|
+
function g(e) {
|
|
45
|
+
m?.(e);
|
|
46
|
+
}
|
|
47
|
+
var _ = [
|
|
48
|
+
"silent",
|
|
49
|
+
"error",
|
|
50
|
+
"warn",
|
|
51
|
+
"info",
|
|
52
|
+
"http",
|
|
53
|
+
"verbose",
|
|
54
|
+
"debug",
|
|
55
|
+
"silly"
|
|
56
|
+
], v = {
|
|
57
|
+
silent: "",
|
|
58
|
+
error: "❌",
|
|
59
|
+
warn: "⚠️",
|
|
60
|
+
info: "ℹ️",
|
|
61
|
+
http: "🌐",
|
|
62
|
+
verbose: "📝",
|
|
63
|
+
debug: "🔍",
|
|
64
|
+
silly: "🤪"
|
|
65
|
+
};
|
|
66
|
+
function y() {
|
|
67
|
+
let e;
|
|
68
|
+
try {
|
|
69
|
+
e = typeof process < "u" ? {}.MCP_USE_LOG_LEVEL ?? {}.DEBUG : void 0;
|
|
70
|
+
} catch {}
|
|
71
|
+
let t = e?.trim().toLowerCase();
|
|
72
|
+
return t === "2" ? "debug" : t && _.includes(t) ? t : "info";
|
|
73
|
+
}
|
|
74
|
+
var ee = class {
|
|
75
|
+
constructor(e = "mcp-use", t = "info", n = "minimal") {
|
|
76
|
+
this.name = e, this.level = t, this.format = n;
|
|
77
|
+
}
|
|
78
|
+
write(e, t, n) {
|
|
79
|
+
if (this.level === "silent" || _.indexOf(e) > _.indexOf(this.level)) return;
|
|
80
|
+
let r = n.map((e) => {
|
|
81
|
+
if (typeof e == "string") return e;
|
|
82
|
+
try {
|
|
83
|
+
return JSON.stringify(e);
|
|
84
|
+
} catch {
|
|
85
|
+
return String(e);
|
|
86
|
+
}
|
|
87
|
+
}).join(" "), i = r ? `${t} ${r}` : t, a = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: !1 }), o = this.format === "minimal" ? e : e.toUpperCase(), s = this.format === "emoji" ? ` ${v[e]}` : "", c = `${a} [${this.name}]${s} ${o}: ${i}`;
|
|
88
|
+
(e === "error" ? console.error : e === "warn" ? console.warn : e === "info" ? console.info : e === "debug" ? console.debug : console.log)(c);
|
|
89
|
+
}
|
|
90
|
+
error = (e, ...t) => this.write("error", e, t);
|
|
91
|
+
warn = (e, ...t) => this.write("warn", e, t);
|
|
92
|
+
info = (e, ...t) => this.write("info", e, t);
|
|
93
|
+
debug = (e, ...t) => this.write("debug", e, t);
|
|
94
|
+
http = (e, ...t) => this.write("http", e, t);
|
|
95
|
+
verbose = (e, ...t) => this.write("verbose", e, t);
|
|
96
|
+
silly = (e, ...t) => this.write("silly", e, t);
|
|
97
|
+
setFormat(e) {
|
|
98
|
+
this.format = e;
|
|
99
|
+
}
|
|
100
|
+
}, b = class {
|
|
101
|
+
static instances = {};
|
|
102
|
+
static currentFormat = "minimal";
|
|
103
|
+
static currentLevel;
|
|
104
|
+
static get(e = "mcp-use") {
|
|
105
|
+
return this.instances[e] ??= new ee(e, this.currentLevel ?? y(), this.currentFormat);
|
|
106
|
+
}
|
|
107
|
+
static configure({ level: e = y(), format: t = "minimal" } = {}) {
|
|
108
|
+
this.currentLevel = e, this.currentFormat = t;
|
|
109
|
+
for (let n of Object.values(this.instances)) n.level = e, n.format = t;
|
|
110
|
+
}
|
|
111
|
+
static setDebug(e) {
|
|
112
|
+
let t = e === 2 || e === !0 ? "debug" : "info";
|
|
113
|
+
this.currentLevel = t;
|
|
114
|
+
for (let e of Object.values(this.instances)) e.level = t;
|
|
115
|
+
try {
|
|
116
|
+
typeof process < "u" && ({}.MCP_USE_LOG_LEVEL = t);
|
|
117
|
+
} catch {}
|
|
118
|
+
}
|
|
119
|
+
static setFormat(e) {
|
|
120
|
+
this.configure({ format: e });
|
|
121
|
+
}
|
|
122
|
+
}.get(), x = "2.0.0-beta.0";
|
|
123
|
+
function S() {
|
|
124
|
+
return x;
|
|
125
|
+
}
|
|
126
|
+
var C = class {}, te = class extends C {
|
|
127
|
+
constructor(e) {
|
|
128
|
+
super(), this.data = e;
|
|
129
|
+
}
|
|
130
|
+
get name() {
|
|
131
|
+
return "mcp_agent_execution";
|
|
132
|
+
}
|
|
133
|
+
get properties() {
|
|
134
|
+
return {
|
|
135
|
+
execution_method: this.data.executionMethod,
|
|
136
|
+
query: this.data.query,
|
|
137
|
+
query_length: this.data.query.length,
|
|
138
|
+
success: this.data.success,
|
|
139
|
+
model_provider: this.data.modelProvider,
|
|
140
|
+
model_name: this.data.modelName,
|
|
141
|
+
server_count: this.data.serverCount,
|
|
142
|
+
server_identifiers: this.data.serverIdentifiers,
|
|
143
|
+
total_tools_available: this.data.totalToolsAvailable,
|
|
144
|
+
tools_available_names: this.data.toolsAvailableNames,
|
|
145
|
+
max_steps_configured: this.data.maxStepsConfigured,
|
|
146
|
+
memory_enabled: this.data.memoryEnabled,
|
|
147
|
+
use_server_manager: this.data.useServerManager,
|
|
148
|
+
max_steps_used: this.data.maxStepsUsed,
|
|
149
|
+
manage_connector: this.data.manageConnector,
|
|
150
|
+
external_history_used: this.data.externalHistoryUsed,
|
|
151
|
+
steps_taken: this.data.stepsTaken ?? null,
|
|
152
|
+
tools_used_count: this.data.toolsUsedCount ?? null,
|
|
153
|
+
tools_used_names: this.data.toolsUsedNames ?? null,
|
|
154
|
+
response: this.data.response ?? null,
|
|
155
|
+
response_length: this.data.response ? this.data.response.length : null,
|
|
156
|
+
execution_time_ms: this.data.executionTimeMs ?? null,
|
|
157
|
+
error_type: this.data.errorType ?? null,
|
|
158
|
+
conversation_history_length: this.data.conversationHistoryLength ?? null
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}, ne = class extends C {
|
|
162
|
+
constructor(e) {
|
|
163
|
+
super(), this.data = e;
|
|
164
|
+
}
|
|
165
|
+
get name() {
|
|
166
|
+
return "mcpclient_init";
|
|
167
|
+
}
|
|
168
|
+
get properties() {
|
|
169
|
+
return {
|
|
170
|
+
code_mode: this.data.codeMode,
|
|
171
|
+
sandbox: this.data.sandbox,
|
|
172
|
+
all_callbacks: this.data.allCallbacks,
|
|
173
|
+
verify: this.data.verify,
|
|
174
|
+
servers: this.data.servers,
|
|
175
|
+
num_servers: this.data.numServers,
|
|
176
|
+
is_browser: this.data.isBrowser
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}, re = class extends C {
|
|
180
|
+
constructor(e) {
|
|
181
|
+
super(), this.data = e;
|
|
182
|
+
}
|
|
183
|
+
get name() {
|
|
184
|
+
return "connector_init";
|
|
185
|
+
}
|
|
186
|
+
get properties() {
|
|
187
|
+
return {
|
|
188
|
+
connector_type: this.data.connectorType,
|
|
189
|
+
server_command: this.data.serverCommand ?? null,
|
|
190
|
+
server_args: this.data.serverArgs ?? null,
|
|
191
|
+
server_url: this.data.serverUrl ?? null,
|
|
192
|
+
public_identifier: this.data.publicIdentifier ?? null
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}, ie = class extends C {
|
|
196
|
+
constructor(e) {
|
|
197
|
+
super(), this.data = e;
|
|
198
|
+
}
|
|
199
|
+
get name() {
|
|
200
|
+
return "client_add_server";
|
|
201
|
+
}
|
|
202
|
+
get properties() {
|
|
203
|
+
let { serverName: e, serverConfig: t } = this.data, n = t.url;
|
|
204
|
+
return {
|
|
205
|
+
server_name: e,
|
|
206
|
+
server_url_domain: n ? this._extractHostname(n) : null,
|
|
207
|
+
transport: t.transport ?? null,
|
|
208
|
+
has_auth: !!(t.authToken || t.authProvider)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
_extractHostname(e) {
|
|
212
|
+
try {
|
|
213
|
+
return new URL(e).hostname;
|
|
214
|
+
} catch {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, ae = class extends C {
|
|
219
|
+
constructor(e) {
|
|
220
|
+
super(), this.data = e;
|
|
221
|
+
}
|
|
222
|
+
get name() {
|
|
223
|
+
return "client_remove_server";
|
|
224
|
+
}
|
|
225
|
+
get properties() {
|
|
226
|
+
return { server_name: this.data.serverName };
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
async function w(e, t) {
|
|
230
|
+
try {
|
|
231
|
+
await fetch(e, t);
|
|
232
|
+
} catch {}
|
|
233
|
+
}
|
|
234
|
+
var oe = "https://eu.i.posthog.com", se = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI", T = "https://mcpuse.gateway.scarf.sh/events-ts", E = "https://mcpuse.gateway.scarf.sh/simple/", D = 1800, ce = /* @__PURE__ */ new Set([
|
|
235
|
+
"query",
|
|
236
|
+
"response",
|
|
237
|
+
"messages"
|
|
238
|
+
]);
|
|
239
|
+
function le(e) {
|
|
240
|
+
if (e == null) return "";
|
|
241
|
+
if (typeof e == "string") return e;
|
|
242
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
243
|
+
try {
|
|
244
|
+
return JSON.stringify(e);
|
|
245
|
+
} catch {
|
|
246
|
+
return String(e);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function ue(e, t = E) {
|
|
250
|
+
let n = new URLSearchParams();
|
|
251
|
+
for (let [t, r] of Object.entries(e)) {
|
|
252
|
+
let e = le(r);
|
|
253
|
+
ce.has(t) && e.length > 120 && (e = `${e.slice(0, 117)}...`), e !== "" && n.set(t, e);
|
|
254
|
+
}
|
|
255
|
+
let r = `${t}${t.includes("?") ? "&" : "?"}${n.toString()}`;
|
|
256
|
+
if (r.length <= D) return r;
|
|
257
|
+
let i = [...n.keys()].sort((e, t) => (n.get(t)?.length ?? 0) - (n.get(e)?.length ?? 0));
|
|
258
|
+
for (let e of i) {
|
|
259
|
+
if (r.length <= D) break;
|
|
260
|
+
e === "event" || e === "user_id" || (n.delete(e), r = `${t}${t.includes("?") ? "&" : "?"}${n.toString()}`);
|
|
261
|
+
}
|
|
262
|
+
return r.slice(0, D);
|
|
263
|
+
}
|
|
264
|
+
function de(e, t) {
|
|
265
|
+
return w(t, {
|
|
266
|
+
method: "POST",
|
|
267
|
+
headers: { "Content-Type": "application/json" },
|
|
268
|
+
keepalive: !0,
|
|
269
|
+
body: JSON.stringify(e)
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function fe(e, t) {
|
|
273
|
+
try {
|
|
274
|
+
let n = ue(e, t), r = new Image();
|
|
275
|
+
r.referrerPolicy = "no-referrer-when-downgrade", r.src = n;
|
|
276
|
+
} catch {}
|
|
277
|
+
return Promise.resolve();
|
|
278
|
+
}
|
|
279
|
+
function O(e) {
|
|
280
|
+
let t = e.host ?? "https://eu.i.posthog.com", n = e.apiKey ?? "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI";
|
|
281
|
+
return w(`${t}/i/v0/e/`, {
|
|
282
|
+
method: "POST",
|
|
283
|
+
headers: { "Content-Type": "application/json" },
|
|
284
|
+
keepalive: !0,
|
|
285
|
+
body: JSON.stringify({
|
|
286
|
+
api_key: n,
|
|
287
|
+
event: e.event,
|
|
288
|
+
distinct_id: e.distinctId,
|
|
289
|
+
properties: e.properties,
|
|
290
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function k(e, t = T) {
|
|
295
|
+
return typeof window < "u" ? fe(e, t === "https://mcpuse.gateway.scarf.sh/events-ts" ? E : t) : de(e, t);
|
|
296
|
+
}
|
|
297
|
+
function A() {
|
|
298
|
+
return globalThis.crypto.randomUUID();
|
|
299
|
+
}
|
|
300
|
+
function pe() {
|
|
301
|
+
let e = new Uint8Array(8);
|
|
302
|
+
return globalThis.crypto.getRandomValues(e), Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
303
|
+
}
|
|
304
|
+
function me(e, t) {
|
|
305
|
+
let n = (e) => e.split("-")[0].split(".").map((e) => parseInt(e, 10) || 0), r = n(e), i = n(t), a = Math.max(r.length, i.length);
|
|
306
|
+
for (let e = 0; e < a; e++) {
|
|
307
|
+
let t = r[e] ?? 0, n = i[e] ?? 0;
|
|
308
|
+
if (t !== n) return t > n;
|
|
309
|
+
}
|
|
310
|
+
return !1;
|
|
311
|
+
}
|
|
312
|
+
var j = "mcp_use_user_id", M = "phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI", N = "https://eu.i.posthog.com", P = null;
|
|
313
|
+
function F() {
|
|
314
|
+
return typeof localStorage < "u" && typeof localStorage.getItem == "function" && typeof localStorage.setItem == "function" && typeof localStorage.removeItem == "function";
|
|
315
|
+
}
|
|
316
|
+
function he() {
|
|
317
|
+
if (!F()) return null;
|
|
318
|
+
try {
|
|
319
|
+
localStorage.setItem("__mcp_use_test__", "1"), localStorage.removeItem("__mcp_use_test__");
|
|
320
|
+
} catch {
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
getUserId() {
|
|
325
|
+
try {
|
|
326
|
+
return localStorage.getItem(j);
|
|
327
|
+
} catch {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
setUserId(e) {
|
|
332
|
+
try {
|
|
333
|
+
localStorage.setItem(j, e);
|
|
334
|
+
} catch {}
|
|
335
|
+
},
|
|
336
|
+
getDownloadedVersion: () => null,
|
|
337
|
+
setDownloadedVersion: () => void 0
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function ge() {
|
|
341
|
+
try {
|
|
342
|
+
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";
|
|
343
|
+
} catch {
|
|
344
|
+
return "unknown";
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function _e() {
|
|
348
|
+
if (typeof process < "u" && {}.MCP_USE_TELEMETRY_SOURCE) return {}.MCP_USE_TELEMETRY_SOURCE;
|
|
349
|
+
try {
|
|
350
|
+
if (F()) return localStorage.getItem("MCP_USE_TELEMETRY_SOURCE") ?? void 0;
|
|
351
|
+
} catch {}
|
|
352
|
+
}
|
|
353
|
+
function ve() {
|
|
354
|
+
if (typeof window < "u" && window.__MCP_USE_ANONYMIZED_TELEMETRY__ === !1 || typeof process < "u" && {}.MCP_USE_ANONYMIZED_TELEMETRY?.toLowerCase() === "false") return !0;
|
|
355
|
+
try {
|
|
356
|
+
if (F() && localStorage.getItem("MCP_USE_ANONYMIZED_TELEMETRY") === "false") return !0;
|
|
357
|
+
} catch {}
|
|
358
|
+
return !1;
|
|
359
|
+
}
|
|
360
|
+
function ye() {
|
|
361
|
+
try {
|
|
362
|
+
return `session-${A()}`;
|
|
363
|
+
} catch {
|
|
364
|
+
return `session-${Date.now()}-${pe()}`;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
var I = class e {
|
|
368
|
+
static instance = null;
|
|
369
|
+
UNKNOWN_USER_ID = "UNKNOWN_USER_ID";
|
|
370
|
+
_currUserId = null;
|
|
371
|
+
_telemetryEnabled = !1;
|
|
372
|
+
_pending = /* @__PURE__ */ new Set();
|
|
373
|
+
_scarfEnabled = !1;
|
|
374
|
+
_runtimeEnvironment;
|
|
375
|
+
_storageCapability;
|
|
376
|
+
_storage;
|
|
377
|
+
_fsBacked;
|
|
378
|
+
_source;
|
|
379
|
+
_productVersion;
|
|
380
|
+
constructor() {
|
|
381
|
+
this._runtimeEnvironment = ge(), this._fsBacked = P !== null, this._storage = P ?? he() ?? null, this._storageCapability = this._storage ? "persistent" : "session-only", this._source = _e() || this._runtimeEnvironment;
|
|
382
|
+
let e = ve(), t = this._runtimeEnvironment !== "unknown";
|
|
383
|
+
e ? (this._telemetryEnabled = !1, b.debug("Telemetry disabled via opt-out")) : t ? (b.debug("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false to disable."), this._telemetryEnabled = !0, this._scarfEnabled = !0, this._fsBacked && setTimeout(() => {
|
|
384
|
+
this.trackPackageDownload({ triggered_by: "initialization" }).catch((e) => b.debug(`Failed to track package download: ${e}`));
|
|
385
|
+
}, 0)) : (this._telemetryEnabled = !1, b.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`));
|
|
386
|
+
}
|
|
387
|
+
get runtimeEnvironment() {
|
|
388
|
+
return this._runtimeEnvironment;
|
|
389
|
+
}
|
|
390
|
+
get storageCapability() {
|
|
391
|
+
return this._storageCapability;
|
|
392
|
+
}
|
|
393
|
+
static getInstance() {
|
|
394
|
+
return e.instance ||= new e(), e.instance;
|
|
395
|
+
}
|
|
396
|
+
setSource(e) {
|
|
397
|
+
this._source = e;
|
|
398
|
+
try {
|
|
399
|
+
F() && localStorage.setItem("MCP_USE_TELEMETRY_SOURCE", e);
|
|
400
|
+
} catch {}
|
|
401
|
+
b.debug(`Telemetry source set to: ${e}`);
|
|
402
|
+
}
|
|
403
|
+
getSource() {
|
|
404
|
+
return this._source;
|
|
405
|
+
}
|
|
406
|
+
setProductVersion(e) {
|
|
407
|
+
this._productVersion = e;
|
|
408
|
+
}
|
|
409
|
+
get isEnabled() {
|
|
410
|
+
return this._telemetryEnabled || this._scarfEnabled;
|
|
411
|
+
}
|
|
412
|
+
get userId() {
|
|
413
|
+
if (this._currUserId) return this._currUserId;
|
|
414
|
+
try {
|
|
415
|
+
if (this._storage) {
|
|
416
|
+
let e = this._storage.getUserId();
|
|
417
|
+
if (e) return this._currUserId = e, e;
|
|
418
|
+
let t = A();
|
|
419
|
+
return this._storage.setUserId(t), this._currUserId = t, t;
|
|
420
|
+
}
|
|
421
|
+
this._currUserId = ye();
|
|
422
|
+
} catch {
|
|
423
|
+
this._currUserId = this.UNKNOWN_USER_ID;
|
|
424
|
+
}
|
|
425
|
+
return this._currUserId;
|
|
426
|
+
}
|
|
427
|
+
async capture(e) {
|
|
428
|
+
if (!this._telemetryEnabled && !this._scarfEnabled) return;
|
|
429
|
+
let t = this.userId, n = {
|
|
430
|
+
...e.properties,
|
|
431
|
+
mcp_use_version: this._productVersion ?? S(),
|
|
432
|
+
language: "typescript",
|
|
433
|
+
source: this._source,
|
|
434
|
+
runtime: this._runtimeEnvironment
|
|
435
|
+
};
|
|
436
|
+
if (this._telemetryEnabled) {
|
|
437
|
+
let r = O({
|
|
438
|
+
host: N,
|
|
439
|
+
apiKey: M,
|
|
440
|
+
event: e.name,
|
|
441
|
+
distinctId: t,
|
|
442
|
+
properties: n
|
|
443
|
+
});
|
|
444
|
+
this._pending.add(r), r.finally(() => this._pending.delete(r));
|
|
445
|
+
}
|
|
446
|
+
if (this._scarfEnabled) {
|
|
447
|
+
let r = k({
|
|
448
|
+
...n,
|
|
449
|
+
user_id: t,
|
|
450
|
+
event: e.name
|
|
451
|
+
});
|
|
452
|
+
this._pending.add(r), r.finally(() => this._pending.delete(r));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
async trackPackageDownload(e) {
|
|
456
|
+
if (!this._scarfEnabled || !this._fsBacked || !this._storage) return;
|
|
457
|
+
let t = S(), n = this._storage.getDownloadedVersion(), r = !1, i = !1;
|
|
458
|
+
n ? me(t, n) && (i = !0, this._storage.setDownloadedVersion(t)) : (i = !0, r = !0, this._storage.setDownloadedVersion(t)), i && await k({
|
|
459
|
+
...e || {},
|
|
460
|
+
mcp_use_version: t,
|
|
461
|
+
user_id: this.userId,
|
|
462
|
+
event: "package_download",
|
|
463
|
+
first_download: r,
|
|
464
|
+
language: "typescript",
|
|
465
|
+
source: this._source,
|
|
466
|
+
runtime: this._runtimeEnvironment
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
async trackAgentExecution(e) {
|
|
470
|
+
this.isEnabled && await this.capture(new te(e));
|
|
471
|
+
}
|
|
472
|
+
async trackMCPClientInit(e) {
|
|
473
|
+
this.isEnabled && await this.capture(new ne(e));
|
|
474
|
+
}
|
|
475
|
+
async trackConnectorInit(e) {
|
|
476
|
+
this.isEnabled && await this.capture(new re(e));
|
|
477
|
+
}
|
|
478
|
+
async trackClientAddServer(e, t) {
|
|
479
|
+
this.isEnabled && await this.capture(new ie({
|
|
480
|
+
serverName: e,
|
|
481
|
+
serverConfig: t
|
|
482
|
+
}));
|
|
483
|
+
}
|
|
484
|
+
async trackClientRemoveServer(e) {
|
|
485
|
+
this.isEnabled && await this.capture(new ae({ serverName: e }));
|
|
486
|
+
}
|
|
487
|
+
async trackUseMcpConnection(e) {
|
|
488
|
+
this.isEnabled && await this.capture({
|
|
489
|
+
name: "usemcp_connection",
|
|
490
|
+
properties: {
|
|
491
|
+
url_domain: new URL(e.url).hostname,
|
|
492
|
+
transport_type: e.transportType,
|
|
493
|
+
success: e.success,
|
|
494
|
+
error_type: e.errorType ?? null,
|
|
495
|
+
connection_time_ms: e.connectionTimeMs ?? null,
|
|
496
|
+
has_oauth: e.hasOAuth,
|
|
497
|
+
has_sampling: e.hasSampling,
|
|
498
|
+
has_elicitation: e.hasElicitation
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
async trackUseMcpToolCall(e) {
|
|
503
|
+
this.isEnabled && await this.capture({
|
|
504
|
+
name: "usemcp_tool_call",
|
|
505
|
+
properties: {
|
|
506
|
+
tool_name: e.toolName,
|
|
507
|
+
success: e.success,
|
|
508
|
+
error_type: e.errorType ?? null,
|
|
509
|
+
execution_time_ms: e.executionTimeMs ?? null
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
async trackUseMcpResourceRead(e) {
|
|
514
|
+
this.isEnabled && await this.capture({
|
|
515
|
+
name: "usemcp_resource_read",
|
|
516
|
+
properties: {
|
|
517
|
+
resource_uri_scheme: e.resourceUri.split(":")[0],
|
|
518
|
+
success: e.success,
|
|
519
|
+
error_type: e.errorType ?? null
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
identify(e, t) {
|
|
524
|
+
this._currUserId = e, this._storage?.setUserId(e), this._telemetryEnabled && O({
|
|
525
|
+
host: N,
|
|
526
|
+
apiKey: M,
|
|
527
|
+
event: "$identify",
|
|
528
|
+
distinctId: e,
|
|
529
|
+
properties: { $set: t ?? {} }
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
reset() {
|
|
533
|
+
this._currUserId = null;
|
|
534
|
+
}
|
|
535
|
+
flush() {
|
|
536
|
+
Promise.allSettled([...this._pending]);
|
|
537
|
+
}
|
|
538
|
+
async shutdown() {
|
|
539
|
+
try {
|
|
540
|
+
await Promise.allSettled([...this._pending]), b.debug("Telemetry fetch captures flushed");
|
|
541
|
+
} catch (e) {
|
|
542
|
+
b.debug(`Error flushing telemetry captures: ${e}`);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}, L = I;
|
|
546
|
+
function R(e) {
|
|
547
|
+
L.getInstance().setSource(e);
|
|
548
|
+
}
|
|
549
|
+
d({
|
|
550
|
+
addServer: (e, t) => I.getInstance().trackClientAddServer(e, t).catch(() => void 0),
|
|
551
|
+
removeServer: (e) => I.getInstance().trackClientRemoveServer(e).catch(() => void 0)
|
|
552
|
+
}), h((e) => I.getInstance().trackConnectorInit(e).catch(() => void 0));
|
|
553
|
+
function z(e) {
|
|
554
|
+
let t = () => {
|
|
555
|
+
throw Error(`Invalid url to pass to open(): ${e}`);
|
|
556
|
+
}, n;
|
|
557
|
+
try {
|
|
558
|
+
n = new URL(e);
|
|
559
|
+
} catch {
|
|
560
|
+
t();
|
|
561
|
+
}
|
|
562
|
+
return n.protocol !== "https:" && n.protocol !== "http:" && t(), n.hostname !== encodeURIComponent(n.hostname) && t(), n.username &&= encodeURIComponent(n.username), n.password &&= encodeURIComponent(n.password), n.pathname = n.pathname.slice(0, 1) + encodeURIComponent(n.pathname.slice(1)).replace(/%2f/gi, "/"), n.search = n.search.slice(0, 1) + Array.from(n.searchParams.entries()).map(be).join("&"), n.hash = n.hash.slice(0, 1) + encodeURIComponent(n.hash.slice(1)), n.href;
|
|
563
|
+
}
|
|
564
|
+
function be([e, t]) {
|
|
565
|
+
return `${encodeURIComponent(e)}${t.length > 0 ? `=${encodeURIComponent(t)}` : ""}`;
|
|
566
|
+
}
|
|
567
|
+
var xe = class {
|
|
568
|
+
get(e) {
|
|
569
|
+
return localStorage.getItem(e);
|
|
570
|
+
}
|
|
571
|
+
set(e, t) {
|
|
572
|
+
localStorage.setItem(e, t);
|
|
573
|
+
}
|
|
574
|
+
remove(e) {
|
|
575
|
+
localStorage.removeItem(e);
|
|
576
|
+
}
|
|
577
|
+
keys() {
|
|
578
|
+
let e = [];
|
|
579
|
+
for (let t = 0; t < localStorage.length; t++) {
|
|
580
|
+
let n = localStorage.key(t);
|
|
581
|
+
n && e.push(n);
|
|
582
|
+
}
|
|
583
|
+
return e;
|
|
584
|
+
}
|
|
585
|
+
}, Se = class e {
|
|
586
|
+
serverUrl;
|
|
587
|
+
storageKeyPrefix;
|
|
588
|
+
serverUrlHash;
|
|
589
|
+
clientName;
|
|
590
|
+
clientUri;
|
|
591
|
+
logoUri;
|
|
592
|
+
callbackUrl;
|
|
593
|
+
clientMetadataUrl;
|
|
594
|
+
scope;
|
|
595
|
+
store;
|
|
596
|
+
allowClientSecret;
|
|
597
|
+
constructor(n, r, i) {
|
|
598
|
+
t(r.clientMetadataUrl), this.serverUrl = n, this.storageKeyPrefix = r.storageKeyPrefix || "mcp:auth", this.serverUrlHash = e.hashString(n), this.clientName = r.clientName || "mcp-use", this.clientUri = r.clientUri || (typeof window < "u" ? window.location.origin : "https://mcp-use.com"), this.logoUri = r.logoUri || "https://mcp-use.com/logo.png", this.callbackUrl = z(r.callbackUrl || (typeof window < "u" ? new URL("/oauth/callback", window.location.origin).toString() : "/oauth/callback")), this.clientMetadataUrl = r.clientMetadataUrl, this.scope = r.scope, this.store = i, this.allowClientSecret = r.allowClientSecret ?? !0;
|
|
599
|
+
}
|
|
600
|
+
getKey(e) {
|
|
601
|
+
return `${this.storageKeyPrefix}_${this.serverUrlHash}_${e}`;
|
|
602
|
+
}
|
|
603
|
+
static hashString(e) {
|
|
604
|
+
let t = 0;
|
|
605
|
+
for (let n = 0; n < e.length; n++) {
|
|
606
|
+
let r = e.charCodeAt(n);
|
|
607
|
+
t = (t << 5) - t + r, t &= t;
|
|
608
|
+
}
|
|
609
|
+
return Math.abs(t).toString(16);
|
|
610
|
+
}
|
|
611
|
+
get redirectUrl() {
|
|
612
|
+
return this.callbackUrl;
|
|
613
|
+
}
|
|
614
|
+
get clientMetadata() {
|
|
615
|
+
return {
|
|
616
|
+
redirect_uris: [this.redirectUrl],
|
|
617
|
+
token_endpoint_auth_method: "none",
|
|
618
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
619
|
+
response_types: ["code"],
|
|
620
|
+
client_name: this.clientName,
|
|
621
|
+
client_uri: this.clientUri,
|
|
622
|
+
logo_uri: this.logoUri,
|
|
623
|
+
...this.scope ? { scope: this.scope } : {}
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
credentialKey(e, t) {
|
|
627
|
+
return t ? this.getKey(`${e}_${encodeURIComponent(t.issuer)}`) : this.getKey(e);
|
|
628
|
+
}
|
|
629
|
+
async readCredential(e, t) {
|
|
630
|
+
let n = this.credentialKey(e, t), r = await this.store.get(n);
|
|
631
|
+
if (!r && t) {
|
|
632
|
+
let r = this.credentialKey(e), i = await this.store.get(r);
|
|
633
|
+
if (i) try {
|
|
634
|
+
let e = JSON.parse(i);
|
|
635
|
+
if (!e.issuer || e.issuer === t.issuer) {
|
|
636
|
+
let i = {
|
|
637
|
+
...e,
|
|
638
|
+
issuer: t.issuer
|
|
639
|
+
}, a = JSON.stringify(i);
|
|
640
|
+
return await this.store.set(n, a), await this.store.set(r, a), {
|
|
641
|
+
key: n,
|
|
642
|
+
value: i
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
} catch {
|
|
646
|
+
await this.store.remove(r);
|
|
647
|
+
}
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (r) try {
|
|
651
|
+
return {
|
|
652
|
+
key: n,
|
|
653
|
+
value: JSON.parse(r)
|
|
654
|
+
};
|
|
655
|
+
} catch (t) {
|
|
656
|
+
console.warn(`[${this.storageKeyPrefix}] Failed to parse ${e.replace("_", " ")}:`, t), await this.store.remove(n);
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
async tokens(e) {
|
|
661
|
+
return (await this.readCredential("tokens", e))?.value;
|
|
662
|
+
}
|
|
663
|
+
async saveTokens(e, t) {
|
|
664
|
+
let n = JSON.stringify(e);
|
|
665
|
+
await this.store.set(this.credentialKey("tokens", t), n), t && await this.store.set(this.credentialKey("tokens"), n), await this.store.remove(this.getKey("code_verifier")), await this.store.remove(this.getKey("last_auth_url"));
|
|
666
|
+
}
|
|
667
|
+
async clientInformation(e) {
|
|
668
|
+
let t = await this.readCredential("client_info", e);
|
|
669
|
+
if (!t) return;
|
|
670
|
+
let { key: n, value: r } = t;
|
|
671
|
+
try {
|
|
672
|
+
if (!this.allowClientSecret && r.client_secret) {
|
|
673
|
+
await this.store.remove(n), e && await this.store.remove(this.credentialKey("client_info")), console.warn(`[${this.storageKeyPrefix}] Removed OAuth client information containing a browser client_secret.`);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
let t = Array.isArray(r.redirect_uris) ? r.redirect_uris : [];
|
|
677
|
+
if (!(t.length === 0 || t.includes(this.redirectUrl))) {
|
|
678
|
+
console.info(`[${this.storageKeyPrefix}] Invalidating cached OAuth client info due to redirect URI mismatch.`), await this.store.remove(n), await this.store.remove(this.credentialKey("tokens", e)), await this.store.remove(this.getKey("last_auth_url"));
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
return r;
|
|
682
|
+
} catch {
|
|
683
|
+
await this.store.remove(n);
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
async saveClientInformation(e, t) {
|
|
688
|
+
let n = e;
|
|
689
|
+
if (!this.allowClientSecret && n.client_secret) throw await this.store.remove(this.credentialKey("client_info", t)), t && await this.store.remove(this.credentialKey("client_info")), Error("Browser OAuth clients must be public clients; client_secret persistence is not allowed.");
|
|
690
|
+
let r = JSON.stringify(e);
|
|
691
|
+
await this.store.set(this.credentialKey("client_info", t), r), t && await this.store.set(this.credentialKey("client_info"), r);
|
|
692
|
+
}
|
|
693
|
+
async saveCodeVerifier(e) {
|
|
694
|
+
await this.store.set(this.getKey("code_verifier"), e);
|
|
695
|
+
}
|
|
696
|
+
async codeVerifier() {
|
|
697
|
+
let e = this.getKey("code_verifier"), t = await this.store.get(e);
|
|
698
|
+
if (!t) throw Error(`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${e}. Auth flow likely corrupted or timed out.`);
|
|
699
|
+
return t;
|
|
700
|
+
}
|
|
701
|
+
async invalidateCredentials(e) {
|
|
702
|
+
let t = async (e) => {
|
|
703
|
+
let t = `${this.getKey(e)}_`;
|
|
704
|
+
for (let n of await this.store.keys()) (n === this.getKey(e) || n.startsWith(t)) && await this.store.remove(n);
|
|
705
|
+
};
|
|
706
|
+
switch (e) {
|
|
707
|
+
case "all":
|
|
708
|
+
await t("tokens"), await t("client_info"), await this.store.remove(this.getKey("code_verifier")), await this.store.remove(this.getKey("last_auth_url")), await this.store.remove(this.getKey("discovery_state")), await this.store.remove(this.getKey("token_endpoint"));
|
|
709
|
+
break;
|
|
710
|
+
case "client":
|
|
711
|
+
await t("client_info");
|
|
712
|
+
break;
|
|
713
|
+
case "tokens":
|
|
714
|
+
await t("tokens");
|
|
715
|
+
break;
|
|
716
|
+
case "verifier":
|
|
717
|
+
await this.store.remove(this.getKey("code_verifier"));
|
|
718
|
+
break;
|
|
719
|
+
case "discovery":
|
|
720
|
+
await this.store.remove(this.getKey("discovery_state"));
|
|
721
|
+
break;
|
|
722
|
+
default: break;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
async saveDiscoveryState(e) {
|
|
726
|
+
await this.store.set(this.getKey("discovery_state"), JSON.stringify(e));
|
|
727
|
+
}
|
|
728
|
+
async discoveryState() {
|
|
729
|
+
let e = await this.store.get(this.getKey("discovery_state"));
|
|
730
|
+
if (e) try {
|
|
731
|
+
return JSON.parse(e);
|
|
732
|
+
} catch {
|
|
733
|
+
await this.store.remove(this.getKey("discovery_state"));
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
async storeAuthorizationState(e, t = {}) {
|
|
738
|
+
let n = globalThis.crypto.randomUUID(), r = `${this.storageKeyPrefix}:state_${n}`, i = {
|
|
739
|
+
serverUrlHash: this.serverUrlHash,
|
|
740
|
+
expiry: Date.now() + 1e3 * 60 * 10,
|
|
741
|
+
providerOptions: {
|
|
742
|
+
serverUrl: this.serverUrl,
|
|
743
|
+
storageKeyPrefix: this.storageKeyPrefix,
|
|
744
|
+
clientName: this.clientName,
|
|
745
|
+
clientUri: this.clientUri,
|
|
746
|
+
callbackUrl: this.callbackUrl,
|
|
747
|
+
...this.clientMetadataUrl ? { clientMetadataUrl: this.clientMetadataUrl } : {},
|
|
748
|
+
...t.extraProviderOptions ?? {}
|
|
749
|
+
},
|
|
750
|
+
flowType: t.flowType,
|
|
751
|
+
returnUrl: t.returnUrl
|
|
752
|
+
};
|
|
753
|
+
e.searchParams.set("state", n);
|
|
754
|
+
let a = z(e.toString());
|
|
755
|
+
return await this.store.set(r, JSON.stringify(i)), await this.store.set(this.getKey("last_auth_url"), a), a;
|
|
756
|
+
}
|
|
757
|
+
async getTokenEndpoint() {
|
|
758
|
+
return (await this.discoveryState())?.authorizationServerMetadata?.token_endpoint ?? null;
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
async function Ce(e) {
|
|
762
|
+
return typeof e == "string" ? e : e instanceof URLSearchParams || e instanceof FormData ? Object.fromEntries(e.entries()) : e instanceof Blob ? await e.text() : e;
|
|
763
|
+
}
|
|
764
|
+
var B = class {
|
|
765
|
+
serverUrl;
|
|
766
|
+
staticClientInfo;
|
|
767
|
+
session;
|
|
768
|
+
preventAutoAuth;
|
|
769
|
+
useRedirectFlow;
|
|
770
|
+
oauthProxyUrl;
|
|
771
|
+
connectionUrl;
|
|
772
|
+
proxyOAuthRequests;
|
|
773
|
+
onPopupWindow;
|
|
774
|
+
constructor(e, t = {}) {
|
|
775
|
+
if (t.staticClientInfo?.client_secret) throw Error("Browser OAuth clients must be public clients; staticClientInfo.client_secret is not allowed.");
|
|
776
|
+
this.serverUrl = e, this.session = new Se(e, {
|
|
777
|
+
...t,
|
|
778
|
+
allowClientSecret: !1
|
|
779
|
+
}, new xe()), this.preventAutoAuth = t.preventAutoAuth, this.useRedirectFlow = t.useRedirectFlow, this.oauthProxyUrl = t.oauthProxyUrl, this.connectionUrl = t.connectionUrl, this.proxyOAuthRequests = t.proxyOAuthRequests ?? !0, this.staticClientInfo = t.staticClientInfo, this.onPopupWindow = t.onPopupWindow;
|
|
780
|
+
}
|
|
781
|
+
get storageKeyPrefix() {
|
|
782
|
+
return this.session.storageKeyPrefix;
|
|
783
|
+
}
|
|
784
|
+
get serverUrlHash() {
|
|
785
|
+
return this.session.serverUrlHash;
|
|
786
|
+
}
|
|
787
|
+
get clientName() {
|
|
788
|
+
return this.session.clientName;
|
|
789
|
+
}
|
|
790
|
+
get clientUri() {
|
|
791
|
+
return this.session.clientUri;
|
|
792
|
+
}
|
|
793
|
+
get logoUri() {
|
|
794
|
+
return this.session.logoUri;
|
|
795
|
+
}
|
|
796
|
+
get callbackUrl() {
|
|
797
|
+
return this.session.callbackUrl;
|
|
798
|
+
}
|
|
799
|
+
get scope() {
|
|
800
|
+
return this.session.scope;
|
|
801
|
+
}
|
|
802
|
+
get clientMetadataUrl() {
|
|
803
|
+
return this.session.clientMetadataUrl;
|
|
804
|
+
}
|
|
805
|
+
getKey(e) {
|
|
806
|
+
return this.session.getKey(e);
|
|
807
|
+
}
|
|
808
|
+
reanchorWellKnownUrl(e) {
|
|
809
|
+
if (!this.connectionUrl) return e;
|
|
810
|
+
try {
|
|
811
|
+
let t = new URL(e), n = new URL(this.connectionUrl);
|
|
812
|
+
if (t.origin !== n.origin || !t.pathname.startsWith("/.well-known/")) return e;
|
|
813
|
+
let r = new URL(this.serverUrl), [i, ...a] = t.pathname.slice(13).split("/");
|
|
814
|
+
if (!i) return e;
|
|
815
|
+
let o = a.length ? `/${a.join("/")}` : "", s = n.pathname.replace(/\/+$/, ""), c = r.pathname.replace(/\/+$/, ""), l = o && o === s ? c : o;
|
|
816
|
+
return `${r.origin}/.well-known/${i}${l}${t.search}`;
|
|
817
|
+
} catch {
|
|
818
|
+
return e;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
getProxyFetch(e) {
|
|
822
|
+
if (!this.proxyOAuthRequests || !this.oauthProxyUrl) return e;
|
|
823
|
+
let t = e ?? globalThis.fetch.bind(globalThis), n = this.oauthProxyUrl, r = /* @__PURE__ */ new Set(), i = !1;
|
|
824
|
+
return async (e, a) => {
|
|
825
|
+
let o = typeof e == "string" ? e : e instanceof URL ? e.toString() : e.url, s = this.reanchorWellKnownUrl(o), c;
|
|
826
|
+
try {
|
|
827
|
+
c = new URL(s).pathname;
|
|
828
|
+
} catch {
|
|
829
|
+
return await t(e, a);
|
|
830
|
+
}
|
|
831
|
+
let l = c.includes("/.well-known/");
|
|
832
|
+
if (!i) {
|
|
833
|
+
i = !0;
|
|
834
|
+
let e = (await this.discoveryState())?.authorizationServerMetadata;
|
|
835
|
+
for (let t of [
|
|
836
|
+
"registration_endpoint",
|
|
837
|
+
"token_endpoint",
|
|
838
|
+
"revocation_endpoint",
|
|
839
|
+
"introspection_endpoint"
|
|
840
|
+
]) typeof e?.[t] == "string" && r.add(e[t]);
|
|
841
|
+
}
|
|
842
|
+
let u = r.has(s) || /\/(?:register|registration|token|revoke|revocation|introspect|introspection)\/?$/.test(c);
|
|
843
|
+
if (!l && !u) return await t(e, a);
|
|
844
|
+
try {
|
|
845
|
+
let r = new URL(s), i = new URL(n);
|
|
846
|
+
if (r.origin === i.origin && (r.pathname.startsWith(i.pathname) || s.includes("/inspector/api/oauth"))) return await t(e, a);
|
|
847
|
+
} catch {}
|
|
848
|
+
let d = l ? `${n}/metadata?serverUrl=${encodeURIComponent(this.serverUrl)}&url=${encodeURIComponent(s)}` : `${n}/proxy`;
|
|
849
|
+
if (l) {
|
|
850
|
+
let e = await t(d, {
|
|
851
|
+
...a,
|
|
852
|
+
method: "GET"
|
|
853
|
+
});
|
|
854
|
+
try {
|
|
855
|
+
let t = await e.clone().json();
|
|
856
|
+
for (let e of [
|
|
857
|
+
"registration_endpoint",
|
|
858
|
+
"token_endpoint",
|
|
859
|
+
"revocation_endpoint",
|
|
860
|
+
"introspection_endpoint"
|
|
861
|
+
]) typeof t[e] == "string" && r.add(t[e]);
|
|
862
|
+
} catch {}
|
|
863
|
+
return e;
|
|
864
|
+
}
|
|
865
|
+
let f = a?.body ? await Ce(a.body) : void 0, p = await (await t(d, {
|
|
866
|
+
method: "POST",
|
|
867
|
+
headers: { "Content-Type": "application/json" },
|
|
868
|
+
body: JSON.stringify({
|
|
869
|
+
serverUrl: this.serverUrl,
|
|
870
|
+
url: s,
|
|
871
|
+
method: a?.method || "POST",
|
|
872
|
+
headers: a?.headers ? Object.fromEntries(new Headers(a.headers)) : {},
|
|
873
|
+
body: f
|
|
874
|
+
})
|
|
875
|
+
})).json();
|
|
876
|
+
return new Response(JSON.stringify(p.body), {
|
|
877
|
+
status: p.status,
|
|
878
|
+
statusText: p.statusText,
|
|
879
|
+
headers: new Headers(p.headers)
|
|
880
|
+
});
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
get redirectUrl() {
|
|
884
|
+
return this.session.redirectUrl;
|
|
885
|
+
}
|
|
886
|
+
get clientMetadata() {
|
|
887
|
+
return this.session.clientMetadata;
|
|
888
|
+
}
|
|
889
|
+
tokens(e) {
|
|
890
|
+
return this.session.tokens(e);
|
|
891
|
+
}
|
|
892
|
+
saveTokens(e, t) {
|
|
893
|
+
return this.session.saveTokens(e, t);
|
|
894
|
+
}
|
|
895
|
+
async clientInformation(e) {
|
|
896
|
+
return this.staticClientInfo ? this.staticClientInfo : this.session.clientInformation(e);
|
|
897
|
+
}
|
|
898
|
+
async saveClientInformation(e, t) {
|
|
899
|
+
if (!this.staticClientInfo) return this.session.saveClientInformation(e, t);
|
|
900
|
+
}
|
|
901
|
+
codeVerifier() {
|
|
902
|
+
return this.session.codeVerifier();
|
|
903
|
+
}
|
|
904
|
+
saveCodeVerifier(e) {
|
|
905
|
+
return this.session.saveCodeVerifier(e);
|
|
906
|
+
}
|
|
907
|
+
invalidateCredentials(e) {
|
|
908
|
+
return this.session.invalidateCredentials(e);
|
|
909
|
+
}
|
|
910
|
+
saveDiscoveryState(e) {
|
|
911
|
+
return this.session.saveDiscoveryState(e);
|
|
912
|
+
}
|
|
913
|
+
discoveryState() {
|
|
914
|
+
return this.session.discoveryState();
|
|
915
|
+
}
|
|
916
|
+
getTokenEndpoint() {
|
|
917
|
+
return this.session.getTokenEndpoint();
|
|
918
|
+
}
|
|
919
|
+
async getClientCredentials() {
|
|
920
|
+
let e = await this.clientInformation();
|
|
921
|
+
return e?.client_id ? { client_id: e.client_id } : null;
|
|
922
|
+
}
|
|
923
|
+
async prepareAuthorizationUrl(e) {
|
|
924
|
+
return this.session.storeAuthorizationState(e, {
|
|
925
|
+
extraProviderOptions: {
|
|
926
|
+
oauthProxyUrl: this.oauthProxyUrl,
|
|
927
|
+
...this.clientMetadataUrl ? { clientMetadataUrl: this.clientMetadataUrl } : {},
|
|
928
|
+
...this.staticClientInfo ? { staticClientInfo: this.staticClientInfo } : {},
|
|
929
|
+
...this.scope ? { scope: this.scope } : {}
|
|
930
|
+
},
|
|
931
|
+
flowType: this.useRedirectFlow ? "redirect" : "popup",
|
|
932
|
+
returnUrl: typeof window < "u" ? window.location.href : void 0
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
async redirectToAuthorization(e) {
|
|
936
|
+
let t = await this.prepareAuthorizationUrl(e);
|
|
937
|
+
if (this.preventAutoAuth) {
|
|
938
|
+
console.info(`[${this.storageKeyPrefix}] Auto-auth prevented. Authorization URL stored for manual trigger.`);
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
if (this.useRedirectFlow) {
|
|
942
|
+
console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL (full-page redirect).`), window.location.href = t;
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
let n = "width=600,height=700,resizable=yes,scrollbars=yes,status=yes";
|
|
946
|
+
try {
|
|
947
|
+
let e = window.open(t, `mcp_auth_${this.serverUrlHash}`, n);
|
|
948
|
+
this.onPopupWindow && this.onPopupWindow(t, n, e), !e || e.closed || e.closed === void 0 ? console.warn(`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`) : (e.focus(), console.info(`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`));
|
|
949
|
+
} catch (e) {
|
|
950
|
+
console.error(`[${this.storageKeyPrefix}] Error opening popup window:`, e);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
getLastAttemptedAuthUrl() {
|
|
954
|
+
let e = localStorage.getItem(this.getKey("last_auth_url"));
|
|
955
|
+
return e ? z(e) : null;
|
|
956
|
+
}
|
|
957
|
+
clearStorage() {
|
|
958
|
+
let e = `${this.storageKeyPrefix}_${this.serverUrlHash}_`, t = `${this.storageKeyPrefix}:state_`, n = [], r = 0;
|
|
959
|
+
for (let r = 0; r < localStorage.length; r++) {
|
|
960
|
+
let i = localStorage.key(r);
|
|
961
|
+
if (i) {
|
|
962
|
+
if (i.startsWith(e)) n.push(i);
|
|
963
|
+
else if (i.startsWith(t)) try {
|
|
964
|
+
let e = localStorage.getItem(i);
|
|
965
|
+
e && JSON.parse(e).serverUrlHash === this.serverUrlHash && n.push(i);
|
|
966
|
+
} catch (e) {
|
|
967
|
+
console.warn(`[${this.storageKeyPrefix}] Error parsing state key ${i} during clearStorage:`, e);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
return [...new Set(n)].forEach((e) => {
|
|
972
|
+
localStorage.removeItem(e), r++;
|
|
973
|
+
}), r;
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
async function V(e, t = {}) {
|
|
977
|
+
return new B(e, t);
|
|
978
|
+
}
|
|
979
|
+
var we = "mcp_auth_callback", Te = "mcp_auth_callback";
|
|
980
|
+
function H(e) {
|
|
981
|
+
try {
|
|
982
|
+
return typeof localStorage < "u" && !!localStorage.getItem(e);
|
|
983
|
+
} catch {
|
|
984
|
+
return !1;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
function Ee({ popup: e, state: t, tokensKey: n, timeoutMs: r = 5 * 6e4, closePollMs: i = 1e3, closeGraceMs: a = 2e4, expectedOrigin: o = typeof window < "u" ? window.location.origin : "" }) {
|
|
988
|
+
return new Promise((s) => {
|
|
989
|
+
let c = !1, l = null, u = null, d = null, f = null, p = () => {
|
|
990
|
+
if (l &&= (clearInterval(l), null), u &&= (clearTimeout(u), null), d &&= (clearTimeout(d), null), typeof window < "u" && (window.removeEventListener("message", g), window.removeEventListener("storage", v)), f) {
|
|
991
|
+
try {
|
|
992
|
+
f.removeEventListener("message", _), f.close();
|
|
993
|
+
} catch {}
|
|
994
|
+
f = null;
|
|
995
|
+
}
|
|
996
|
+
}, m = (e) => {
|
|
997
|
+
c || (c = !0, p(), s(e));
|
|
998
|
+
}, h = (e) => {
|
|
999
|
+
!e || e.type !== Te || e.state && t && e.state !== t || (e.success ? m({ kind: "success" }) : m({
|
|
1000
|
+
kind: "error",
|
|
1001
|
+
error: e.error ?? "Authentication failed in callback."
|
|
1002
|
+
}));
|
|
1003
|
+
}, g = (e) => {
|
|
1004
|
+
o && e.origin !== o || h(e.data);
|
|
1005
|
+
}, _ = (e) => {
|
|
1006
|
+
h(e.data);
|
|
1007
|
+
}, v = (e) => {
|
|
1008
|
+
e.key === n && e.newValue && m({ kind: "success" });
|
|
1009
|
+
};
|
|
1010
|
+
if (typeof window < "u" && (window.addEventListener("message", g), window.addEventListener("storage", v)), typeof BroadcastChannel < "u") try {
|
|
1011
|
+
f = new BroadcastChannel(we), f.addEventListener("message", _);
|
|
1012
|
+
} catch {
|
|
1013
|
+
f = null;
|
|
1014
|
+
}
|
|
1015
|
+
e && (l = setInterval(() => {
|
|
1016
|
+
if (c) return;
|
|
1017
|
+
let t = !1;
|
|
1018
|
+
try {
|
|
1019
|
+
t = e.closed;
|
|
1020
|
+
} catch {
|
|
1021
|
+
t = !1;
|
|
1022
|
+
}
|
|
1023
|
+
if (t) {
|
|
1024
|
+
if (l &&= (clearInterval(l), null), H(n)) {
|
|
1025
|
+
m({ kind: "success" });
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
d = setTimeout(() => {
|
|
1029
|
+
m(H(n) ? { kind: "success" } : { kind: "cancelled" });
|
|
1030
|
+
}, a);
|
|
1031
|
+
}
|
|
1032
|
+
}, i)), u = setTimeout(() => {
|
|
1033
|
+
m(H(n) ? { kind: "success" } : { kind: "timeout" });
|
|
1034
|
+
}, r);
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
var De = 5 * 6e4;
|
|
1038
|
+
function U(e, t = 0) {
|
|
1039
|
+
if (!e || t > 5) return !1;
|
|
1040
|
+
if (e instanceof s) return !0;
|
|
1041
|
+
if (e instanceof Error) {
|
|
1042
|
+
if (e.code === 401 || e.name === "UnauthorizedError") return !0;
|
|
1043
|
+
let n = e.message ?? "";
|
|
1044
|
+
if (n.includes("401") || n.includes("Unauthorized") || e.cause && U(e.cause, t + 1)) return !0;
|
|
1045
|
+
let r = e.data;
|
|
1046
|
+
if (r?.cause && U(r.cause, t + 1)) return !0;
|
|
1047
|
+
}
|
|
1048
|
+
return !1;
|
|
1049
|
+
}
|
|
1050
|
+
async function W(e, t, n = {}) {
|
|
1051
|
+
let i = e, a = n.timeoutMs ?? De, o = n.fetchFn ?? i.getProxyFetch?.() ?? void 0;
|
|
1052
|
+
if (!i.hasPendingFlow) {
|
|
1053
|
+
let n = await r(e, {
|
|
1054
|
+
serverUrl: t,
|
|
1055
|
+
fetchFn: o
|
|
1056
|
+
});
|
|
1057
|
+
if (n === "AUTHORIZED") return;
|
|
1058
|
+
if (n !== "REDIRECT") throw Error(`Unexpected OAuth auth() result: ${n}`);
|
|
1059
|
+
}
|
|
1060
|
+
if (typeof i.getAuthorizationCode == "function") {
|
|
1061
|
+
await r(e, {
|
|
1062
|
+
serverUrl: t,
|
|
1063
|
+
authorizationCode: await i.getAuthorizationCode(),
|
|
1064
|
+
fetchFn: o
|
|
1065
|
+
});
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
await G(i, a);
|
|
1069
|
+
}
|
|
1070
|
+
async function G(e, t) {
|
|
1071
|
+
if (typeof window > "u") throw Error("OAuth redirect requires a browser environment or a provider with getAuthorizationCode()");
|
|
1072
|
+
if (e.useRedirectFlow) return;
|
|
1073
|
+
let n = e.getKey?.("tokens");
|
|
1074
|
+
if (!n) throw Error("Browser OAuth provider must expose getKey() for token storage");
|
|
1075
|
+
let r = null, i = e.getLastAttemptedAuthUrl?.();
|
|
1076
|
+
if (i) try {
|
|
1077
|
+
r = new URL(i).searchParams.get("state");
|
|
1078
|
+
} catch {}
|
|
1079
|
+
let a = await Ee({
|
|
1080
|
+
popup: null,
|
|
1081
|
+
state: r,
|
|
1082
|
+
tokensKey: n,
|
|
1083
|
+
timeoutMs: t
|
|
1084
|
+
});
|
|
1085
|
+
switch (a.kind) {
|
|
1086
|
+
case "success": return;
|
|
1087
|
+
case "cancelled": throw Error("OAuth authentication was cancelled.");
|
|
1088
|
+
case "timeout": throw Error(`OAuth callback not received within ${t}ms. Ensure /oauth/callback calls onMcpAuthorization().`);
|
|
1089
|
+
case "error": throw Error(a.error);
|
|
1090
|
+
default: throw Error("Unexpected OAuth popup result");
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
var Oe = "http://json-schema.org/draft-04/schema", ke = /* @__PURE__ */ new Set(["http://json-schema.org/draft-07/schema", "https://json-schema.org/draft-07/schema"]), Ae = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2019-09/schema", "http://json-schema.org/draft/2019-09/schema"]), je = /* @__PURE__ */ new Set(["https://json-schema.org/draft/2020-12/schema", "http://json-schema.org/draft/2020-12/schema"]);
|
|
1094
|
+
function Me(e) {
|
|
1095
|
+
if (!("$schema" in e) || typeof e.$schema != "string") return "2020-12";
|
|
1096
|
+
let t = e.$schema.replace(/#$/, "");
|
|
1097
|
+
if (t === Oe) return "4";
|
|
1098
|
+
if (ke.has(t)) return "7";
|
|
1099
|
+
if (Ae.has(t)) return "2019-09";
|
|
1100
|
+
if (je.has(t)) return "2020-12";
|
|
1101
|
+
}
|
|
1102
|
+
var K = class {
|
|
1103
|
+
getValidator(e) {
|
|
1104
|
+
let t = Me(e);
|
|
1105
|
+
return (t === void 0 ? new o() : new o({ draft: t })).getValidator(e);
|
|
1106
|
+
}
|
|
1107
|
+
}, Ne = { "~standard": {
|
|
1108
|
+
version: 1,
|
|
1109
|
+
vendor: "mcp-use",
|
|
1110
|
+
validate: (e) => ({ value: e })
|
|
1111
|
+
} }, q = class {
|
|
1112
|
+
client = null;
|
|
1113
|
+
connectionManager = null;
|
|
1114
|
+
toolsCache = null;
|
|
1115
|
+
capabilitiesCache = null;
|
|
1116
|
+
serverInfoCache = null;
|
|
1117
|
+
connected = !1;
|
|
1118
|
+
opts;
|
|
1119
|
+
notificationHandlers = [];
|
|
1120
|
+
rootsCache = [];
|
|
1121
|
+
activeProgressHandlers = /* @__PURE__ */ new Set();
|
|
1122
|
+
constructor(e = {}) {
|
|
1123
|
+
this.opts = e, e.roots && (this.rootsCache = [...e.roots]), e.onNotification && this.notificationHandlers.push(e.onNotification);
|
|
1124
|
+
}
|
|
1125
|
+
trackConnectorInit(e) {
|
|
1126
|
+
let t = this.constructor.name;
|
|
1127
|
+
g({
|
|
1128
|
+
connectorType: t,
|
|
1129
|
+
...e
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
onNotification(e) {
|
|
1133
|
+
this.notificationHandlers.push(e), this.client && this.setupNotificationHandler();
|
|
1134
|
+
}
|
|
1135
|
+
async forwardNotification(e) {
|
|
1136
|
+
for (let t of this.notificationHandlers) try {
|
|
1137
|
+
await t(e);
|
|
1138
|
+
} catch (e) {
|
|
1139
|
+
b.error("Error in notification handler:", e);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
async handleListChanged(e, t, n) {
|
|
1143
|
+
if (t) {
|
|
1144
|
+
b.warn(`[Auto] ${e} refresh failed:`, t);
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
|
+
e === "notifications/tools/list_changed" && n && (this.toolsCache = [...n]), await this.forwardNotification({ method: e });
|
|
1148
|
+
}
|
|
1149
|
+
setupNotificationHandler() {
|
|
1150
|
+
if (!this.client) return;
|
|
1151
|
+
this.client.fallbackNotificationHandler = async (e) => {
|
|
1152
|
+
switch (e.method) {
|
|
1153
|
+
case "notifications/tools/list_changed":
|
|
1154
|
+
await this.refreshToolsCache();
|
|
1155
|
+
break;
|
|
1156
|
+
case "notifications/resources/list_changed":
|
|
1157
|
+
await this.onResourcesListChanged();
|
|
1158
|
+
break;
|
|
1159
|
+
case "notifications/prompts/list_changed":
|
|
1160
|
+
await this.onPromptsListChanged();
|
|
1161
|
+
break;
|
|
1162
|
+
default: break;
|
|
1163
|
+
}
|
|
1164
|
+
await this.forwardNotification(e);
|
|
1165
|
+
};
|
|
1166
|
+
let e = this.client._notificationHandlers;
|
|
1167
|
+
for (let t of ["notifications/progress", "notifications/cancelled"]) {
|
|
1168
|
+
let n = e.get(t);
|
|
1169
|
+
n && e.set(t, async (e) => {
|
|
1170
|
+
await n(e), await this.forwardNotification(e);
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
setupRoundProgressForwarding() {
|
|
1175
|
+
if (!this.client) return;
|
|
1176
|
+
let e = this.client, t = e._onnotification.bind(this.client);
|
|
1177
|
+
e._onnotification = async (e) => {
|
|
1178
|
+
e && typeof e == "object" && e.method === "notifications/progress" && this.forwardRoundProgress(e.params), await t?.(e);
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
forwardRoundProgress(e) {
|
|
1182
|
+
if (this.activeProgressHandlers.size === 1) {
|
|
1183
|
+
let [t] = this.activeProgressHandlers;
|
|
1184
|
+
t?.(e);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
async refreshToolsCache() {
|
|
1188
|
+
if (this.client) try {
|
|
1189
|
+
b.debug("[Auto] Refreshing tools cache due to list_changed notification");
|
|
1190
|
+
let e = await this.client.listTools();
|
|
1191
|
+
this.toolsCache = e.tools ?? [], b.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`);
|
|
1192
|
+
} catch (e) {
|
|
1193
|
+
b.warn("[Auto] Failed to refresh tools cache:", e);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
async onResourcesListChanged() {
|
|
1197
|
+
b.debug("[Auto] Resources list changed - clients should re-fetch if needed");
|
|
1198
|
+
}
|
|
1199
|
+
async onPromptsListChanged() {
|
|
1200
|
+
b.debug("[Auto] Prompts list changed - clients should re-fetch if needed");
|
|
1201
|
+
}
|
|
1202
|
+
async setRoots(e) {
|
|
1203
|
+
this.rootsCache = [...e], this.client && (b.debug(`Sending roots/list_changed notification with ${e.length} root(s)`), await this.client.sendRootsListChanged());
|
|
1204
|
+
}
|
|
1205
|
+
getRoots() {
|
|
1206
|
+
return [...this.rootsCache];
|
|
1207
|
+
}
|
|
1208
|
+
setupRootsHandler() {
|
|
1209
|
+
this.client && this.client.setRequestHandler("roots/list", async () => (b.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`), { roots: this.rootsCache }));
|
|
1210
|
+
}
|
|
1211
|
+
setupSamplingHandler() {
|
|
1212
|
+
if (!this.client) {
|
|
1213
|
+
b.debug("setupSamplingHandler: No client available");
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
let e = this.opts.onSampling;
|
|
1217
|
+
if (!e) {
|
|
1218
|
+
b.debug("setupSamplingHandler: No sampling callback provided");
|
|
1219
|
+
return;
|
|
1220
|
+
}
|
|
1221
|
+
b.debug("setupSamplingHandler: Setting up sampling request handler"), this.client.setRequestHandler("sampling/createMessage", async (t) => (b.debug("Server requested sampling, forwarding to callback"), await e(t.params))), b.debug("setupSamplingHandler: Sampling handler registered successfully");
|
|
1222
|
+
}
|
|
1223
|
+
setupElicitationHandler() {
|
|
1224
|
+
if (!this.client) {
|
|
1225
|
+
b.debug("setupElicitationHandler: No client available");
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1228
|
+
let e = this.opts.onElicitation;
|
|
1229
|
+
if (!e) {
|
|
1230
|
+
b.debug("setupElicitationHandler: No elicitation callback provided");
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
b.debug("setupElicitationHandler: Setting up elicitation request handler"), this.client.setRequestHandler("elicitation/create", async (t) => (b.debug("Server requested elicitation, forwarding to callback"), await e(t.params))), b.debug("setupElicitationHandler: Elicitation handler registered successfully");
|
|
1234
|
+
}
|
|
1235
|
+
async disconnect() {
|
|
1236
|
+
if (!this.connected) {
|
|
1237
|
+
b.debug("Not connected to MCP implementation");
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
b.debug("Disconnecting from MCP implementation"), await this.cleanupResources(), this.connected = !1, b.debug("Disconnected from MCP implementation");
|
|
1241
|
+
}
|
|
1242
|
+
get isClientConnected() {
|
|
1243
|
+
return this.client != null;
|
|
1244
|
+
}
|
|
1245
|
+
async initialize(e = this.opts.defaultRequestOptions ?? {}) {
|
|
1246
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1247
|
+
b.debug("Caching server capabilities & tools");
|
|
1248
|
+
let t = this.client.getServerCapabilities();
|
|
1249
|
+
this.capabilitiesCache = t || null;
|
|
1250
|
+
let n = this.client.getServerVersion();
|
|
1251
|
+
this.serverInfoCache = n ? {
|
|
1252
|
+
name: n.name,
|
|
1253
|
+
version: n.version,
|
|
1254
|
+
title: n.title,
|
|
1255
|
+
description: n.description,
|
|
1256
|
+
websiteUrl: n.websiteUrl,
|
|
1257
|
+
icons: n.icons
|
|
1258
|
+
} : null;
|
|
1259
|
+
try {
|
|
1260
|
+
let t = await this.client.listTools(void 0, e);
|
|
1261
|
+
this.toolsCache = t.tools ?? [], b.debug(`Fetched ${this.toolsCache.length} tools from server`);
|
|
1262
|
+
} catch (e) {
|
|
1263
|
+
let t = e;
|
|
1264
|
+
t.code === -32601 ? b.debug("Server does not implement tools/list, assuming no tools") : b.debug("Failed to list tools, assuming empty:", t.message), this.toolsCache = [];
|
|
1265
|
+
}
|
|
1266
|
+
return b.debug("Server capabilities:", t), b.debug("Server info:", n), t;
|
|
1267
|
+
}
|
|
1268
|
+
get tools() {
|
|
1269
|
+
if (!this.toolsCache) throw Error("MCP client is not initialized; call initialize() first");
|
|
1270
|
+
return this.toolsCache;
|
|
1271
|
+
}
|
|
1272
|
+
get serverCapabilities() {
|
|
1273
|
+
return this.capabilitiesCache || {};
|
|
1274
|
+
}
|
|
1275
|
+
get serverInfo() {
|
|
1276
|
+
return this.serverInfoCache;
|
|
1277
|
+
}
|
|
1278
|
+
get instructions() {
|
|
1279
|
+
return this.client?.getInstructions?.();
|
|
1280
|
+
}
|
|
1281
|
+
get protocolEra() {
|
|
1282
|
+
return this.client?.getProtocolEra?.();
|
|
1283
|
+
}
|
|
1284
|
+
get negotiatedProtocolVersion() {
|
|
1285
|
+
return this.client?.getNegotiatedProtocolVersion?.();
|
|
1286
|
+
}
|
|
1287
|
+
async callTool(e, t, n) {
|
|
1288
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1289
|
+
let r = n ? { ...n } : void 0;
|
|
1290
|
+
r?.resetTimeoutOnProgress && !r.onprogress && (r.onprogress = () => {}, b.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)), b.debug(`Calling tool '${e}' with args`, t);
|
|
1291
|
+
let i = r?.onprogress;
|
|
1292
|
+
i && this.activeProgressHandlers.add(i);
|
|
1293
|
+
try {
|
|
1294
|
+
let n = await this.client.callTool({
|
|
1295
|
+
name: e,
|
|
1296
|
+
arguments: t
|
|
1297
|
+
}, r);
|
|
1298
|
+
return b.debug(`Tool '${e}' returned`, n), n;
|
|
1299
|
+
} finally {
|
|
1300
|
+
i && this.activeProgressHandlers.delete(i);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
async listTools(e) {
|
|
1304
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1305
|
+
b.debug("[listTools] Fetching fresh tools from server...");
|
|
1306
|
+
let t = await this.client.listTools(void 0, e), n = t.tools ? [...t.tools] : [];
|
|
1307
|
+
return b.debug(`[listTools] Returned ${n.length} tools:`, n.map((e) => e.name)), n;
|
|
1308
|
+
}
|
|
1309
|
+
async listResources(e, t) {
|
|
1310
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1311
|
+
return b.debug("Listing resources", e ? `with cursor: ${e}` : ""), await this.client.listResources({ cursor: e }, t);
|
|
1312
|
+
}
|
|
1313
|
+
async listAllResources(e) {
|
|
1314
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1315
|
+
if (!this.capabilitiesCache?.resources) return b.debug("Server does not advertise resources capability, skipping"), { resources: [] };
|
|
1316
|
+
try {
|
|
1317
|
+
b.debug("Listing all resources (with auto-pagination)");
|
|
1318
|
+
let t = [], n;
|
|
1319
|
+
do {
|
|
1320
|
+
let r = await this.client.listResources({ cursor: n }, e);
|
|
1321
|
+
t.push(...r.resources || []), n = r.nextCursor;
|
|
1322
|
+
} while (n);
|
|
1323
|
+
return { resources: t };
|
|
1324
|
+
} catch (e) {
|
|
1325
|
+
if (e.code === -32601) return b.debug("Server advertised resources but method not found"), { resources: [] };
|
|
1326
|
+
throw e;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
async listResourceTemplates(e) {
|
|
1330
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1331
|
+
return b.debug("Listing resource templates"), await this.client.listResourceTemplates(void 0, e);
|
|
1332
|
+
}
|
|
1333
|
+
async complete(e, t) {
|
|
1334
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1335
|
+
b.debug("[complete] Requesting completions for:", e.ref);
|
|
1336
|
+
let n = await this.client.complete(e, t);
|
|
1337
|
+
return b.debug(`[complete] Received ${n.completion.values.length} suggestions`), n;
|
|
1338
|
+
}
|
|
1339
|
+
async readResource(e, t) {
|
|
1340
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1341
|
+
return b.debug(`Reading resource ${e}`), await this.client.readResource({ uri: e }, t);
|
|
1342
|
+
}
|
|
1343
|
+
async subscribeToResource(e, t) {
|
|
1344
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1345
|
+
return b.debug(`Subscribing to resource: ${e}`), await this.client.subscribeResource({ uri: e }, t);
|
|
1346
|
+
}
|
|
1347
|
+
async unsubscribeFromResource(e, t) {
|
|
1348
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1349
|
+
return b.debug(`Unsubscribing from resource: ${e}`), await this.client.unsubscribeResource({ uri: e }, t);
|
|
1350
|
+
}
|
|
1351
|
+
async listPrompts() {
|
|
1352
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1353
|
+
if (!this.capabilitiesCache?.prompts) return b.debug("Server does not advertise prompts capability, skipping"), { prompts: [] };
|
|
1354
|
+
try {
|
|
1355
|
+
return b.debug("Listing prompts"), await this.client.listPrompts();
|
|
1356
|
+
} catch (e) {
|
|
1357
|
+
if (e.code === -32601) return b.debug("Server advertised prompts but method not found"), { prompts: [] };
|
|
1358
|
+
throw e;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
async getPrompt(e, t) {
|
|
1362
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1363
|
+
return b.debug(`Getting prompt ${e}`), await this.client.getPrompt({
|
|
1364
|
+
name: e,
|
|
1365
|
+
arguments: t
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
async request(e, t = null, n) {
|
|
1369
|
+
if (!this.client) throw Error("MCP client is not connected");
|
|
1370
|
+
return b.debug(`Sending raw request '${e}' with params`, t), await this.client.request({
|
|
1371
|
+
method: e,
|
|
1372
|
+
params: t ?? {}
|
|
1373
|
+
}, Ne, n);
|
|
1374
|
+
}
|
|
1375
|
+
async cleanupResources() {
|
|
1376
|
+
let e = [];
|
|
1377
|
+
if (this.client) try {
|
|
1378
|
+
typeof this.client.close == "function" && await this.client.close();
|
|
1379
|
+
} catch (t) {
|
|
1380
|
+
let n = `Error closing client: ${t}`;
|
|
1381
|
+
b.warn(n), e.push(n);
|
|
1382
|
+
} finally {
|
|
1383
|
+
this.client = null;
|
|
1384
|
+
}
|
|
1385
|
+
if (this.connectionManager) try {
|
|
1386
|
+
await this.connectionManager.stop();
|
|
1387
|
+
} catch (t) {
|
|
1388
|
+
let n = `Error stopping connection manager: ${t}`;
|
|
1389
|
+
b.warn(n), e.push(n);
|
|
1390
|
+
} finally {
|
|
1391
|
+
this.connectionManager = null;
|
|
1392
|
+
}
|
|
1393
|
+
this.toolsCache = null, e.length && b.warn(`Resource cleanup finished with ${e.length} issue(s)`);
|
|
1394
|
+
}
|
|
1395
|
+
};
|
|
1396
|
+
function J(e, t = 0) {
|
|
1397
|
+
if (!e || t > 5) return !1;
|
|
1398
|
+
if (e instanceof s || e instanceof i && e.status === 401) return !0;
|
|
1399
|
+
if (e instanceof Error) {
|
|
1400
|
+
if (e.cause && J(e.cause, t + 1)) return !0;
|
|
1401
|
+
let r = e instanceof n ? e.data : void 0;
|
|
1402
|
+
if (r?.cause && J(r.cause, t + 1)) return !0;
|
|
1403
|
+
}
|
|
1404
|
+
return !1;
|
|
1405
|
+
}
|
|
1406
|
+
function Pe(e, t, n, r) {
|
|
1407
|
+
let i = new URL(e), a = t.replace(/\/$/, "");
|
|
1408
|
+
return async (e, t) => {
|
|
1409
|
+
let o = new Request(e, t), s = new URL(o.url);
|
|
1410
|
+
if (!(s.origin === i.origin && s.pathname === i.pathname)) return n(o);
|
|
1411
|
+
let c = new Headers(o.headers);
|
|
1412
|
+
c.set("X-Target-URL", o.url), r && c.set("X-Server-Id", r);
|
|
1413
|
+
let l = o.method === "GET" || o.method === "HEAD" ? void 0 : await o.clone().arrayBuffer();
|
|
1414
|
+
return n(new Request(a, {
|
|
1415
|
+
method: o.method,
|
|
1416
|
+
headers: c,
|
|
1417
|
+
body: l,
|
|
1418
|
+
signal: o.signal,
|
|
1419
|
+
redirect: "manual"
|
|
1420
|
+
}));
|
|
1421
|
+
};
|
|
1422
|
+
}
|
|
1423
|
+
var Y = class extends q {
|
|
1424
|
+
baseUrl;
|
|
1425
|
+
headers;
|
|
1426
|
+
timeout;
|
|
1427
|
+
customFetch;
|
|
1428
|
+
clientInfo;
|
|
1429
|
+
protocolNegotiation;
|
|
1430
|
+
gatewayUrl;
|
|
1431
|
+
serverId;
|
|
1432
|
+
reconnectionOptions;
|
|
1433
|
+
transportType = null;
|
|
1434
|
+
streamableTransport = null;
|
|
1435
|
+
constructor(e, t = {}) {
|
|
1436
|
+
super(t);
|
|
1437
|
+
let n = e.replace(/\/$/, "");
|
|
1438
|
+
this.baseUrl = n, this.headers = { ...t.headers ?? {} }, this.gatewayUrl = t.gatewayUrl, this.serverId = t.serverId, t.authToken && (this.headers.Authorization = `Bearer ${t.authToken}`), this.timeout = t.timeout ?? 1e4;
|
|
1439
|
+
let r = t.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1440
|
+
this.customFetch = this.gatewayUrl ? Pe(n, this.gatewayUrl, r, this.serverId) : t.fetch, this.clientInfo = t.clientInfo ?? {
|
|
1441
|
+
name: "http-connector",
|
|
1442
|
+
version: "1.0.0"
|
|
1443
|
+
}, this.protocolNegotiation = t.protocolNegotiation ?? "auto", this.reconnectionOptions = t.reconnectionOptions;
|
|
1444
|
+
}
|
|
1445
|
+
buildClientOptions() {
|
|
1446
|
+
return {
|
|
1447
|
+
...this.opts.clientOptions || {},
|
|
1448
|
+
jsonSchemaValidator: this.opts.clientOptions?.jsonSchemaValidator ?? new K(),
|
|
1449
|
+
versionNegotiation: {
|
|
1450
|
+
mode: this.protocolNegotiation,
|
|
1451
|
+
...this.opts.clientOptions?.versionNegotiation ?? {}
|
|
1452
|
+
},
|
|
1453
|
+
listChanged: {
|
|
1454
|
+
tools: {
|
|
1455
|
+
autoRefresh: !0,
|
|
1456
|
+
onChanged: (e, t) => void this.handleListChanged("notifications/tools/list_changed", e, t)
|
|
1457
|
+
},
|
|
1458
|
+
resources: {
|
|
1459
|
+
autoRefresh: !1,
|
|
1460
|
+
onChanged: (e) => void this.handleListChanged("notifications/resources/list_changed", e)
|
|
1461
|
+
},
|
|
1462
|
+
prompts: {
|
|
1463
|
+
autoRefresh: !1,
|
|
1464
|
+
onChanged: (e) => void this.handleListChanged("notifications/prompts/list_changed", e)
|
|
1465
|
+
},
|
|
1466
|
+
...this.opts.clientOptions?.listChanged ?? {}
|
|
1467
|
+
},
|
|
1468
|
+
capabilities: {
|
|
1469
|
+
...this.opts.clientOptions?.capabilities || {},
|
|
1470
|
+
roots: { listChanged: !0 },
|
|
1471
|
+
...this.opts.onSampling ? { sampling: {} } : {},
|
|
1472
|
+
...this.opts.onElicitation ? { elicitation: {
|
|
1473
|
+
form: {},
|
|
1474
|
+
url: {}
|
|
1475
|
+
} } : {}
|
|
1476
|
+
}
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
unwrapStreamableError(e) {
|
|
1480
|
+
return e instanceof i ? e : e instanceof Error && e.cause instanceof i ? e.cause : null;
|
|
1481
|
+
}
|
|
1482
|
+
classifyStreamableHttpFailure(e) {
|
|
1483
|
+
let t = "Unknown error", n = !1, r, i = this.unwrapStreamableError(e);
|
|
1484
|
+
if (i) {
|
|
1485
|
+
let e = i.status;
|
|
1486
|
+
return n = e === 401, r = e, e === 400 && i.message.includes("Missing session ID") ? (t = "Server requires session ID (FastMCP compatibility)", b.warn(`\u26A0\uFE0F ${t}`)) : e === 404 || e === 405 ? (t = `Server returned ${e} - server likely doesn't support streamable HTTP`, b.debug(t)) : (t = `Server returned ${e}: ${i.message}`, b.debug(t)), {
|
|
1487
|
+
fallbackReason: t,
|
|
1488
|
+
is401Error: n,
|
|
1489
|
+
httpStatusCode: r
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
if (e instanceof Error) {
|
|
1493
|
+
let r = e.toString(), i = e.message || "";
|
|
1494
|
+
n = J(e) || r.includes("401") || i.includes("Unauthorized"), r.includes("Missing session ID") || r.includes("Bad Request: Missing session ID") || i.includes("FastMCP session ID error") ? (t = "Server requires session ID (FastMCP compatibility)", b.warn(`\u26A0\uFE0F ${t}`)) : r.includes("405 Method Not Allowed") || r.includes("404 Not Found") ? (t = "Server doesn't support streamable HTTP (405/404)", b.debug(t)) : (t = `Streamable HTTP failed: ${e.message}`, b.debug(t));
|
|
1495
|
+
}
|
|
1496
|
+
return {
|
|
1497
|
+
fallbackReason: t,
|
|
1498
|
+
is401Error: n,
|
|
1499
|
+
httpStatusCode: r
|
|
1500
|
+
};
|
|
1501
|
+
}
|
|
1502
|
+
async connect() {
|
|
1503
|
+
if (this.connected) {
|
|
1504
|
+
b.debug("Already connected to MCP implementation");
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1507
|
+
let e = this.baseUrl;
|
|
1508
|
+
b.debug(`Connecting to MCP implementation via HTTP: ${e}`);
|
|
1509
|
+
try {
|
|
1510
|
+
await this.connectWithStreamableHttp(e), b.debug("✅ Successfully connected via streamable HTTP");
|
|
1511
|
+
} catch (e) {
|
|
1512
|
+
b.debug("Streamable HTTP connect failed", e);
|
|
1513
|
+
let { fallbackReason: t, is401Error: n, httpStatusCode: r } = this.classifyStreamableHttpFailure(e);
|
|
1514
|
+
if (await this.cleanupResources(), n) {
|
|
1515
|
+
b.info("Authentication required");
|
|
1516
|
+
let e = /* @__PURE__ */ Error("Authentication required");
|
|
1517
|
+
throw e.code = 401, e;
|
|
1518
|
+
}
|
|
1519
|
+
let i = /* @__PURE__ */ Error(`Could not connect via streamable HTTP: ${t}`);
|
|
1520
|
+
throw r !== void 0 && Object.defineProperty(i, "code", {
|
|
1521
|
+
value: r,
|
|
1522
|
+
writable: !1,
|
|
1523
|
+
enumerable: !0,
|
|
1524
|
+
configurable: !0
|
|
1525
|
+
}), i;
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
observeSseProgress(e) {
|
|
1529
|
+
if (!e.body || !e.headers.get("content-type")?.includes("text/event-stream")) return e;
|
|
1530
|
+
let [t, n] = e.body.tee();
|
|
1531
|
+
return (async () => {
|
|
1532
|
+
let e = n.getReader(), t = new TextDecoder(), r = "";
|
|
1533
|
+
try {
|
|
1534
|
+
for (;;) {
|
|
1535
|
+
let { done: n, value: i } = await e.read();
|
|
1536
|
+
if (n) break;
|
|
1537
|
+
r += t.decode(i, { stream: !0 });
|
|
1538
|
+
let a = r.split(/\r?\n\r?\n/);
|
|
1539
|
+
r = a.pop() ?? "";
|
|
1540
|
+
for (let e of a) for (let t of e.split(/\r?\n/)) if (t.startsWith("data:")) try {
|
|
1541
|
+
let e = JSON.parse(t.slice(5).trim());
|
|
1542
|
+
e.method === "notifications/progress" && this.forwardRoundProgress(e.params);
|
|
1543
|
+
} catch {}
|
|
1544
|
+
}
|
|
1545
|
+
} catch (e) {
|
|
1546
|
+
e instanceof DOMException && e.name === "AbortError" || b.debug("Progress observer stream ended:", e);
|
|
1547
|
+
} finally {
|
|
1548
|
+
e.releaseLock();
|
|
1549
|
+
}
|
|
1550
|
+
})(), new Response(t, {
|
|
1551
|
+
status: e.status,
|
|
1552
|
+
statusText: e.statusText,
|
|
1553
|
+
headers: e.headers
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
async connectWithStreamableHttp(e) {
|
|
1557
|
+
try {
|
|
1558
|
+
b.debug("[HttpConnector] Connecting with Streamable HTTP", {
|
|
1559
|
+
baseUrl: e,
|
|
1560
|
+
originalUrl: this.baseUrl,
|
|
1561
|
+
gatewayUrl: this.gatewayUrl || "none",
|
|
1562
|
+
authProviderUrl: this.opts.authProvider && "serverUrl" in this.opts.authProvider && typeof this.opts.authProvider.serverUrl == "string" ? this.opts.authProvider.serverUrl : "none",
|
|
1563
|
+
headers: this.headers
|
|
1564
|
+
});
|
|
1565
|
+
let t, n = new Promise((e) => {
|
|
1566
|
+
t = e;
|
|
1567
|
+
}), r = this.customFetch ?? globalThis.fetch.bind(globalThis), i = new a(new URL(e), {
|
|
1568
|
+
authProvider: this.opts.authProvider,
|
|
1569
|
+
fetch: async (e, n) => {
|
|
1570
|
+
let i = await r(e, n), a = n?.method ?? (e instanceof Request ? e.method : "GET"), o = new Headers(e instanceof Request ? e.headers : void 0);
|
|
1571
|
+
return new Headers(n?.headers).forEach((e, t) => {
|
|
1572
|
+
o.set(t, e);
|
|
1573
|
+
}), a.toUpperCase() === "GET" && i.ok && i.headers.get("content-type")?.includes("text/event-stream") && t?.(), o.get("mcp-method") === "subscriptions/listen" ? i : this.observeSseProgress(i);
|
|
1574
|
+
},
|
|
1575
|
+
requestInit: { headers: this.headers },
|
|
1576
|
+
reconnectionOptions: {
|
|
1577
|
+
maxReconnectionDelay: 3e4,
|
|
1578
|
+
initialReconnectionDelay: 1e3,
|
|
1579
|
+
reconnectionDelayGrowFactor: 1.5,
|
|
1580
|
+
maxRetries: 2,
|
|
1581
|
+
...this.reconnectionOptions
|
|
1582
|
+
}
|
|
1583
|
+
}), o = i;
|
|
1584
|
+
if (this.opts.wrapTransport) {
|
|
1585
|
+
let e = this.baseUrl;
|
|
1586
|
+
o = this.opts.wrapTransport(o, e);
|
|
1587
|
+
}
|
|
1588
|
+
let s = this.buildClientOptions();
|
|
1589
|
+
b.debug("Creating Client with capabilities:", JSON.stringify(s.capabilities, null, 2)), this.client = new c(this.clientInfo, s), this.setupRootsHandler(), this.setupSamplingHandler(), this.setupElicitationHandler(), b.debug("Roots/sampling/elicitation handlers registered before connect");
|
|
1590
|
+
try {
|
|
1591
|
+
let e;
|
|
1592
|
+
if (await Promise.race([this.client.connect(o), new Promise((t, n) => {
|
|
1593
|
+
e = setTimeout(() => n(/* @__PURE__ */ Error(`MCP connection timed out after ${this.timeout}ms`)), this.timeout);
|
|
1594
|
+
})]).finally(() => {
|
|
1595
|
+
e !== void 0 && clearTimeout(e);
|
|
1596
|
+
}), (this.client.getProtocolEra?.() ?? "legacy") === "legacy" && i.sessionId) {
|
|
1597
|
+
let e, t = await Promise.race([n.then(() => !0), new Promise((t) => e = setTimeout(() => t(!1), Math.min(this.timeout, 5e3)))]);
|
|
1598
|
+
e && clearTimeout(e), t || b.warn("Legacy server push stream did not attach before connect completed");
|
|
1599
|
+
}
|
|
1600
|
+
let t = i.sessionId;
|
|
1601
|
+
t && b.debug(`Session ID obtained: ${t}`);
|
|
1602
|
+
} catch (e) {
|
|
1603
|
+
if (e instanceof Error) {
|
|
1604
|
+
let t = e.message || e.toString();
|
|
1605
|
+
if (t.includes("Missing session ID") || t.includes("Bad Request: Missing session ID") || t.includes("Mcp-Session-Id header is required")) {
|
|
1606
|
+
let n = /* @__PURE__ */ Error(`Session ID error: ${t}. The SDK should automatically extract session ID from initialize response.`);
|
|
1607
|
+
throw n.cause = e, n;
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
throw e;
|
|
1611
|
+
}
|
|
1612
|
+
this.streamableTransport = i, this.connectionManager = { stop: async () => {
|
|
1613
|
+
if (this.streamableTransport) try {
|
|
1614
|
+
await this.streamableTransport.close();
|
|
1615
|
+
} catch (e) {
|
|
1616
|
+
b.warn(`Error closing Streamable HTTP transport: ${e}`);
|
|
1617
|
+
} finally {
|
|
1618
|
+
this.streamableTransport = null;
|
|
1619
|
+
}
|
|
1620
|
+
} }, this.connected = !0, this.transportType = "streamable-http", this.setupNotificationHandler(), b.debug(`Successfully connected to MCP implementation via streamable HTTP: ${e}`), this.trackConnectorInit({
|
|
1621
|
+
serverUrl: this.baseUrl,
|
|
1622
|
+
publicIdentifier: `${this.baseUrl} (streamable-http)`
|
|
1623
|
+
});
|
|
1624
|
+
} catch (e) {
|
|
1625
|
+
throw await this.cleanupResources(), e;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
get publicIdentifier() {
|
|
1629
|
+
return {
|
|
1630
|
+
type: "http",
|
|
1631
|
+
url: this.baseUrl,
|
|
1632
|
+
transport: this.transportType || "unknown",
|
|
1633
|
+
protocolEra: this.protocolEra ?? "unknown"
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
getTransportType() {
|
|
1637
|
+
return this.transportType;
|
|
1638
|
+
}
|
|
1639
|
+
async cleanupResources() {
|
|
1640
|
+
if (this.streamableTransport && this.protocolEra !== "modern") {
|
|
1641
|
+
let e;
|
|
1642
|
+
try {
|
|
1643
|
+
await Promise.race([this.streamableTransport.terminateSession().then(() => !0), new Promise((t) => e = setTimeout(() => t(!1), Math.min(this.timeout, 5e3)))]) || b.debug("Timed out terminating legacy HTTP session; closing transport");
|
|
1644
|
+
} catch (e) {
|
|
1645
|
+
b.debug(`Error terminating Streamable HTTP session: ${e}`);
|
|
1646
|
+
} finally {
|
|
1647
|
+
e && clearTimeout(e);
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
await super.cleanupResources();
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
function X(e, t) {
|
|
1654
|
+
return {
|
|
1655
|
+
onSampling: e?.onSampling ?? t?.onSampling,
|
|
1656
|
+
onElicitation: e?.onElicitation ?? t?.onElicitation,
|
|
1657
|
+
onNotification: e?.onNotification ?? t?.onNotification
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
function Z(e) {
|
|
1661
|
+
if (!("url" in e) || typeof e.url != "string" || e.authProvider || e.authToken || e.oauth === !1) return !1;
|
|
1662
|
+
let t = e.headers;
|
|
1663
|
+
if (t) {
|
|
1664
|
+
for (let e of Object.keys(t)) if (e.toLowerCase() === "authorization") return !1;
|
|
1665
|
+
}
|
|
1666
|
+
return !0;
|
|
1667
|
+
}
|
|
1668
|
+
function Fe() {
|
|
1669
|
+
return {
|
|
1670
|
+
name: "mcp-use",
|
|
1671
|
+
title: "mcp-use",
|
|
1672
|
+
version: S(),
|
|
1673
|
+
description: "mcp-use is a complete TypeScript framework for building and using MCP",
|
|
1674
|
+
icons: [{ src: "https://mcp-use.com/logo.png" }],
|
|
1675
|
+
websiteUrl: "https://mcp-use.com"
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
function Q(e) {
|
|
1679
|
+
let t = Fe();
|
|
1680
|
+
if (!e || typeof e != "object") return t;
|
|
1681
|
+
let n = e;
|
|
1682
|
+
return !n.name || !n.version ? t : {
|
|
1683
|
+
...t,
|
|
1684
|
+
...n
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
var $ = class {
|
|
1688
|
+
connector;
|
|
1689
|
+
autoConnect;
|
|
1690
|
+
constructor(e, t = !0) {
|
|
1691
|
+
this.connector = e, this.autoConnect = t;
|
|
1692
|
+
}
|
|
1693
|
+
async connect() {
|
|
1694
|
+
await this.connector.connect();
|
|
1695
|
+
}
|
|
1696
|
+
async disconnect() {
|
|
1697
|
+
await this.connector.disconnect();
|
|
1698
|
+
}
|
|
1699
|
+
async initialize() {
|
|
1700
|
+
!this.isConnected && this.autoConnect && await this.connect(), await this.connector.initialize();
|
|
1701
|
+
}
|
|
1702
|
+
get isConnected() {
|
|
1703
|
+
return this.connector && this.connector.isClientConnected;
|
|
1704
|
+
}
|
|
1705
|
+
on(e, t) {
|
|
1706
|
+
e === "notification" && this.connector.onNotification(t);
|
|
1707
|
+
}
|
|
1708
|
+
async setRoots(e) {
|
|
1709
|
+
return this.connector.setRoots(e);
|
|
1710
|
+
}
|
|
1711
|
+
getRoots() {
|
|
1712
|
+
return this.connector.getRoots();
|
|
1713
|
+
}
|
|
1714
|
+
get tools() {
|
|
1715
|
+
return this.connector.tools;
|
|
1716
|
+
}
|
|
1717
|
+
async listTools(e) {
|
|
1718
|
+
return this.connector.listTools(e);
|
|
1719
|
+
}
|
|
1720
|
+
get serverCapabilities() {
|
|
1721
|
+
return this.connector.serverCapabilities;
|
|
1722
|
+
}
|
|
1723
|
+
get serverInfo() {
|
|
1724
|
+
return this.connector.serverInfo;
|
|
1725
|
+
}
|
|
1726
|
+
get protocolEra() {
|
|
1727
|
+
return this.connector.protocolEra;
|
|
1728
|
+
}
|
|
1729
|
+
get negotiatedProtocolVersion() {
|
|
1730
|
+
return this.connector.negotiatedProtocolVersion;
|
|
1731
|
+
}
|
|
1732
|
+
get info() {
|
|
1733
|
+
let e = this.protocolEra, t = this.negotiatedProtocolVersion, n = this.serverInfo;
|
|
1734
|
+
if (!e || !t || !n) throw Error("MCP connection is not initialized");
|
|
1735
|
+
let r = this.serverCapabilities, i = r.extensions && typeof r.extensions == "object" && !Array.isArray(r.extensions) ? r.extensions : {};
|
|
1736
|
+
return {
|
|
1737
|
+
protocolEra: e,
|
|
1738
|
+
protocolVersion: t,
|
|
1739
|
+
server: n,
|
|
1740
|
+
capabilities: r,
|
|
1741
|
+
instructions: this.connector.instructions,
|
|
1742
|
+
extensions: i
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
supports(e) {
|
|
1746
|
+
return e in this.serverCapabilities;
|
|
1747
|
+
}
|
|
1748
|
+
async callTool(e, t = {}, n) {
|
|
1749
|
+
return this.connector.callTool(e, t, n);
|
|
1750
|
+
}
|
|
1751
|
+
async listResources(e, t) {
|
|
1752
|
+
return this.connector.listResources(e, t);
|
|
1753
|
+
}
|
|
1754
|
+
async listAllResources(e) {
|
|
1755
|
+
return this.connector.listAllResources(e);
|
|
1756
|
+
}
|
|
1757
|
+
async listResourceTemplates(e) {
|
|
1758
|
+
return this.connector.listResourceTemplates(e);
|
|
1759
|
+
}
|
|
1760
|
+
async complete(e, t) {
|
|
1761
|
+
return this.connector.complete(e, t);
|
|
1762
|
+
}
|
|
1763
|
+
async readResource(e, t) {
|
|
1764
|
+
return this.connector.readResource(e, t);
|
|
1765
|
+
}
|
|
1766
|
+
async subscribeToResource(e, t) {
|
|
1767
|
+
return this.connector.subscribeToResource(e, t);
|
|
1768
|
+
}
|
|
1769
|
+
async unsubscribeFromResource(e, t) {
|
|
1770
|
+
return this.connector.unsubscribeFromResource(e, t);
|
|
1771
|
+
}
|
|
1772
|
+
async listPrompts() {
|
|
1773
|
+
return this.connector.listPrompts();
|
|
1774
|
+
}
|
|
1775
|
+
async getPrompt(e, t) {
|
|
1776
|
+
return this.connector.getPrompt(e, t);
|
|
1777
|
+
}
|
|
1778
|
+
async request(e, t = null, n) {
|
|
1779
|
+
return this.connector.request(e, t, n);
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
function Ie(e) {
|
|
1783
|
+
return !!e && typeof e == "object" && "redirectUrl" in e && "clientMetadata" in e;
|
|
1784
|
+
}
|
|
1785
|
+
var Le = class {
|
|
1786
|
+
config = {};
|
|
1787
|
+
sessions = {};
|
|
1788
|
+
activeSessions = [];
|
|
1789
|
+
constructor(e) {
|
|
1790
|
+
e && (this.config = e);
|
|
1791
|
+
}
|
|
1792
|
+
static fromDict(e) {
|
|
1793
|
+
throw Error("fromDict must be implemented by concrete class");
|
|
1794
|
+
}
|
|
1795
|
+
addServer(e, t) {
|
|
1796
|
+
this.config.mcpServers = this.config.mcpServers || {}, this.config.mcpServers[e] = t, f(e, t);
|
|
1797
|
+
}
|
|
1798
|
+
async removeServer(e) {
|
|
1799
|
+
this.config.mcpServers?.[e] && (await this.closeSession(e), delete this.config.mcpServers[e], p(e));
|
|
1800
|
+
}
|
|
1801
|
+
getServerNames() {
|
|
1802
|
+
return Object.keys(this.config.mcpServers ?? {});
|
|
1803
|
+
}
|
|
1804
|
+
getServerConfig(e) {
|
|
1805
|
+
return this.config.mcpServers?.[e];
|
|
1806
|
+
}
|
|
1807
|
+
getConfig() {
|
|
1808
|
+
return this.config ?? {};
|
|
1809
|
+
}
|
|
1810
|
+
async createSession(e, t = !0) {
|
|
1811
|
+
let n = this.config.mcpServers ?? {};
|
|
1812
|
+
if (Object.keys(n).length === 0 && b.warn("No MCP servers defined in config"), !n[e]) throw Error(`Server '${e}' not found in config`);
|
|
1813
|
+
let r = { ...n[e] }, i;
|
|
1814
|
+
if (Z(r)) {
|
|
1815
|
+
let e = r.oauth === !1 ? void 0 : r.oauth ?? {};
|
|
1816
|
+
i = await this.createDefaultOAuthProvider(r.url, e), r = {
|
|
1817
|
+
...r,
|
|
1818
|
+
authProvider: i
|
|
1819
|
+
};
|
|
1820
|
+
} else "authProvider" in r && r.authProvider && Ie(r.authProvider) && (i = r.authProvider);
|
|
1821
|
+
let a = async () => {
|
|
1822
|
+
let e = new $(await Promise.resolve(this.createConnectorFromConfig(r)));
|
|
1823
|
+
return t && await e.initialize(), e;
|
|
1824
|
+
}, o;
|
|
1825
|
+
try {
|
|
1826
|
+
o = await a();
|
|
1827
|
+
} catch (n) {
|
|
1828
|
+
let s = r;
|
|
1829
|
+
if (!t || !i || !("url" in s) || !U(n) || i.preventAutoAuth) throw n;
|
|
1830
|
+
b.info(`[MCPClient] Unauthorized connecting to '${e}'; completing OAuth\u2026`), await W(i, s.url), o = await a();
|
|
1831
|
+
}
|
|
1832
|
+
return this.sessions[e] = o, this.activeSessions.includes(e) || this.activeSessions.push(e), o;
|
|
1833
|
+
}
|
|
1834
|
+
async connect(e) {
|
|
1835
|
+
return this.createSession(e);
|
|
1836
|
+
}
|
|
1837
|
+
async createAllSessions(e = !0) {
|
|
1838
|
+
let t = this.config.mcpServers ?? {};
|
|
1839
|
+
Object.keys(t).length === 0 && b.warn("No MCP servers defined in config");
|
|
1840
|
+
for (let n of Object.keys(t)) await this.createSession(n, e);
|
|
1841
|
+
return this.sessions;
|
|
1842
|
+
}
|
|
1843
|
+
async connectAll() {
|
|
1844
|
+
return this.createAllSessions();
|
|
1845
|
+
}
|
|
1846
|
+
getSession(e) {
|
|
1847
|
+
return this.sessions[e] || null;
|
|
1848
|
+
}
|
|
1849
|
+
requireSession(e) {
|
|
1850
|
+
let t = this.sessions[e];
|
|
1851
|
+
if (!t) throw Error(`Session '${e}' not found. Available sessions: ${this.activeSessions.join(", ") || "none"}`);
|
|
1852
|
+
return t;
|
|
1853
|
+
}
|
|
1854
|
+
getAllActiveSessions() {
|
|
1855
|
+
return Object.fromEntries(this.activeSessions.map((e) => [e, this.sessions[e]]));
|
|
1856
|
+
}
|
|
1857
|
+
async closeSession(e) {
|
|
1858
|
+
let t = this.sessions[e];
|
|
1859
|
+
if (!t) {
|
|
1860
|
+
b.warn(`No session exists for server ${e}, nothing to close`);
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
try {
|
|
1864
|
+
b.debug(`Closing session for server ${e}`), await t.disconnect();
|
|
1865
|
+
} catch (t) {
|
|
1866
|
+
b.error(`Error closing session for server '${e}': ${t}`);
|
|
1867
|
+
} finally {
|
|
1868
|
+
this.sessions[e] === t && (delete this.sessions[e], this.activeSessions = this.activeSessions.filter((t) => t !== e));
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
async closeAllSessions() {
|
|
1872
|
+
let e = Object.keys(this.sessions), t = [];
|
|
1873
|
+
for (let n of e) try {
|
|
1874
|
+
b.debug(`Closing session for server ${n}`), await this.closeSession(n);
|
|
1875
|
+
} catch (e) {
|
|
1876
|
+
let r = `Failed to close session for server '${n}': ${e}`;
|
|
1877
|
+
b.error(r), t.push(r);
|
|
1878
|
+
}
|
|
1879
|
+
t.length ? b.error(`Encountered ${t.length} errors while closing sessions`) : b.debug("All sessions closed successfully");
|
|
1880
|
+
}
|
|
1881
|
+
async close() {
|
|
1882
|
+
await this.closeAllSessions();
|
|
1883
|
+
}
|
|
1884
|
+
};
|
|
1885
|
+
function Re(e) {
|
|
1886
|
+
let t = Object.keys(e.mcpServers ?? {});
|
|
1887
|
+
L.getInstance().trackMCPClientInit({
|
|
1888
|
+
codeMode: !1,
|
|
1889
|
+
sandbox: !1,
|
|
1890
|
+
allCallbacks: !1,
|
|
1891
|
+
verify: !1,
|
|
1892
|
+
servers: t,
|
|
1893
|
+
numServers: t.length,
|
|
1894
|
+
isBrowser: !0
|
|
1895
|
+
}).catch((e) => b.debug(`Failed to track BrowserMCPClient init: ${e}`));
|
|
1896
|
+
}
|
|
1897
|
+
var ze = class e extends Le {
|
|
1898
|
+
static getPackageVersion() {
|
|
1899
|
+
return S();
|
|
1900
|
+
}
|
|
1901
|
+
constructor(e) {
|
|
1902
|
+
super(e), Re(this.config);
|
|
1903
|
+
}
|
|
1904
|
+
static fromDict(t) {
|
|
1905
|
+
return new e(t);
|
|
1906
|
+
}
|
|
1907
|
+
async createDefaultOAuthProvider(e, t = {}) {
|
|
1908
|
+
return V(e, t);
|
|
1909
|
+
}
|
|
1910
|
+
createConnectorFromConfig(e) {
|
|
1911
|
+
let { url: t, headers: n, fetch: r, authToken: i, authProvider: a, wrapTransport: o, clientOptions: s, protocolNegotiation: c, timeout: l, gatewayUrl: u, serverId: d, reconnectionOptions: f } = e;
|
|
1912
|
+
if (!t) throw Error("Server URL is required");
|
|
1913
|
+
let p = this.config, m = X(e, p), h = Q(e.clientInfo ?? this.config.clientInfo), g = {
|
|
1914
|
+
headers: n,
|
|
1915
|
+
fetch: r ?? globalThis.fetch.bind(globalThis),
|
|
1916
|
+
authToken: i,
|
|
1917
|
+
authProvider: a,
|
|
1918
|
+
wrapTransport: o,
|
|
1919
|
+
clientOptions: s,
|
|
1920
|
+
onSampling: m.onSampling,
|
|
1921
|
+
onElicitation: m.onElicitation,
|
|
1922
|
+
onNotification: m.onNotification,
|
|
1923
|
+
protocolNegotiation: c,
|
|
1924
|
+
timeout: l,
|
|
1925
|
+
clientInfo: h,
|
|
1926
|
+
gatewayUrl: u,
|
|
1927
|
+
serverId: d,
|
|
1928
|
+
reconnectionOptions: f
|
|
1929
|
+
};
|
|
1930
|
+
return b.debug(`[BrowserMCPClient] Connector options prepared (clientOptions: ${s ? "provided" : "none"})`), new Y(t, g);
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
//#endregion
|
|
1934
|
+
export { b as a, l as i, L as n, R as o, k as r, T as t };
|