Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/cli/src/acp/acpSessionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,15 @@ export class AcpSessionManager {
mcpServers: mergedMcpServers,
};

const config = await loadCliConfig(settings, sessionId, this.argv, { cwd });
const config = await loadCliConfig(settings, sessionId, this.argv, {
cwd,
// Pass the LoadedSettings so loadCliConfig uses the consolidated (union
// of excluded / intersection of allowed) MCP server lists across all
// settings scopes, matching the interactive path. Without this, the ACP
// path fell back to the raw merged settings, where a workspace
// mcp.excluded could REPLACE (drop) a user-level block.
loadedSettings: currentSettings,
});

createPolicyUpdater(
config.getPolicyEngine(),
Expand Down
12 changes: 11 additions & 1 deletion packages/cli/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,17 @@ export async function loadCliConfig(
},
mcp: {
...settings.mcp,
allowed: argv.allowedMcpServerNames ?? settings.mcp?.allowed,
// Use the consolidated MCP lists (union of excluded across all scopes,
// intersection of allowed) for the policy engine, so a workspace-scoped
// mcp.excluded cannot drop a user/system block via REPLACE merge.
allowed:
argv.allowedMcpServerNames ??
(loadedSettings
? loadedSettings.getConsolidatedAllowedMcpServers()
: settings.mcp?.allowed),
excluded: loadedSettings
? loadedSettings.getConsolidatedExcludedMcpServers()
: settings.mcp?.excluded,
},
policyPaths: (argv.policy ?? settings.policyPaths)?.map((p) =>
resolvePath(p),
Expand Down