LibreChat/api
Theo N. Truong 8780a78165
♻️ refactor: MCPManager for Scalability, Fix App-Level Detection, Add Lazy Connections (#8930)
* feat: MCP Connection management overhaul - Making MCPManager manageable

Refactor the monolithic MCPManager into focused, single-responsibility classes:

• MCPServersRegistry: Server configuration discovery and metadata management
• UserConnectionManager: Manages user-level connections
• ConnectionsRepository: Low-level connection pool with lazy loading
• MCPConnectionFactory: Handles MCP connection creation with OAuth support

New Features:
• Lazy loading of app-level connections for horizontal scaling
• Automatic reconnection for app-level connections
• Enhanced OAuth detection with explicit requiresOAuth flag
• Centralized MCP configuration management

Bug Fixes:
• App-level connection detection in MCPManager.callTool
• MCP Connection Reinitialization route behavior

Optimizations:
• MCPConnection.isConnected() caching to reduce overhead
• Concurrent server metadata retrieval instead of sequential

This refactoring addresses scalability bottlenecks and improves reliability
while maintaining backward compatibility with existing configurations.

* feat: Enabled import order in eslint.

* # Moved tests to __tests__ folder
# added tests for MCPServersRegistry.ts

* # Add unit tests for ConnectionsRepository functionality

* # Add unit tests for MCPConnectionFactory functionality

* # Reorganize MCP connection tests and improve error handling

* # reordering imports

* # Update testPathIgnorePatterns in jest.config.mjs to exclude development TypeScript files

* # removed mcp/manager.ts
2025-08-13 11:45:06 -04:00
..
app 🪙 fix: Max Output Tokens Refactor for Responses API (#8972) 2025-08-10 14:08:35 -04:00
cache 🔧 fix: Redis cluster connection errors and configuration (#9016) 2025-08-12 22:23:29 -04:00
config ♻️ refactor: MCPManager for Scalability, Fix App-Level Detection, Add Lazy Connections (#8930) 2025-08-13 11:45:06 -04:00
db 🔃 refactor: Optimize MeiliSearch Sync Processing and Tracking (#7994) 2025-06-20 18:05:19 -04:00
lib/utils 🏗️ refactor: Extract DB layers to data-schemas for shared use (#7650) 2025-05-30 22:18:13 -04:00
models feat: GPT-5 Token Limits, Rates, Icon, Reasoning Support 2025-08-07 16:23:11 -04:00
server ♻️ refactor: MCPManager for Scalability, Fix App-Level Detection, Add Lazy Connections (#8930) 2025-08-13 11:45:06 -04:00
strategies 🔒 fix: Provider Validation for Social, OpenID, SAML, and LDAP Logins (#8999) 2025-08-11 18:51:46 -04:00
test ℹ️ fix: Add back Removed Icons for MCP Servers in Tools Dialog (#8636) 2025-07-24 00:41:06 -04:00
utils feat: GPT-5 Token Limits, Rates, Icon, Reasoning Support 2025-08-07 16:23:11 -04:00
jest.config.js *️⃣ feat: Reuse OpenID Auth Tokens (#7397) 2025-05-23 17:40:40 -04:00
jsconfig.json feat(api): initial Redis support; fix(SearchBar): proper debounce (#1039) 2023-10-11 17:05:47 -04:00
package.json v0.8.0-rc2 (#9000) 2025-08-11 18:58:21 -04:00
typedefs.js 📑 docs: Fix Typos in JSDoc and Doc Files (#8998) 2025-08-12 10:18:55 -04:00