Config interpolation ${env:NAME} not working in headers for remote MCP servers

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Per Cursor’s MCP documentation, config interpolation with ${env:NAME} syntax should work in the headers field. However, for remote HTTP/SSE MCP servers, the variable is not resolved - the literal string ${env:VAR_NAME} is sent instead of the environment variable value.

(Note: Config interpolation does work with local / STDIO servers).

Steps to Reproduce

  1. Set environment variable:

export MY_API_KEY="actual_secret_key"

  1. Configure remote MCP server in mcp.json:
{
  "mcpServers": {
    "my-server": {
      "url": "https://example.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${env:MY_API_KEY}"
      }
    }
  }
}
  1. Restart Cursor and connect to the MCP server

Expected Behavior

Server receives Authorization: Bearer actual_secret_key

Actual behavior:
Server receives Authorization: Bearer ${env:MY_API_KEY} (literal string)

Operating System

Linux

Version Information

Version: 2.6.21
VSCode Version: 1.105.1
Commit: fea2f546c979a0a4ad1deab23552a43568807590
Date: 2026-03-21T22:09:10.098Z
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Linux x64 6.8.0-106-generic

For AI issues: which model did you use?

N/A

For AI issues: add Request ID with privacy disabled

N/A

Additional Information

Workaround: Use hardcoded API key directly in config (not ideal for security)

Documentation Reference: MCP integrations | Cursor Docs - “Config interpolation” section states ${env:NAME} is supported for headers field.

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the detailed report.

The ${env:NAME} interpolation for headers was fixed in a previous release and should work on your version. The most common reason it fails on Linux is that environment variables set in shell config files .bashrc or .zshrc aren’t available to Cursor when it’s launched from a desktop entry rather than a terminal.

Could you try these steps to narrow it down:

  1. Open a terminal where echo $MY_API_KEY returns the correct value
  2. Launch Cursor directly from that terminal: cursor
  3. Test the MCP connection again

If it works when launched from the terminal, the issue is that the variable isn’t available to the desktop process. To fix this permanently, set the variable in /etc/environment or ~/.pam_environment instead of your shell RC file.

If it still doesn’t work even when launched from the terminal, let me know and I’ll dig deeper. In that case, please also check the MCP logs in Ctrl+Shift+U, then select MCP Logs for anything related to header resolution.