@@ -1306,4 +1306,52 @@ export class McpHub {
13061306 }
13071307 this . disposables . forEach ( ( d ) => d . dispose ( ) )
13081308 }
1309+
1310+ /**
1311+ * Enables or disables all global MCP servers at once.
1312+ * When activated, the configuration is reloaded.
1313+ * @param disabled true = disable all, false = enable all
1314+ */
1315+ public async toggleAllServersDisabled ( disabled : boolean ) : Promise < void > {
1316+ // Collect all global server names
1317+ const allServers = this . getAllServers ( )
1318+
1319+ // Set the Disabled flag for all servers
1320+ for ( const server of allServers ) {
1321+ await this . updateServerConfig ( server . name , { disabled } , server . source )
1322+ const conn = this . findConnection ( server . name , server . source )
1323+ if ( conn ) {
1324+ conn . server . disabled = disabled
1325+ }
1326+ }
1327+
1328+ // If activated, reload configuration
1329+ if ( ! disabled ) {
1330+ // Re-initialize all servers, both global and project
1331+ await this . initializeMcpServers ( "global" )
1332+ await this . initializeMcpServers ( "project" )
1333+ }
1334+
1335+ await this . notifyWebviewOfServerChanges ( )
1336+ }
1337+
1338+ /**
1339+ * Restarts all currently active MCP servers.
1340+ * This will trigger a popup for each server being restarted.
1341+ */
1342+ public async restartAllMcpServers ( ) : Promise < void > {
1343+ const allServers = this . getAllServers ( ) // Get all servers, regardless of disabled state
1344+ const restartPromises = allServers . map ( async ( server ) => {
1345+ // Only restart if not disabled
1346+ if ( ! server . disabled ) {
1347+ try {
1348+ await this . restartConnection ( server . name , server . source )
1349+ } catch ( error ) {
1350+ this . showErrorMessage ( `Failed to restart MCP server ${ server . name } ` , error )
1351+ }
1352+ }
1353+ } )
1354+ await Promise . all ( restartPromises )
1355+ await this . notifyWebviewOfServerChanges ( )
1356+ }
13091357}
0 commit comments