fix: prevent disabled MCP servers from starting processes

- Add disabled checks in updateServerConnections() before calling connectToServer()
- Ensures disabled servers do not consume system resources
- Follows existing pattern used in readResource() and callTool() methods
- Fixes issue #2797
This commit is contained in:
Roo Code 2025-07-14 03:41:27 +00:00
parent a163053430
commit ebeb796e49

View file

@ -976,7 +976,9 @@ export class McpHub {
// New server
try {
this.setupFileWatcher(name, validatedConfig, source)
await this.connectToServer(name, validatedConfig, source)
if (!validatedConfig.disabled) {
await this.connectToServer(name, validatedConfig, source)
}
} catch (error) {
this.showErrorMessage(`Failed to connect to new MCP server ${name}`, error)
}
@ -985,7 +987,9 @@ export class McpHub {
try {
this.setupFileWatcher(name, validatedConfig, source)
await this.deleteConnection(name, source)
await this.connectToServer(name, validatedConfig, source)
if (!validatedConfig.disabled) {
await this.connectToServer(name, validatedConfig, source)
}
} catch (error) {
this.showErrorMessage(`Failed to reconnect MCP server ${name}`, error)
}