diff options
| author | christine betts <[email protected]> | 2025-07-15 20:45:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-15 20:45:24 +0000 |
| commit | 58f1aa6ceb53df94cc5bba77dc787950be340cb9 (patch) | |
| tree | 10a5ac6bab999da4cfde7f0c209989ac4529780e /packages/cli/src/config/config.ts | |
| parent | 03b3917f62e5db2b00bcb27df9d78ee5289d9a85 (diff) | |
Add support for allowed/excluded MCP server names in settings (#4135)
Co-authored-by: Scott Densmore <[email protected]>
Diffstat (limited to 'packages/cli/src/config/config.ts')
| -rw-r--r-- | packages/cli/src/config/config.ts | 20 |
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) { |
