Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🛠️ refactor: Only Show Agents MCP UI When Configured (#9471)

Danny Avilaa4a174b3dcad
diff --git a/api/server/routes/config.js b/api/server/routes/config.js
index 4240a6eb23..ec38593fe8 100644
--- a/api/server/routes/config.js
+++ b/api/server/routes/config.js
@@ -122,7 +122,6 @@ router.get('/', async function (req, res) {
payload.minPasswordLength = minPasswordLength;
}
- payload.mcpServers = {};
const getMCPServers = () => {
try {
if (appConfig?.mcpConfig == null) {
@@ -136,6 +135,9 @@ router.get('/', async function (req, res) {
if (!mcpServers) return;
const oauthServers = mcpManager.getOAuthServers();
for (const serverName in mcpServers) {
+ if (!payload.mcpServers) {
+ payload.mcpServers = {};
+ }
const serverConfig = mcpServers[serverName];
payload.mcpServers[serverName] = removeNullishValues({
startup: serverConfig?.startup,
diff --git a/client/src/Providers/AgentPanelContext.tsx b/client/src/Providers/AgentPanelContext.tsx
index eb64011b32..135066c784 100644
--- a/client/src/Providers/AgentPanelContext.tsx
+++ b/client/src/Providers/AgentPanelContext.tsx
@@ -140,6 +140,7 @@ export function AgentPanelProvider({ children }: { children: React.ReactNode })
pluginTools,
activePanel,
agentsConfig,
+ startupConfig,
setActivePanel,
endpointsConfig,
setCurrentAgentId,
diff --git a/client/src/common/types.ts b/client/src/common/types.ts
index 3156ccb444..b03a80f07e 100644
--- a/client/src/common/types.ts
+++ b/client/src/common/types.ts
@@ -239,6 +239,7 @@ export type AgentPanelContextType = {
setActivePanel: React.Dispatch<React.SetStateAction<Panel>>;
setCurrentAgentId: React.Dispatch<React.SetStateAction<string | undefined>>;
agent_id?: string;
+ startupConfig?: t.TStartupConfig | null;
agentsConfig?: t.TAgentsEndpoint | null;
endpointsConfig?: t.TEndpointsConfig | null;
/** Pre-computed MCP server information indexed by server key */
diff --git a/client/src/components/SidePanel/Agents/AgentConfig.tsx b/client/src/components/SidePanel/Agents/AgentConfig.tsx
index 86f9cc6dc6..a48a372591 100644
--- a/client/src/components/SidePanel/Agents/AgentConfig.tsx
+++ b/client/src/components/SidePanel/Agents/AgentConfig.tsx
@@ -49,6 +49,7 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
actions,
setAction,
agentsConfig,
+ startupConfig,
mcpServersMap,
setActivePanel,
endpointsConfig,
@@ -308,6 +309,14 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
{fileSearchEnabled && <FileSearch agent_id={agent_id} files={knowledge_files} />}
</div>
)}
+ {/* MCP Section */}
+ {startupConfig?.mcpServers != null && (
+ <MCPTools
+ agentId={agent_id}
+ mcpServerNames={mcpServerNames}
+ setShowMCPToolDialog={setShowMCPToolDialog}
+ />
+ )}
{/* Agent Tools & Actions */}
<div className="mb-4">
<label className={labelClass}>
@@ -375,12 +384,6 @@ export default function AgentConfig({ createMutation }: Pick<AgentPanelProps, 'c
</div>
</div>
</div>
- {/* MCP Section */}
- <MCPTools
- agentId={agent_id}
- mcpServerNames={mcpServerNames}
- setShowMCPToolDialog={setShowMCPToolDialog}
- />
{/* Support Contact (Optional) */}
<div className="mb-4">
<div className="mb-1.5 flex items-center gap-2">