Browse Source

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.
MuriloFP 10 months ago
parent
commit
0bb6112257
2 changed files with 7 additions and 2 deletions
  1. 2 2
      src/core/webview/ClineProvider.ts
  2. 5 0
      src/services/mcp/McpHub.ts

+ 2 - 2
src/core/webview/ClineProvider.ts

@@ -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() ?? [],
 		}
 	}
 

+ 5 - 0
src/services/mcp/McpHub.ts

@@ -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) {