fix(mcp): resolve env vars in agent plugin MCP server definitions#303156
Open
ConsoleTVs wants to merge 5 commits intomicrosoft:mainfrom
Open
fix(mcp): resolve env vars in agent plugin MCP server definitions#303156ConsoleTVs wants to merge 5 commits intomicrosoft:mainfrom
ConsoleTVs wants to merge 5 commits intomicrosoft:mainfrom
Conversation
Agent plugin MCP servers did not resolve environment variable references
because the resolution pipeline was skipped entirely (no variableReplacement
was set) and the MCP-standard bare ${VAR} syntax is not recognized by
VS Code's configuration resolver.
- Add variableReplacement to plugin server definitions so the resolution
pipeline runs
- Convert bare ${VAR} references to ${env:VAR} at the plugin boundary
so the resolver can look them up in process.env
Fixes microsoft#302579
connor4312
reviewed
Mar 19, 2026
src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.ts
Outdated
Show resolved
Hide resolved
Replace manual field-by-field cloning with the existing cloneAndChange
utility for a simpler, type-agnostic deep walk that converts bare
${VAR} references to ${env:VAR} in any string value.
…or upstream uri property
cloneAndChange deep-clones objects into plain {} via for...in, which
destroys URI prototype methods. Guard with URI.isUri() to return URI
values unchanged. Also add required uri property to all test definitions
after upstream added IAgentPluginMcpServerDefinition.uri.
auto-merge was automatically disabled
March 19, 2026 22:22
Head branch was pushed to by a user without write access
Author
|
@connor4312 Looks like upstream merged some changes that caused type issues. I have made some quick modifications and tested locally that types work. Let's try again :) |
vijayupadya
approved these changes
Mar 19, 2026
connor4312
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Agent plugin MCP servers did not resolve environment variable references because the resolution pipeline was skipped entirely (no variableReplacement was set) and the MCP-standard bare ${VAR} syntax is not recognized by VS Code's configuration resolver.
Fixes #302579