Roo-Code/src
MuriloFP b2b5e1ffa6 fix: Implement singleton pattern for MCP server management to prevent multiple instances
Problem:
- Multiple instances of the Roo Code application were launching separate MCP server instances
- This led to unnecessary resource consumption and potential conflicts between instances

Solution:
1. Created new McpServerManager singleton class to manage MCP server instances:
   - Static getInstance() method ensures only one McpHub instance exists
   - Tracks registered ClineProvider instances
   - Handles cleanup on extension deactivation

2. Modified ClineProvider class:
   - Changed mcpHub from private to protected
   - Added getMcpHub() public getter method
   - Updated initialization to use McpServerManager
   - Added unregister logic in dispose()

3. Updated extension.ts to handle cleanup:
   - Added McpServerManager cleanup in deactivate()

Technical Implementation:
- Uses WeakRef for provider tracking to allow proper garbage collection
- Maintains global state to track instance IDs
- Implements proper cleanup of resources on disposal
- Ensures backward compatibility with existing code

This change significantly improves resource usage and prevents potential conflicts
between multiple instances of the application while maintaining all existing
functionality.
2025-02-07 15:51:30 -03:00
..
__mocks__ Fix tests 2025-02-01 12:21:13 -05:00
activate add user input 2025-02-06 10:48:34 +07:00
api Prevent provider client instantiations from throwing 2025-02-07 03:06:01 -08:00
core fix: Implement singleton pattern for MCP server management to prevent multiple instances 2025-02-07 15:51:30 -03:00
exports fix: correct VSCode URI 2025-01-15 08:24:21 +11:00
integrations feat: add terminal integration commands 2025-02-06 10:27:12 +07:00
services fix: Implement singleton pattern for MCP server management to prevent multiple instances 2025-02-07 15:51:30 -03:00
shared Merge pull request #807 from samhvw8/feat/terminal-menu-context 2025-02-05 23:41:32 -05:00
test Fall back to js bundle when local webview app not running in development 2025-02-03 09:19:52 -08:00
utils Safer profile path check 2025-02-04 23:59:36 -05:00
extension.ts fix: Implement singleton pattern for MCP server management to prevent multiple instances 2025-02-07 15:51:30 -03:00