LibreChat/packages/api/src/mcp
Danny Avila 3bf715e05e
♻️ refactor: On-demand MCP connections: remove proactive reconnect, default to available (#11839)
* feat: Implement reconnection staggering and backoff jitter for MCP connections

- Enhanced the reconnection logic in OAuthReconnectionManager to stagger reconnection attempts for multiple servers, reducing the risk of connection storms.
- Introduced a backoff delay with random jitter in MCPConnection to improve reconnection behavior during network issues.
- Updated the ConnectionsRepository to handle multiple server connections concurrently with a defined concurrency limit.

Added tests to ensure the new reconnection strategy works as intended.

* refactor: Update MCP server query configuration for improved data freshness

- Reduced stale time from 5 minutes to 30 seconds to ensure quicker updates on server initialization.
- Enabled refetching on window focus and mount to enhance data accuracy during user interactions.

* ♻️  refactor: On-demand MCP connections; remove proactive reconnection, default to available

  - Remove reconnectServers() from refresh controller (connection storm root cause)
  - Stop gating server selection on connection status; add to selection immediately
  - Render agent panel tools from DB cache, not live connection status
  - Proceed to cached tools on init failure (only gate on OAuth)
  - Remove unused batchToggleServers()
  - Reduce useMCPServersQuery staleTime from 5min to 30s, enable refetchOnMount/WindowFocus

* refactor: Optimize MCP tool initialization and server connection logic

- Adjusted tool initialization to only occur if no cached tools are available, improving efficiency.
- Updated comments for clarity on server connection and tool fetching processes.
- Removed unnecessary connection status checks during server selection to streamline the user experience.
2026-02-17 22:33:57 -05:00
..
__tests__ 🎛️ fix: Google JSON Schema Normalization/Resolution Logic (#11804) 2026-02-15 21:31:16 -05:00
oauth ♻️ refactor: On-demand MCP connections: remove proactive reconnect, default to available (#11839) 2026-02-17 22:33:57 -05:00
registry 🛡️ fix: Implement TOCTOU-Safe SSRF Protection for Actions and MCP (#11722) 2026-02-11 22:09:58 -05:00
types 🛡️ fix: Implement TOCTOU-Safe SSRF Protection for Actions and MCP (#11722) 2026-02-11 22:09:58 -05:00
auth.ts 🚦 feat: Auto-reinitialize MCP Servers on Request (#9226) 2025-08-23 03:27:05 -04:00
connection.ts ♻️ refactor: On-demand MCP connections: remove proactive reconnect, default to available (#11839) 2026-02-17 22:33:57 -05:00
ConnectionsRepository.ts ♻️ refactor: On-demand MCP connections: remove proactive reconnect, default to available (#11839) 2026-02-17 22:33:57 -05:00
enum.ts 🧬 refactor: Optimize MCP Tool Queries with Server-Centric Architecture 2025-09-21 20:40:14 -04:00
errors.ts 🔒 feat: Add MCP server domain restrictions for remote transports (#11013) 2025-12-18 13:57:49 -05:00
mcpConfig.ts 🔧 chore: Update ESLint Config & Run Linter (#10986) 2025-12-15 17:55:25 -05:00
MCPConnectionFactory.ts 🛡️ fix: Secure MCP/Actions OAuth Flows, Resolve Race Condition & Tool Cache Cleanup (#11756) 2026-02-12 14:22:05 -05:00
MCPManager.ts 🛡️ fix: Implement TOCTOU-Safe SSRF Protection for Actions and MCP (#11722) 2026-02-11 22:09:58 -05:00
parsers.ts 👨‍✈️ chore: Minor MCP-UI Logic Cleanup (#10950) 2025-12-12 17:10:57 -05:00
UserConnectionManager.ts 🛡️ fix: Implement TOCTOU-Safe SSRF Protection for Actions and MCP (#11722) 2026-02-11 22:09:58 -05:00
utils.ts 💻 feat: Deeper MCP UI integration in the Chat UI (#9669) 2025-12-11 16:41:11 -05:00
zod.ts 🎛️ fix: Google JSON Schema Normalization/Resolution Logic (#11804) 2026-02-15 21:31:16 -05:00