mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🚮 fix: Remove Filtering Logic Before MCP Initialization (#9149)
This commit is contained in:
parent
2a0a8f6beb
commit
822e2310ce
2 changed files with 14 additions and 27 deletions
|
|
@ -111,17 +111,20 @@ router.get('/', async function (req, res) {
|
||||||
payload.mcpServers = {};
|
payload.mcpServers = {};
|
||||||
const config = await getCustomConfig();
|
const config = await getCustomConfig();
|
||||||
if (config?.mcpServers != null) {
|
if (config?.mcpServers != null) {
|
||||||
const mcpManager = getMCPManager();
|
try {
|
||||||
const oauthServers = mcpManager.getOAuthServers();
|
const mcpManager = getMCPManager();
|
||||||
|
const oauthServers = mcpManager.getOAuthServers();
|
||||||
for (const serverName in config.mcpServers) {
|
for (const serverName in config.mcpServers) {
|
||||||
const serverConfig = config.mcpServers[serverName];
|
const serverConfig = config.mcpServers[serverName];
|
||||||
payload.mcpServers[serverName] = {
|
payload.mcpServers[serverName] = {
|
||||||
startup: serverConfig?.startup,
|
startup: serverConfig?.startup,
|
||||||
chatMenu: serverConfig?.chatMenu,
|
chatMenu: serverConfig?.chatMenu,
|
||||||
isOAuth: oauthServers?.has(serverName),
|
isOAuth: oauthServers?.has(serverName),
|
||||||
customUserVars: serverConfig?.customUserVars || {},
|
customUserVars: serverConfig?.customUserVars || {},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error('Error loading MCP servers', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,22 +14,6 @@ async function initializeMCPs(app) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Servers filtered with `startup: false` */
|
|
||||||
const filteredServers = {};
|
|
||||||
for (const [name, config] of Object.entries(mcpServers)) {
|
|
||||||
if (config.startup === false) {
|
|
||||||
logger.info(`Skipping MCP server '${name}' due to startup: false`);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
filteredServers[name] = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Object.keys(filteredServers).length === 0) {
|
|
||||||
logger.info('[MCP] No MCP servers to initialize (all skipped or none configured)');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info('Initializing MCP servers...');
|
|
||||||
const mcpManager = await createMCPManager(mcpServers);
|
const mcpManager = await createMCPManager(mcpServers);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue