Skip to content

feat(mcp): support VS Code-style variable interpolation in MCP server config - #13036

Open
Onkar-Mane wants to merge 1 commit into
continuedev:mainfrom
Onkar-Mane:mcp-variable-interpolation
Open

feat(mcp): support VS Code-style variable interpolation in MCP server config#13036
Onkar-Mane wants to merge 1 commit into
continuedev:mainfrom
Onkar-Mane:mcp-variable-interpolation

Conversation

@Onkar-Mane

Copy link
Copy Markdown

Adds support for ${workspaceFolder}, ${workspaceFolderBasename}, ${userHome}, and ${env:VAR} in MCP server command/args/cwd/env, resolved once right before the stdio process is spawned.

Summary

  • New resolveMcpVariables utility (core/util/resolveMcpVariables.ts) recursively resolves the variables in strings/arrays/objects, leaving unknown variables and ${{ secrets.X }} untouched.
  • Wired into MCPConnection.constructStdioTransport, the single choke point for all stdio MCP servers regardless of config source (YAML or JSON).
  • Fixed resolveCwd's absolute-path check to use path.isAbsolute instead of a Unix-only charAt(0) === "/" check, needed for ${workspaceFolder}-derived Windows paths to be recognized correctly.
  • ${workspaceFolder} intentionally stays unresolved (rather than falling back to homedir) for remote workspaces, to avoid silently pointing configs at the wrong directory.

Test plan

  • core/util/resolveMcpVariables.test.ts - 18 unit tests
  • core/context/mcp/MCPConnection.vitest.ts - new wiring/integration tests
  • tsc --noEmit clean
  • Manually verified in the Extension Development Host with a .continue/mcpServers/*.yaml using ${workspaceFolder} in cwd/args/env

… config

Resolve ${workspaceFolder}, ${workspaceFolderBasename}, ${userHome}, and
${env:VAR} in command/args/cwd/env exactly once before a stdio MCP server
is spawned, so configs can reference the active workspace instead of
hardcoding absolute paths.
@Onkar-Mane
Onkar-Mane requested a review from a team as a code owner July 27, 2026 11:45
@Onkar-Mane
Onkar-Mane requested review from sestinj and removed request for a team July 27, 2026 11:45
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants