mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🗃️ refactor: Simplify MCP Server Config to Two-Repository Pattern (#10705)
* refactor(mcp): simplify registry to two-repository architecture with explicit storage
* Chore: address AI Review comments
* Simplify MCP config cache architecture and remove legacy code:
Follow-up cleanup to commit d2bfdd033 which refactored MCP registry to two-repository architecture. This removes leftover legacy abstractions that were no longer used.
What changed:
- Simplified ServerConfigsCacheFactory.create() from 3 params to 2 (namespace, leaderOnly)
- Removed unused scope: 'Shared' | 'Private' parameter (only 'Shared' was ever used)
- Removed dead set() and getNamespace() methods from cache classes
- Updated JSDoc to reflect two-repository architecture (Cache + DB) instead of old three-tier system
- Fixed stale mocks and comments referencing removed sharedAppServers, sharedUserServers, privateServersCache
Files changed:
- ServerConfigsCacheFactory.ts - Simplified factory signature
- ServerConfigsCacheRedis.ts - Removed scope, renamed owner→namespace
- ServerConfigsCacheInMemory.ts - Removed unused methods
- MCPServersRegistry.ts - Updated JSDoc, simplified factory call
- RegistryStatusCache.ts - Removed stale JSDoc reference
- MCPManager.test.ts - Fixed legacy mock
- ServerConfigsCacheFactory.test.ts - Updated test assertions
* fix: Update error message in MCPServersRegistry for clarity
---------
Co-authored-by: Atef Bellaaj <slalom.bellaaj@external.daimlertruck.com>
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
67952372d0
commit
da473bf43a
31 changed files with 551 additions and 4714 deletions
|
|
@ -2,7 +2,6 @@ import { registryStatusCache as statusCache } from './cache/RegistryStatusCache'
|
|||
import { isLeader } from '~/cluster';
|
||||
import { withTimeout } from '~/utils';
|
||||
import { logger } from '@librechat/data-schemas';
|
||||
import { MCPServerInspector } from './MCPServerInspector';
|
||||
import { ParsedServerConfig } from '~/mcp/types';
|
||||
import { sanitizeUrlForLogging } from '~/mcp/utils';
|
||||
import type * as t from '~/mcp/types';
|
||||
|
|
@ -60,9 +59,7 @@ export class MCPServersInitializer {
|
|||
/** Initializes a single server with all its metadata and adds it to appropriate collections */
|
||||
public static async initializeServer(serverName: string, rawConfig: t.MCPOptions): Promise<void> {
|
||||
try {
|
||||
const config = await MCPServerInspector.inspect(serverName, rawConfig);
|
||||
|
||||
await registry.addSharedServer(serverName, config);
|
||||
const config = await registry.addServer(serverName, rawConfig, 'CACHE');
|
||||
MCPServersInitializer.logParsedConfig(serverName, config);
|
||||
} catch (error) {
|
||||
logger.error(`${MCPServersInitializer.prefix(serverName)} Failed to initialize:`, error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue