mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🛠️ refactor: Only Show Agents MCP UI When Configured (#9471)
This commit is contained in:
parent
65c83317aa
commit
a4a174b3dc
4 changed files with 14 additions and 7 deletions
|
|
@ -122,7 +122,6 @@ router.get('/', async function (req, res) {
|
||||||
payload.minPasswordLength = minPasswordLength;
|
payload.minPasswordLength = minPasswordLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.mcpServers = {};
|
|
||||||
const getMCPServers = () => {
|
const getMCPServers = () => {
|
||||||
try {
|
try {
|
||||||
if (appConfig?.mcpConfig == null) {
|
if (appConfig?.mcpConfig == null) {
|
||||||
|
|
@ -136,6 +135,9 @@ router.get('/', async function (req, res) {
|
||||||
if (!mcpServers) return;
|
if (!mcpServers) return;
|
||||||
const oauthServers = mcpManager.getOAuthServers();
|
const oauthServers = mcpManager.getOAuthServers();
|
||||||
for (const serverName in mcpServers) {
|
for (const serverName in mcpServers) {
|
||||||
|
if (!payload.mcpServers) {
|
||||||
|
payload.mcpServers = {};
|
||||||
|
}
|
||||||
const serverConfig = mcpServers[serverName];
|
const serverConfig = mcpServers[serverName];
|
||||||
payload.mcpServers[serverName] = removeNullishValues({
|
payload.mcpServers[serverName] = removeNullishValues({
|
||||||
startup: serverConfig?.startup,
|
startup: serverConfig?.startup,
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ export function AgentPanelProvider({ children }: { children: React.ReactNode })
|
||||||
pluginTools,
|
pluginTools,
|
||||||
activePanel,
|
activePanel,
|
||||||
agentsConfig,
|
agentsConfig,
|
||||||
|
startupConfig,
|
||||||
setActivePanel,
|
setActivePanel,
|
||||||
endpointsConfig,
|
endpointsConfig,
|
||||||
setCurrentAgentId,
|
setCurrentAgentId,
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,7 @@ export type AgentPanelContextType = {
|
||||||
setActivePanel: React.Dispatch<React.SetStateAction<Panel>>;
|
setActivePanel: React.Dispatch<React.SetStateAction<Panel>>;
|
||||||
setCurrentAgentId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
setCurrentAgentId: React.Dispatch<React.SetStateAction<string | undefined>>;
|
||||||
agent_id?: string;
|
agent_id?: string;
|
||||||
|
startupConfig?: t.TStartupConfig | null;
|
||||||
agentsConfig?: t.TAgentsEndpoint | null;
|
agentsConfig?: t.TAgentsEndpoint | null;
|
||||||
endpointsConfig?: t.TEndpointsConfig | null;
|
endpointsConfig?: t.TEndpointsConfig | null;
|
||||||
/** Pre-computed MCP server information indexed by server key */
|
/** Pre-computed MCP server information indexed by server key */
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
|
||||||
actions,
|
actions,
|
||||||
setAction,
|
setAction,
|
||||||
agentsConfig,
|
agentsConfig,
|
||||||
|
startupConfig,
|
||||||
mcpServersMap,
|
mcpServersMap,
|
||||||
setActivePanel,
|
setActivePanel,
|
||||||
endpointsConfig,
|
endpointsConfig,
|
||||||
|
|
@ -308,6 +309,14 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
|
||||||
{fileSearchEnabled && <FileSearch agent_id={agent_id} files={knowledge_files} />}
|
{fileSearchEnabled && <FileSearch agent_id={agent_id} files={knowledge_files} />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{/* MCP Section */}
|
||||||
|
{startupConfig?.mcpServers != null && (
|
||||||
|
<MCPTools
|
||||||
|
agentId={agent_id}
|
||||||
|
mcpServerNames={mcpServerNames}
|
||||||
|
setShowMCPToolDialog={setShowMCPToolDialog}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* Agent Tools & Actions */}
|
{/* Agent Tools & Actions */}
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<label className={labelClass}>
|
<label className={labelClass}>
|
||||||
|
|
@ -375,12 +384,6 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* MCP Section */}
|
|
||||||
<MCPTools
|
|
||||||
agentId={agent_id}
|
|
||||||
mcpServerNames={mcpServerNames}
|
|
||||||
setShowMCPToolDialog={setShowMCPToolDialog}
|
|
||||||
/>
|
|
||||||
{/* Support Contact (Optional) */}
|
{/* Support Contact (Optional) */}
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<div className="mb-1.5 flex items-center gap-2">
|
<div className="mb-1.5 flex items-center gap-2">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue