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

**URL:** <https://forum.cursor.com/t/config-interpolation-env-name-not-working-in-headers-for-remote-mcp-servers/156069>\
**Category:** Bug Reports\
**Tags:** mcp\
**Created:** [March 27, 2026, 9:27pm UTC](https://forum.cursor.com/t/config-interpolation-env-name-not-working-in-headers-for-remote-mcp-servers/156069 "2026-03-27T21:27:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsb](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/rsb/32/105029_2.png) [@rsb](https://forum.cursor.com/u/rsb)\
**Post date:** [March 27, 2026, 9:27pm UTC](https://forum.cursor.com/t/config-interpolation-env-name-not-working-in-headers-for-remote-mcp-servers/156069/1 "2026-03-27T21:27:39Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

Per Cursor’s [MCP documentation](https://cursor.com/docs/mcp#config-interpolation), 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:

```auto
{
  "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](https://cursor.com/help/customization/mcp) - “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

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [March 28, 2026, 5:51am UTC](https://forum.cursor.com/t/config-interpolation-env-name-not-working-in-headers-for-remote-mcp-servers/156069/5 "2026-03-28T05:51:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [April 19, 2026, 5:51am UTC](https://forum.cursor.com/t/config-interpolation-env-name-not-working-in-headers-for-remote-mcp-servers/156069/6 "2026-04-19T05:51:45Z")

</div>

Closed on April 19, 2026, 5:51am UTC

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
