feat(mcp/extensions): Allow users to selectively enable/disable MCP servers included in an extension( Issue #11057 & #17402) (#17434)

This commit is contained in:
Jasmeet Bhatia
2026-01-26 17:02:14 -08:00
committed by GitHub
parent 3909ad67db
commit 57b57cc997
6 changed files with 145 additions and 43 deletions
@@ -323,6 +323,35 @@ export class McpServerEnablementManager {
};
}
/**
* Auto-enable any disabled MCP servers by name.
* Returns server names that were actually re-enabled.
*/
async autoEnableServers(serverNames: string[]): Promise<string[]> {
const enabledServers: string[] = [];
for (const serverName of serverNames) {
const normalizedName = normalizeServerId(serverName);
const state = await this.getDisplayState(normalizedName);
let wasDisabled = false;
if (state.isPersistentDisabled) {
await this.enable(normalizedName);
wasDisabled = true;
}
if (state.isSessionDisabled) {
this.clearSessionDisable(normalizedName);
wasDisabled = true;
}
if (wasDisabled) {
enabledServers.push(serverName);
}
}
return enabledServers;
}
/**
* Read config from file asynchronously.
*/