fix: ensure disabled MCP servers appear in settings UI

When the MCP server was initialized before opening RooCode, disabled servers
would not appear in the settings UI. This was fixed by:

1. Using getAllServers() instead of getServers() in ClineProvider.ts for UI
   state updates, ensuring all servers (including disabled ones) are shown
2. Maintaining getServers() for operational use (AI prompts, tool calls)
   where disabled servers should be filtered out

The fix maintains clean separation between UI display and operational
server filtering.
This commit is contained in:
MuriloFP 2025-02-09 19:15:01 -03:00
parent c6c70c2479
commit 0bb6112257
2 changed files with 7 additions and 2 deletions

View file

@ -628,7 +628,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
if (this.mcpHub) {
this.postMessageToWebview({
type: "mcpServers",
mcpServers: this.mcpHub.getServers(),
mcpServers: this.mcpHub.getAllServers(),
})
}
@ -2259,7 +2259,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
autoApprovalEnabled: autoApprovalEnabled ?? false,
customModes: await this.customModesManager.getCustomModes(),
experiments: experiments ?? experimentDefault,
mcpServers: this.mcpHub?.getServers() ?? [],
mcpServers: this.mcpHub?.getAllServers() ?? [],
}
}

View file

@ -67,6 +67,11 @@ export class McpHub {
return this.connections.filter((conn) => !conn.server.disabled).map((conn) => conn.server)
}
getAllServers(): McpServer[] {
// Return all servers regardless of state
return this.connections.map((conn) => conn.server)
}
async getMcpServersPath(): Promise<string> {
const provider = this.providerRef.deref()
if (!provider) {