Use yargs array type for the allowedMcpServerNames flag instead of processing the list directly ourselves. (#3600)

This commit is contained in:
Tyler
2025-07-09 11:38:38 -07:00
committed by GitHub
parent 017a0a6c86
commit 6c12f9e0d9
2 changed files with 12 additions and 9 deletions

View File

@@ -50,7 +50,7 @@ interface CliArgs {
telemetryTarget: string | undefined;
telemetryOtlpEndpoint: string | undefined;
telemetryLogPrompts: boolean | undefined;
allowedMcpServerNames: string | undefined;
allowedMcpServerNames: string[] | undefined;
extensions: string[] | undefined;
listExtensions: boolean | undefined;
}
@@ -152,7 +152,8 @@ async function parseArguments(): Promise<CliArgs> {
default: false,
})
.option('allowed-mcp-server-names', {
type: 'string',
type: 'array',
string: true,
description: 'Allowed MCP server names',
})
.option('extensions', {
@@ -247,9 +248,7 @@ export async function loadCliConfig(
const excludeTools = mergeExcludeTools(settings, activeExtensions);
if (argv.allowedMcpServerNames) {
const allowedNames = new Set(
argv.allowedMcpServerNames.split(',').filter(Boolean),
);
const allowedNames = new Set(argv.allowedMcpServerNames.filter(Boolean));
if (allowedNames.size > 0) {
mcpServers = Object.fromEntries(
Object.entries(mcpServers).filter(([key]) => allowedNames.has(key)),