Skip to content

MCP server child processes do not inherit machine-level NuGet credential provider env vars #1795

@yzyczx

Description

@yzyczx

Describe the bug

MCP server child processes do not inherit machine-level NuGet credential provider env vars

Description

MCP servers launched by Copilot CLI via dotnet run fail to authenticate against private NuGet feeds, even though the same command works from the terminal on the same machine.

The NuGet credential provider is configured via machine-level environment variables (HKLM registry):

  • NUGET_PLUGIN_PATHS
  • NUGET_NETCORE_PLUGIN_PATHS

These should be inherited by all child processes. The terminal inherits them and authenticates fine. Copilot CLI's MCP server child processes do not.

Repro

  1. Have a .NET MCP server project that depends on a private Azure DevOps Artifacts feed (for packages or MSBuild SDK resolution via global.json)
  2. Machine has Azure Artifacts credential provider installed with machine-level env vars
  3. dotnet run works from the terminal
  4. The same MCP server fails to start in Copilot CLI with NuGet auth errors

Expected

Child processes inherit the full parent environment, including machine-level env vars — same as VS Code does when launching MCP servers.

Actual

NuGet credential provider is unavailable to the child process, causing unauthenticated requests that fail.

Note: dotnet run sends build errors to stdout (the MCP JSON-RPC transport), so these failures are silently swallowed. The server appears to fail with no diagnostics.

Environment

  • Windows 11, Copilot CLI 0.0.421-1, dotnet SDK 8.0/9.0
  • NuGet credential provider: Azure Artifacts CredentialProvider.Microsoft (MSAL)

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions