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
Summary Fixes#335006 .
${PLUGIN_ROOT} and ${PLUGIN_DATA} are not expanded.
Changes:
Token Expansion: Updated toPluginMcpServerDefinition in PluginMcpDiscovery to substitute ${PLUGIN_ROOT} with the plugin's source root URI and ${PLUGIN_DATA} with the plugin's storage path.
Lazy folder creation for the data directory. ( Right now, using globalStorageHome/agentPlugin/data/hash, not sure whats the convention, hash or should it be the agent-plugin name?)
Verification
Ran ./scripts/test.sh --run src/vs/workbench/contrib/mcp/test/common/pluginMcpDiscovery.test.ts successfully.
Manually verified that a canonical Agent Plugin 1.0 ($schema: https://agent-plugins.org/schemas/1.0.0/plugin.schema.json) with ${PLUGIN_ROOT} and ${PLUGIN_DATA} in mcp.json correctly expands variables.
Edit: Redid the manual test after all the copilot suggestion fixes.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
Remote path handling, profile switching, rejected folder creation, and reactive definition updates currently produce incorrect or stale MCP registrations.
Get a fresh assessment by requesting another Copilot review.
String.replaceAll interprets $&, $$, $\`` and $'in a string replacement. A valid plugin/data path containing one of those sequences is therefore corrupted when substituted (for example,/plugins/a$&bturns into/plugins/a${PLUGIN_ROOT}b`). Use a single-pass function replacer so filesystem paths are inserted literally and inserted token-like text is not processed again.
These paths are used as replacement strings, so JavaScript interprets replacement patterns such as $&, $\`` and $'; the second call can also re-expand token text inserted by the first. For example, a plugin directory ending in $&leaves${PLUGIN_ROOT}` in the launched argument. Replace both tokens in one callback-based pass so filesystem paths are inserted literally and never rescanned.
Plugin definition changes do not update the registry
This snapshots a file-backed observable and then exposes the result as a constant. mcpServerDefinitions is re-read when mcp.json changes, but the outer autorun only recreates an existing collection when dataDirKey changes. Therefore, editing a plugin from one non-empty definition list to another leaves the registry serving the old definitions; preserve a reactive definition pipeline or explicitly recreate the collection when the definitions change.
Placeholder expansion must be a single, non-recursive pass. These chained replacements rescan text inserted for PLUGIN_ROOT, so a valid root containing the literal ${PLUGIN_DATA} is incorrectly rewritten; replacement-string sequences such as $& in a legal filesystem path are also interpreted by replaceAll. Use one callback-based replacement so inserted path text stays literal.
This issue also appears on line 154 of the same file.
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
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.
Summary
Fixes #335006 .
${PLUGIN_ROOT} and ${PLUGIN_DATA} are not expanded.
Changes:
Token Expansion: Updated toPluginMcpServerDefinition in PluginMcpDiscovery to substitute ${PLUGIN_ROOT} with the plugin's source root URI and ${PLUGIN_DATA} with the plugin's storage path.
Lazy folder creation for the data directory. ( Right now, using globalStorageHome/agentPlugin/data/hash, not sure whats the convention, hash or should it be the agent-plugin name?)
Verification
Ran ./scripts/test.sh --run src/vs/workbench/contrib/mcp/test/common/pluginMcpDiscovery.test.ts successfully.
Manually verified that a canonical Agent Plugin 1.0 ($schema: https://agent-plugins.org/schemas/1.0.0/plugin.schema.json) with ${PLUGIN_ROOT} and ${PLUGIN_DATA} in mcp.json correctly expands variables.
Edit: Redid the manual test after all the copilot suggestion fixes.