Roo-Code/src/services
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
..
browser Prettier backfill 2025-01-17 14:11:28 -05:00
glob Misc refactor cline 2024-10-09 01:49:59 -04:00
mcp fix: Implement singleton pattern for MCP server management to prevent multiple instances 2025-02-07 15:51:30 -03:00
ripgrep Chore: Prettier for consistant formatting (#794) 2024-11-21 13:13:54 -08:00
tree-sitter Prettier backfill 2025-01-17 14:11:28 -05:00