Cursor · tool · fg-0514

Cursor MCP server fails authentication when mcp.json uses ${API_KEY} instead of ${env:API_KEY}

An MCP server configured with ${API_KEY} in env or headers rejects its credentials

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

Cursor resolves ${env:NAME}, ${userHome}, ${workspaceFolder}, ${workspaceFolderBasename}, and ${pathSeparator} in command, args, env, url, and headers; a bare ${NAME} is not one of its forms. envFile works only for stdio servers.

Fix

Use ${env:NAME} for environment variables, export them where Cursor can read them, and pass remote server secrets through headers with interpolation instead of envFile.

Apply

"env": { "API_KEY": "${env:API_KEY}" },
"headers": { "Authorization": "Bearer ${env:MY_SERVICE_TOKEN}" }

Affects: Cursor .cursor/mcp.json and ~/.cursor/mcp.json, as of 2026-10

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp