[BUG] .env variable substitution in .mcp.json works in Cursor but not VS Code
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Cursor: using Claude Code for VS Code extension 2.0.62 - 6 days ago (current)
VS Code: using Claude Code for VS Code extension 2.0.65 - 4 days ago (current)
Both IDEs are pointed to the same local project folder. I started with the following in .mcp.json:
{
"mcpServers": {
"supabase": {
"type": "http",
"url": "https://mcp.supabase.com/mcp?project_ref=${SUPABASE_PROJECT_REF}",
"headers": {
"Authorization": "Bearer ${SUPABASE_ACCESS_TOKEN}"
}
}
}
}
Claude Code extension for VS Code in Cursor is able to connect to Supabase and read the tables, but Claude Code extension for VS Code in VS Code is not. Tells me I need to auth. Even when it says it can now see the env variables and I need to do a developr refresh or restart, and subsequently do both, it still says not connected to supabase. IT suggested I hardcode the variable values in .msp.json and then it connected to Supabase right away. This is not ideal because it means specifying the value of these variables in multiple places and not having a single source of truth for their values. Not a hypothetical issue because we did in fact just change our Supabase instance.
<img width="660" height="587" alt="Image" src="https://github.com/user-attachments/assets/3f521361-3a43-46e4-b88d-8a7c796fb18c" />
What Should Happen?
Not sure if this is simply a limitation of VS Code, or something extra Claude Code needs to do in VS Code to get this to work, but Claude Code extension in VS Code should hopefully work the same way as Claude Code extension in Cursor when it comes to being able to specify env variables in .mcp.json instead of having to hardcode them.
Error Messages/Logs
Steps to Reproduce
- Use variable references in your .mcp.json file for and mcp server (for example, supabase, using the following, or any other mcp config)
{
"mcpServers": {
"supabase": {
"type": "http",
"url": "https://mcp.supabase.com/mcp?project_ref=${SUPABASE_PROJECT_REF}",
"headers": {
"Authorization": "Bearer ${SUPABASE_ACCESS_TOKEN}"
}
}
}
}
- attempt to access the mcp server using Claude Code extensions in both Cursor and VS Code
- Verify it successfully connects in Cursor but not in VS Code
- Attempt to get VS Code to read the .env file and know that it should replace the referenced variables with their values from the .env file when acessing the mcp server defined, and do a developer refresh, and then restart VS code. Try again and see if you can connect to the mcp server (you probably won't).
- Hardcode the values in .mcp.json now and test mcp connection. It should work. This proves that Claude Code extension in Cursor can successfully deal with env variable references in .mcp.json but Claude Code extension in VS Code can not.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.65
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗