Cursor · tool · fg-0514

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

If you see An MCP server configured with ${API_KEY} in env or headers rejects its credentials, the cause and the fix for Cursor are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
An MCP server configured with ${API_KEY} in env or headers rejects its credentialsA config copied from Claude Code or another client works there but not in CursorenvFile is ignored for a remote HTTP or SSE server
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}" }
Affected
Cursor .cursor/mcp.json and ~/.cursor/mcp.json, as of 2026-10
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun