Skip to content

Agent Plugin's MCP does not expand env variables #302579

@ConsoleTVs

Description

@ConsoleTVs

How are we supposed to ship a local MCP server that requires env variables to work? The plugin loads fine in copilot CLI.

  • Copilot Chat Extension Version: 0.39.2
  • VS Code Version: 1.111.0
  • OS Version: macOS 26.3
  • Feature (e.g. agent/edit/ask mode): Does not matter
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): Does not matter
  • Logs: No

Steps to Reproduce:

Create an agent plugin, and set the .mcp.json to something like this;

{
  "mcpServers": {
    "enterprise-github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "-e",
        "GITHUB_HOST",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${ENTERPRISE_GITHUB_TOKEN}",
        "GITHUB_HOST": "https://enterprise.github.example.com"
      },
      "tools": ["*"]
    }
  }
}

The MCP server does load but throws 401. Works fine in copilot CLI.

Metadata

Metadata

Assignees

Labels

agent-pluginsbugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions