diff --git a/api/server/services/start/interface.js b/api/server/services/start/interface.js index c98fdb60bc..5c08b1af2e 100644 --- a/api/server/services/start/interface.js +++ b/api/server/services/start/interface.js @@ -41,6 +41,7 @@ async function loadDefaultInterface(config, configDefaults, roleName = SystemRol sidePanel: interfaceConfig?.sidePanel ?? defaults.sidePanel, privacyPolicy: interfaceConfig?.privacyPolicy ?? defaults.privacyPolicy, termsOfService: interfaceConfig?.termsOfService ?? defaults.termsOfService, + mcpServers: interfaceConfig?.mcpServers ?? defaults.mcpServers, bookmarks: interfaceConfig?.bookmarks ?? defaults.bookmarks, memories: shouldDisableMemories ? false : (interfaceConfig?.memories ?? defaults.memories), prompts: interfaceConfig?.prompts ?? defaults.prompts, diff --git a/client/src/Providers/BadgeRowContext.tsx b/client/src/Providers/BadgeRowContext.tsx index 860c59da46..01590b1948 100644 --- a/client/src/Providers/BadgeRowContext.tsx +++ b/client/src/Providers/BadgeRowContext.tsx @@ -1,6 +1,7 @@ import React, { createContext, useContext } from 'react'; import { Tools, LocalStorageKeys } from 'librechat-data-provider'; import { useMCPSelect, useToolToggle, useCodeApiKeyForm, useSearchApiKeyForm } from '~/hooks'; +import { useGetStartupConfig } from '~/data-provider'; interface BadgeRowContextType { conversationId?: string | null; @@ -10,6 +11,7 @@ interface BadgeRowContextType { fileSearch: ReturnType; codeApiKeyForm: ReturnType; searchApiKeyForm: ReturnType; + startupConfig: ReturnType['data']; } const BadgeRowContext = createContext(undefined); @@ -28,6 +30,9 @@ interface BadgeRowProviderProps { } export default function BadgeRowProvider({ children, conversationId }: BadgeRowProviderProps) { + /** Startup config */ + const { data: startupConfig } = useGetStartupConfig(); + /** MCPSelect hook */ const mcpSelect = useMCPSelect({ conversationId }); @@ -73,6 +78,7 @@ export default function BadgeRowProvider({ children, conversationId }: BadgeRowP mcpSelect, webSearch, fileSearch, + startupConfig, conversationId, codeApiKeyForm, codeInterpreter, diff --git a/client/src/components/Chat/Input/MCPSelect.tsx b/client/src/components/Chat/Input/MCPSelect.tsx index 13c1a4a26a..0a03decd53 100644 --- a/client/src/components/Chat/Input/MCPSelect.tsx +++ b/client/src/components/Chat/Input/MCPSelect.tsx @@ -2,8 +2,7 @@ import React, { memo, useCallback, useState } from 'react'; import { SettingsIcon } from 'lucide-react'; import { Constants } from 'librechat-data-provider'; import { useUpdateUserPluginsMutation } from 'librechat-data-provider/react-query'; -import type { TUpdateUserPlugins } from 'librechat-data-provider'; -import type { McpServerInfo } from '~/hooks/Plugins/useMCPSelect'; +import type { TUpdateUserPlugins, TPlugin } from 'librechat-data-provider'; import MCPConfigDialog, { type ConfigFieldDetail } from '~/components/ui/MCPConfigDialog'; import { useToastContext, useBadgeRowContext } from '~/Providers'; import MultiSelect from '~/components/ui/MultiSelect'; @@ -18,11 +17,11 @@ const getBaseMCPPluginKey = (fullPluginKey: string): string => { function MCPSelect() { const localize = useLocalize(); const { showToast } = useToastContext(); - const { mcpSelect } = useBadgeRowContext(); + const { mcpSelect, startupConfig } = useBadgeRowContext(); const { mcpValues, setMCPValues, mcpServerNames, mcpToolDetails, isPinned } = mcpSelect; const [isConfigModalOpen, setIsConfigModalOpen] = useState(false); - const [selectedToolForConfig, setSelectedToolForConfig] = useState(null); + const [selectedToolForConfig, setSelectedToolForConfig] = useState(null); const updateUserPluginsMutation = useUpdateUserPluginsMutation({ onSuccess: () => { @@ -129,6 +128,8 @@ function MCPSelect() { return null; } + const placeholderText = + startupConfig?.interface?.mcpServers?.placeholder || localize('com_ui_mcp_servers'); return ( <> } diff --git a/client/src/components/Chat/Input/MCPSubMenu.tsx b/client/src/components/Chat/Input/MCPSubMenu.tsx index a955f2bd90..16772acd02 100644 --- a/client/src/components/Chat/Input/MCPSubMenu.tsx +++ b/client/src/components/Chat/Input/MCPSubMenu.tsx @@ -11,6 +11,7 @@ interface MCPSubMenuProps { mcpValues?: string[]; mcpServerNames: string[]; handleMCPToggle: (serverName: string) => void; + placeholder?: string; } const MCPSubMenu = ({ @@ -19,6 +20,7 @@ const MCPSubMenu = ({ mcpServerNames, setIsMCPPinned, handleMCPToggle, + placeholder, ...props }: MCPSubMenuProps) => { const localize = useLocalize(); @@ -38,7 +40,7 @@ const MCPSubMenu = ({ >
- {localize('com_ui_mcp_servers')} + {placeholder || localize('com_ui_mcp_servers')}