Skip to content

Comments

fix: MCP Install in a remote dev env#146

Merged
owenrumney merged 3 commits intomasterfrom
fix/support-remote-mcp-install
Dec 3, 2025
Merged

fix: MCP Install in a remote dev env#146
owenrumney merged 3 commits intomasterfrom
fix/support-remote-mcp-install

Conversation

@owenrumney
Copy link
Contributor

When installing the Trivy MCP server using the extension, the plugin is
correctly installed in the remote environment, but the MCP Server
configuration was being written to the host. This checks whether
operating in a remote window and writes to the correct config

Closes #145

When installing the Trivy MCP server using the extension, the plugin is
correctly installed in the remote environment, but the MCP Server
configuration was being written to the host. This checks whether
operating in a remote window and writes to the correct config
@owenrumney owenrumney self-assigned this Dec 3, 2025
@owenrumney owenrumney marked this pull request as ready for review December 3, 2025 11:22
Copilot AI review requested due to automatic review settings December 3, 2025 11:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes MCP (Model Context Protocol) server configuration in remote development environments. Previously, when using the extension in a remote environment (e.g., Remote-SSH, Dev Containers), the MCP plugin would install correctly in the remote environment, but the configuration was being written to the host machine instead of the remote workspace.

Key Changes:

  • Detects remote environments using vscode.env.remoteName and writes configuration to the appropriate location (workspace for remote, global for local)
  • Refactors configuration approach from using VS Code's configuration API to direct JSON file manipulation
  • Makes the MCP menu always visible to allow installation even when not yet configured

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/mcp/install.ts Adds remote environment detection, switches from configuration API to direct JSON file manipulation for MCP settings, and updates both chat config and MCP server config to use the appropriate target (workspace vs global)
package.json Bumps version to 1.8.10 and removes trivy.mcpServerInstalled condition from MCP submenu visibility to allow installation from menu
CHANGELOG.md Documents the remote development environment configuration fix in version 1.8.10

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

await vscode.commands.executeCommand(openCommand);

// Wait for the editor to open
await new Promise((resolve) => setTimeout(resolve, 100));
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded 100ms timeout may not be sufficient for the editor to open, especially on slower systems or under heavy load. Consider using a more robust approach such as:

  • Polling with vscode.window.onDidChangeActiveTextEditor event listener
  • Using a longer timeout with retry logic
  • Or better yet, using the return value from executeCommand if the command provides it

This timing-based approach could lead to intermittent failures where the configuration file is not properly updated.

Copilot uses AI. Check for mistakes.
owenrumney and others added 2 commits December 3, 2025 11:27
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@owenrumney owenrumney merged commit ee632f7 into master Dec 3, 2025
3 checks passed
@owenrumney owenrumney deleted the fix/support-remote-mcp-install branch December 3, 2025 11:35
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.

Trivy Install MCP installs to wrong target when using WSL via Remote

1 participant