mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-25 12:34:38 -07:00
feat(mcp/extensions): Allow users to selectively enable/disable MCP servers included in an extension( Issue #11057 & #17402) (#17434)
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user