[FEATURE] MCP Servers configuration : add expanding variables support
Status Fixed / completed
Maintainer reply ✓ Yes — ashwin-ant
Activity 7 comments · opened Apr 30, 2025 · closed Jul 10, 2025
💡 Likely answer: A maintainer (ashwin-ant, collaborator)
responded on this thread — see the highlighted reply below.
In order for the project scope mcp servers to really be useful, it would be great that the config allowed for expanding environment variables.
For instance in a project .mcp.json :
{
"mcpServers": {
"mysql_local": {
"type": "stdio",
"command": "uvx",
"args": [
"--with",
"pymysql",
"mcp-alchemy"
],
"env": {
"DB_URL": "mysql+pymysql://$USER@localhost:3306/database"
}
}
}
}
The $USER variable isn't expanding, forcing everyone to install this mcp server locally and rendering it useless as a project mcp.
7 Comments
We're currently supporting the same MCP config format that most other clients are. One approach to solving this is to make the
commanda script inside your repo that invokes the MCP server with variables that it pulls from elsewhere.@ashwin-ant This is however not possible when using HTTP:
See: https://github.com/github/github-mcp-server
Please support this feature.
Without it, the project mcp json is unusable with many useful mcp servers like figma, github.
Hey all - just a heads up, I've picked this up and this feature should hopefully be released very shortly, in the next few releases
Hey all - this is now available in the latest release (1.0.48).
Docs are here! https://docs.anthropic.com/en/docs/claude-code/mcp#environment-variable-expansion-in-mcp-json
Beautiful! Thanks
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.