mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Use yargs array type for the allowedMcpServerNames flag instead of processing the list directly ourselves. (#3600)
This commit is contained in:
@@ -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)),
|
||||
|
||||
Reference in New Issue
Block a user