@@ -960,26 +960,20 @@ export class McpHub {
960960
961961 // Update the connection object
962962 if ( connection ) {
963- const wasDisabled = connection . server . disabled
964- connection . server . disabled = disabled
965-
966- // When the server is activated, reload the configuration
967- if ( wasDisabled && ! disabled ) {
968- await this . initializeMcpServers ( serverSource )
969- }
963+ try {
964+ connection . server . disabled = disabled
970965
971- // Only refresh capabilities if connected
972- if ( connection . server . status === "connected" ) {
973- try {
966+ // Only refresh capabilities if connected
967+ if ( connection . server . status === "connected" ) {
974968 connection . server . tools = await this . fetchToolsList ( serverName , serverSource )
975969 connection . server . resources = await this . fetchResourcesList ( serverName , serverSource )
976970 connection . server . resourceTemplates = await this . fetchResourceTemplatesList (
977971 serverName ,
978972 serverSource ,
979973 )
980- } catch ( error ) {
981- console . error ( `Failed to refresh capabilities for ${ serverName } :` , error )
982974 }
975+ } catch ( error ) {
976+ console . error ( `Failed to refresh capabilities for ${ serverName } :` , error )
983977 }
984978 }
985979
@@ -1312,33 +1306,4 @@ export class McpHub {
13121306 }
13131307 this . disposables . forEach ( ( d ) => d . dispose ( ) )
13141308 }
1315-
1316- /**
1317- * Enables or disables all global MCP servers at once.
1318- * When activated, the configuration is reloaded.
1319- * @param disabled true = disable all, false = enable all
1320- */
1321- public async toggleAllServersDisabled ( disabled : boolean ) : Promise < void > {
1322- // Collect all global server names
1323- const globalConnections = this . connections . filter (
1324- ( conn ) => conn . server . source === "global" || ! conn . server . source ,
1325- )
1326- const serverNames = globalConnections . map ( ( conn ) => conn . server . name )
1327-
1328- // Set the Disabled flag for all servers
1329- for ( const name of serverNames ) {
1330- await this . updateServerConfig ( name , { disabled } , "global" )
1331- const conn = this . findConnection ( name , "global" )
1332- if ( conn ) {
1333- conn . server . disabled = disabled
1334- }
1335- }
1336-
1337- // If activated, reload configuration
1338- if ( ! disabled ) {
1339- await this . initializeMcpServers ( "global" )
1340- }
1341-
1342- await this . notifyWebviewOfServerChanges ( )
1343- }
13441309}
0 commit comments