Skip to content

[BUG] apm install writes bare ${VAR} in VS Code mcp.json headers #944

@kkadete

Description

@kkadete

Describe the bug

When a self-defined MCP server in apm.yml uses bare ${VARNAME} syntax in headers,
apm install writes those references verbatim into .vscode/mcp.json. The target "vscode", VS Code does not
resolve bare ${VARNAME} — it only understands ${env:VARNAME} (host environment) or
${input:id} (runtime prompt). The result is that the header value is sent as the literal
string ${VARNAME} to the MCP server instead of the secret value.

To Reproduce

Define a self-defined HTTP MCP server in apm.yml with a header using bare ${VAR} syntax:

   dependencies:
     mcp:
       - name: my-server
         registry: false
         transport: http
         url: https://my-server.example.com/mcp
         headers:
           Authorization: "Bearer ${MY_SECRET_TOKEN}"

Set MY_SECRET_TOKEN in the shell environment.
Run apm install.
Open .vscode/mcp.json — observe "Authorization": "Bearer ${MY_SECRET_TOKEN}" written verbatim.
Start the MCP server in VS Code — the header value is Bearer ${MY_SECRET_TOKEN} (literal string), not the token.

Expected behavior

apm install should translate bare ${VARNAME} references in headers to VS Code-compatible
${env:VARNAME} syntax before writing .vscode/mcp.json, so VS Code resolves them from the
host environment at runtime.

Expected output in .vscode/mcp.json:

"headers": {  "Authorization": "Bearer ${env:MY_SECRET_TOKEN}"}

Actual output:

"headers": {  "Authorization": "Bearer ${MY_SECRET_TOKEN}"}

Environment

OS: Windows 11
Python Version: 3.12
APM Version: 0.9.2

The target "copilot" should also take this into consideration, but removing the "env:" in case it exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).area/mcp-configMCP server configuration depth, transports, variable resolution.bugDeprecated: use type/bug. Kept for issue history; will be removed in milestone 0.10.0.priority/highShips in current or next milestonestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/portabilityOne manifest, every target. Multi-target deploy, marketplace, packaging, install.type/bugSomething does not work as documented.

    Type

    No type

    Projects

    Status

    Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions