- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.3k
 
Fix MCP server reliability issues #4299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            jgowdy-godaddy
  wants to merge
  11
  commits into
  Mintplex-Labs:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
jgowdy-godaddy:fix/mcp-code-issues
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            Fix MCP server reliability issues #4299
                    jgowdy-godaddy
  wants to merge
  11
  commits into
  Mintplex-Labs:master
from
jgowdy-godaddy:fix/mcp-code-issues
  
      
      
   
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    Replace SIGHUP with SIGTERM for proper graceful shutdown of MCP server processes. SIGTERM is the standard signal for requesting process termination and allows processes to clean up properly.
Implement locking mechanism to prevent race conditions when multiple instances of MCPHypervisor or MCPCompatibilityLayer are created simultaneously. This ensures only one instance is created even under concurrent access.
Clear timeout handlers after connection succeeds or fails to prevent memory leaks. Add proper cleanup in both success and error paths when using Promise.race with timeout.
…4017 Mintplex-Labs#3854 GUI applications on macOS and Linux don't inherit login shell environment. Load shell environment to ensure PATH and other variables are available for MCP server processes, fixing 'spawn npx ENOENT' errors.
Add explicit support for type='http' in transport configuration. Route HTTP streaming servers to StreamableHTTPClientTransport instead of incorrectly falling back to SSE transport.
Implement fallback JSON stringification with circular reference detection to prevent crashes when MCP tool results contain circular object references. Use WeakSet to track visited objects and replace circular references with '[Circular]' markers.
Get fresh MCP instance reference on each tool call to avoid using stale connections when MCP servers are restarted. Add validation to ensure MCP server is running before attempting tool execution.
Add try-catch blocks around all MCP async operations including ping(), listTools(), and tool execution. Gracefully handle connection failures and provide fallback behavior when MCP servers become unavailable.
- Replace hasOwnProperty calls with Object.prototype.hasOwnProperty.call() - Add eslint-disable-line for intentionally unused parameter
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary
Fix multiple reliability issues in MCP server management including process termination, memory leaks, race conditions, and transport compatibility.
Test plan
These changes address real issues reported in #4017 and #3854 regarding MCP server failures in desktop environments.