${env:VAR} is not substituted in mcp.json server headers
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
**VS Code version:** 1.137.0 (645f29cc3176500b4b5762ba887cf2a7f0ffdf2c), x64
**Repro:**
1. In `mcp.json`, configure an `http` server with:
```jsonc
"headers": { "Authorization": "Bearer ${env:MY_VAR}" }
```
2. Set `MY_VAR` as a persisted Windows user-level env var. Confirm it resolves correctly in a fresh terminal (`$env:MY_VAR`).
3. Fully quit and relaunch VS Code (not just "Reload Window") so the process inherits the env var.
4. Server fails to connect / registers no tools - consistent with the literal unsubstituted string `${env:MY_VAR}` being sent as the header value (401 from the remote endpoint).
**Workaround:** hardcoding the literal secret value directly in `headers` works immediately - confirms substitution is the issue, not auth/connectivity/env-var scoping.
**Expected:** `${env:VAR}` should resolve in `headers` the same way it does in other MCP config contexts, or docs should explicitly state `headers` only supports `${input:...}` (current docs are ambiguous/silent on this).
Contributor guide
Assessment
This issue has not been assessed yet.