fix(cli): improve mcp list UX in untrusted folders (#26457)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
Adib234
2026-05-06 15:35:35 -04:00
committed by GitHub
parent feae856d6e
commit a38f393af7
3 changed files with 157 additions and 97 deletions
+15 -3
View File
@@ -348,6 +348,15 @@ export class LoadedSettings {
return this._merged;
}
/**
* Returns a merged settings object as if the folder were trusted.
* This is useful for commands like 'mcp list' that want to show
* what's configured even if it's currently disabled for security reasons.
*/
getMergedSettingsAsIfTrusted(): MergedSettings {
return this.computeMergedSettings(true);
}
setTrusted(isTrusted: boolean): void {
if (this.isTrusted === isTrusted) {
return;
@@ -368,13 +377,16 @@ export class LoadedSettings {
};
}
private computeMergedSettings(): MergedSettings {
private computeMergedSettings(forceTrusted = false): MergedSettings {
const isTrusted = forceTrusted || this.isTrusted;
const workspace = forceTrusted ? this._workspaceFile : this.workspace;
const merged = mergeSettings(
this.system.settings,
this.systemDefaults.settings,
this.user.settings,
this.workspace.settings,
this.isTrusted,
workspace.settings,
isTrusted,
);
// Remote admin settings always take precedence and file-based admin settings