summaryrefslogtreecommitdiff
path: root/packages/cli/src/config/config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src/config/config.ts')
-rw-r--r--packages/cli/src/config/config.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts
index d116bc67..bf76fa4c 100644
--- a/packages/cli/src/config/config.ts
+++ b/packages/cli/src/config/config.ts
@@ -274,6 +274,26 @@ export async function loadCliConfig(
let mcpServers = mergeMcpServers(settings, activeExtensions);
const excludeTools = mergeExcludeTools(settings, activeExtensions);
+ if (!argv.allowedMcpServerNames) {
+ if (settings.allowMCPServers) {
+ const allowedNames = new Set(settings.allowMCPServers.filter(Boolean));
+ if (allowedNames.size > 0) {
+ mcpServers = Object.fromEntries(
+ Object.entries(mcpServers).filter(([key]) => allowedNames.has(key)),
+ );
+ }
+ }
+
+ if (settings.excludeMCPServers) {
+ const excludedNames = new Set(settings.excludeMCPServers.filter(Boolean));
+ if (excludedNames.size > 0) {
+ mcpServers = Object.fromEntries(
+ Object.entries(mcpServers).filter(([key]) => !excludedNames.has(key)),
+ );
+ }
+ }
+ }
+
if (argv.allowedMcpServerNames) {
const allowedNames = new Set(argv.allowedMcpServerNames.filter(Boolean));
if (allowedNames.size > 0) {