🧩 refactor: Decouple MCP Config from Startup Config (#10689)

* Decouple mcp config from start up config

* Chore: Work on AI Review and Copilot Comments

- setRawConfig is not needed since the private raw config is not needed any more
- !!serversLoading bug fixed
- added unit tests for route /api/mcp/servers
- copilot comments addressed

* chore: remove comments

* chore: rename data-provider dir for MCP

* chore: reorganize mcp specific query hooks

* fix: consolidate imports for MCP server manager

* chore: add dev-staging branch to frontend review workflow triggers

* feat: add GitHub Actions workflow for building and pushing Docker images to GitHub Container Registry and Docker Hub

* fix: update label for tag input in BookmarkForm tests to improve clarity

---------

Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
Atef Bellaaj 2025-11-26 21:26:40 +01:00 committed by Danny Avila
parent 98b188f26c
commit ef1b7f0157
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
36 changed files with 548 additions and 301 deletions

View file

@ -8,7 +8,12 @@ import {
useGetStartupConfig,
useMCPToolsQuery,
} from '~/data-provider';
import { useLocalize, useGetAgentsConfig, useMCPConnectionStatus } from '~/hooks';
import {
useLocalize,
useGetAgentsConfig,
useMCPConnectionStatus,
useMCPServerManager,
} from '~/hooks';
import { Panel, isEphemeralAgent } from '~/common';
const AgentPanelContext = createContext<AgentPanelContextType | undefined>(undefined);
@ -29,7 +34,7 @@ export function AgentPanelProvider({ children }: { children: React.ReactNode })
const [action, setAction] = useState<Action | undefined>(undefined);
const [activePanel, setActivePanel] = useState<Panel>(Panel.builder);
const [agent_id, setCurrentAgentId] = useState<string | undefined>(undefined);
const { availableMCPServers, isLoading, availableMCPServersMap } = useMCPServerManager();
const { data: startupConfig } = useGetStartupConfig();
const { data: actions } = useGetActionsQuery(EModelEndpoint.agents, {
enabled: !isEphemeralAgent(agent_id),
@ -38,19 +43,23 @@ export function AgentPanelProvider({ children }: { children: React.ReactNode })
const { data: regularTools } = useAvailableToolsQuery(EModelEndpoint.agents);
const { data: mcpData } = useMCPToolsQuery({
enabled: !isEphemeralAgent(agent_id) && startupConfig?.mcpServers != null,
enabled:
!isEphemeralAgent(agent_id) &&
!isLoading &&
availableMCPServers != null &&
availableMCPServers.length > 0,
});
const { agentsConfig, endpointsConfig } = useGetAgentsConfig();
const mcpServerNames = useMemo(
() => Object.keys(startupConfig?.mcpServers ?? {}),
[startupConfig],
() => availableMCPServers.map((s) => s.serverName),
[availableMCPServers],
);
const { connectionStatus } = useMCPConnectionStatus({
enabled: !isEphemeralAgent(agent_id) && mcpServerNames.length > 0,
});
//TODO to refactor when tools come from tool box
const mcpServersMap = useMemo(() => {
const configuredServers = new Set(mcpServerNames);
const serversMap = new Map<string, MCPServerInfo>();
@ -127,6 +136,8 @@ export function AgentPanelProvider({ children }: { children: React.ReactNode })
setActivePanel,
endpointsConfig,
setCurrentAgentId,
availableMCPServers,
availableMCPServersMap,
};
return <AgentPanelContext.Provider value={value}>{children}</AgentPanelContext.Provider>;