You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support of ${} environment variable in mcp-config #1232
@stefanbosak I am not getting this to work with Context7 using copilot0.0.420. I can verify that inserting the credential as-is without the string expansion works, but when I use string expansion, copilot returns:
I'm unable to access the Context7 MCP due to an API key issue. Please provide a valid Context7 API
key, or let me know if you'd like me to fetch the Renovate documentation directly from the web.
I am using direnv to set the environment variable, and I can confirm it loads when I run echo $CONTEXT7_API_KEY
My .mcp.json config (support has been added for this file location) is the following:
which means passing environment variable into related inner attribute in structure such as headers entities.
Would be great is passing of environment variables would be supported in general not tight to specific use cases only or depth of given element in structure especially including agent configuration like which also does not work - example .copilot/agents/graylog-tst.agent.md (this is really valuable within agent definitions):
${workspaceFolder} not expanded when reading .vscode/mcp.json
Since v0.0.407 added .vscode/mcp.json support, Copilot CLI reads the file but does not expand ${workspaceFolder} — the most commonly used variable in workspace MCP configs. The literal string ${workspaceFolder} gets treated as a relative path segment, so every server that uses it in args fails immediately:
This is particularly painful in repos that also use Copilot CLI plugins (which Copilot CLI and Claude Code can read, but VS Code Copilot cannot). The result:
Copilot CLI reads .vscode/mcp.json → all servers fail because ${workspaceFolder} isn't expanded
The same servers are also available via a plugin (which works correctly in Copilot CLI)
Users see every MCP server listed twice — one failing copy from .vscode/mcp.json and one working copy from the plugin
There's no way to tell Copilot CLI to skip .vscode/mcp.json
Expected behavior: Either fully expand VS Code variables (${workspaceFolder}, ${input:...}, etc.) when reading .vscode/mcp.json, or provide an opt-out so repos that use plugins aren't forced into a broken state.
Environment: Copilot CLI v0.0.423, running in GitHub Codespaces. The .vscode/mcp.json uses ${workspaceFolder} in args for all stdio-type MCP servers — standard VS Code pattern per VS Code MCP docs.
I believe this has been addressed in current versions. ${VAR} expansion works in MCP config value fields including env, command, args, cwd, URLs, and HTTP headers. Note that ${workspaceFolder} is a VS Code-specific variable rather than a shell environment variable, so that case is handled differently. If this still doesn't work for your specific configuration, feel free to reopen the issue with a minimal example.
Activity
stefanbosak commentedon Feb 3, 2026
working:
"mcpServers": {
"postgres": {
"tools": [
""
],
"type": "local",
"command": "/usr/local/bin/toolbox",
"args": [
"--prebuilt",
"postgres",
"--stdio"
],
"env": {
"POSTGRES_HOST": "${POSTGRES_HOST}",
"POSTGRES_PORT": "{POSTGRES_PORT}",
"POSTGRES_DATABASE": "${POSTGRES_DATABASE}",
"POSTGRES_USER": "${POSTGRES_USER}",
"POSTGRES_PASSWORD": "${POSTGRES_PASSWORD}"
}
},
"ref": {
"tools": [
""
],
"type": "http",
"url": "https://api.ref.tools/mcp",
"headers": {
"x-ref-api-key": "${REF_API_KEY}"
}
}
}
does not working:
"mcpServers": {
"graylog-tst": {
"tools": [
"*"
],
"type": "http",
"url": "https://graylog.tst.domain.tld/api/mcp",
"headers": {
"Authorization": "Basic ${GRAYLOG_TST_TOKEN}"
}
}
}
Notes:
therealvio commentedon Mar 1, 2026
@stefanbosak I am not getting this to work with Context7 using
copilot0.0.420. I can verify that inserting the credential as-is without the string expansion works, but when I use string expansion, copilot returns:I am using
direnvto set the environment variable, and I can confirm it loads when I runecho $CONTEXT7_API_KEYMy
.mcp.jsonconfig (support has been added for this file location) is the following:{ "mcpServers": { "context7": { "type": "http", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "${CONTEXT7_API_KEY}" }, "tools": ["*"] } } }Does anyone have any idea if this is actually supported?
stefanbosak commentedon Mar 6, 2026
Hi @therealvio ,
CONTEXT7_API_KEY use case is just example and it is working as stated.
See more details regarding:
"mcpServers": {
"graylog-tst": {
"tools": [
"*"
],
"type": "http",
"url": "https://graylog.tst.domain.tld/api/mcp",
"headers": {
"Authorization": "Basic ${GRAYLOG_TST_TOKEN}"
}
}
}
which means passing environment variable into related inner attribute in structure such as headers entities.
Would be great is passing of environment variables would be supported in general not tight to specific use cases only or depth of given element in structure especially including agent configuration like which also does not work - example .copilot/agents/graylog-tst.agent.md (this is really valuable within agent definitions):
name: graylog-tst
description: "Tools for interaction with graylog testing environment. Use when asked about log analysis, searching logs, or graylog in the test/staging environment."
mcp-servers:
graylog-tst:
type: http
url: https://graylog.tst.domain.tld/api/mcp
headers:
Authorization: "Basic ${GRAYLOG_TST_TOKEN}"
tools:
- "*"
Use the graylog-tst MCP server tools to search and analyze logs in the Graylog testing environment.
Search logs, create streams, manage alerts. Use the #graylog-tst skill for detailed guidance.
Thank you.
nick-pape commentedon Mar 6, 2026
${workspaceFolder}not expanded when reading.vscode/mcp.jsonSince v0.0.407 added
.vscode/mcp.jsonsupport, Copilot CLI reads the file but does not expand${workspaceFolder}— the most commonly used variable in workspace MCP configs. The literal string${workspaceFolder}gets treated as a relative path segment, so every server that uses it inargsfails immediately:This is particularly painful in repos that also use Copilot CLI plugins (which Copilot CLI and Claude Code can read, but VS Code Copilot cannot). The result:
.vscode/mcp.json→ all servers fail because${workspaceFolder}isn't expanded.vscode/mcp.jsonand one working copy from the plugin.vscode/mcp.jsonExpected behavior: Either fully expand VS Code variables (
${workspaceFolder},${input:...}, etc.) when reading.vscode/mcp.json, or provide an opt-out so repos that use plugins aren't forced into a broken state.Environment: Copilot CLI v0.0.423, running in GitHub Codespaces. The
.vscode/mcp.jsonuses${workspaceFolder}inargsfor all stdio-type MCP servers — standard VS Code pattern per VS Code MCP docs.examon commentedon Apr 7, 2026
I believe this has been addressed in current versions.
${VAR}expansion works in MCP config value fields includingenv,command,args,cwd, URLs, and HTTP headers. Note that${workspaceFolder}is a VS Code-specific variable rather than a shell environment variable, so that case is handled differently. If this still doesn't work for your specific configuration, feel free to reopen the issue with a minimal example.fix(mcps): preserve symbolic credentials across shared targets (#300)
Keep the MCP client PAT off the command line