Skip to content

Domain parsing fails when -d flag is provided once with comma-separated values (as proposed by VSCode template) #800

@pwes-interlan

Description

@pwes-interlan

The Azure DevOps MCP server fails to properly parse domains when the -d flag is provided once with comma-separated domain names, which is a common pattern when using VS Code input variables.

Reproduction

In .vscode/mcp.json, which was mostly generated for me automatically after installing the MCP Server:

{
  "servers": {
    "microsoft/azure-devops-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@azure-devops/mcp@latest",
        "myorg",
        "-p", "mmyproject",
        "-d", "${input:ado_domain}"
      ]
    }
  },
  "inputs": [{
    "id": "ado_domain",
    "type": "promptString",
    "default": "core,work,work-items,search,repositories",
    "description": "Repeat to enable specific domains: core, work, work-items, search, test-plans, repositories, wiki, pipelines, advanced-security."
  }
}

Expected behavior

All domains from ado_domain (by default: core, work, work-items, search, and repositories) should be enabled.

Actual behavior

No specific domain is recognized, treating the entire comma-separated string as a single domain name:

2025-12-18 12:52:43.607 [warning] [server stderr] Error: Specified invalid domain 'core, work, work-items, search, repositories'. Please specify exactly as available domains: advanced-security, pipelines, core, repositories, search, test-plans, wiki, work, work-items
2025-12-18 12:52:43.630 [info] Discovered 77 tools

Root cause

The issue occurs due to how yargs handles the -d option combined with the DomainsManager logic:

  1. The -d option is configured with array: true (index.ts#L43)
  2. When -d "core,work,work-items" is passed, yargs creates: ["core,work,work-items"] (one-element array)
  3. The DomainsManager constructor receives an array and calls handleArrayInput() (domains.ts#L47)
  4. handleArrayInput() doesn't split on commas, only handleStringInput() does (domains.ts#L60-L61)

Suggested fix

Modify handleArrayInput() to split comma-separated values in array elements:

private handleArrayInput(domainsInput: string[]): void {
  if (domainsInput.length === 0 || domainsInput.includes(ALL_DOMAINS)) {
    this.enableAllDomains();
    return;
  }
  
  const domains = domainsInput.flatMap(dd => dd.split(',').map(d => d.trim().toLowerCase()));
  this.validateAndAddDomains(domains);
}

This would support both usage patterns:

  • Multiple flags: -d core -d work -d repositories
  • Single flag with comma-separated values: -d "core,work,repositories"

Workaround

Currently, users must repeat the -d flag for each domain, which is verbose for VS Code input variables. There is also no option to use input variables.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions