From 2bfce691f5f5298a735d4014113d08adea60d277 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Thu, 25 Sep 2025 11:14:41 +0000 Subject: [PATCH] fix: prevent duplicate MCP resources from appearing - Remove redundant resource fetching in toggleServerDisabled method - Resources are already fetched during initial connection in connectToServer - This fixes issue #8301 where resources appeared twice in the UI The duplicate fetching was happening when toggling server disabled state while the server was already connected. Since toggling disabled state doesn't affect the available resources/tools, we don't need to refresh them. --- .tmp/Roo-Code | 1 + src/services/mcp/McpHub.ts | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) create mode 160000 .tmp/Roo-Code diff --git a/.tmp/Roo-Code b/.tmp/Roo-Code new file mode 160000 index 0000000000..86debeef43 --- /dev/null +++ b/.tmp/Roo-Code @@ -0,0 +1 @@ +Subproject commit 86debeef43acbea9bdc1aa4b38d514541e164c91 diff --git a/src/services/mcp/McpHub.ts b/src/services/mcp/McpHub.ts index caca5ddb39..dc8ad4f80b 100644 --- a/src/services/mcp/McpHub.ts +++ b/src/services/mcp/McpHub.ts @@ -1376,15 +1376,9 @@ export class McpHub { await this.deleteConnection(serverName, serverSource) // When re-enabling, file watchers will be set up in connectToServer await this.connectToServer(serverName, config, serverSource) - } else if (connection.server.status === "connected") { - // Only refresh capabilities if connected - connection.server.tools = await this.fetchToolsList(serverName, serverSource) - connection.server.resources = await this.fetchResourcesList(serverName, serverSource) - connection.server.resourceTemplates = await this.fetchResourceTemplatesList( - serverName, - serverSource, - ) } + // Note: We don't need to refresh resources when the server is already connected + // because toggling disabled state doesn't affect the resources/tools available } catch (error) { console.error(`Failed to refresh capabilities for ${serverName}:`, error) }