Skip to content

Add Visual Studio Code as MCP Client #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/extension/ui/src/MCPClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ClaudeDesktop from "./mcp-clients/ClaudeDesktop";
import ContinueDotDev from "./mcp-clients/ContinueDotDev";
import Cursor from "./mcp-clients/Cursor";
import Gordon from "./mcp-clients/Gordon";
import VSCode from "./mcp-clients/VSCode";
import { MCPClient } from "./types/mcp";

export type MCPClientState = {
Expand Down Expand Up @@ -31,6 +32,9 @@ export const getMCPClientStates = async (ddClient: v1.DockerDesktopClient) => {
if (fromCLI["continue"]) {
mcpClientStates[ContinueDotDev.name] = toState(ContinueDotDev, fromCLI["continue"]);
}
if (fromCLI["vscode"]) {
mcpClientStates[VSCode.name] = toState(VSCode, fromCLI["vscode"]);
}
}
} catch (e) {
ddClient.desktopUI.toast.error("Unable to connect Claude Desktop");
Expand Down
39 changes: 39 additions & 0 deletions src/extension/ui/src/mcp-clients/VSCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { v1 } from "@docker/extension-api-client-types";
import { MCPClient, SAMPLE_MCP_CONFIG } from "./MCPTypes";

class VSCodeClient implements MCPClient {
name = "Visual Studio Code";
url = "https://code.visualstudio.com/download";
manualConfigSteps = [
"Open <strong>VS Code Settings</strong> (File > Preferences > Settings or Ctrl+,)",
"Click on <strong>Open Settings (JSON)</strong> in the top right corner",
"Add MCP configuration to the <code>settings.json</code> file:",
'<pre style="font-family: monospace; overflow: auto; width: 80%; background-color: grey.200; padding: 1; border-radius: 1; font-size: 12px;">' +
JSON.stringify({
"mcp.servers": SAMPLE_MCP_CONFIG.mcpServers
}, null, 2) +
"</pre>",
"Save the settings file and restart VS Code if necessary"
];
expectedConfigPath = {
darwin: "$HOME/Library/Application Support/Code/User/settings.json",
linux: "$HOME/.config/Code/User/settings.json",
win32: "$APPDATA\\Code\\User\\settings.json",
};
connect = async (client: v1.DockerDesktopClient) => {
try {
await client.extension.host?.cli.exec("host-binary", ["client", "connect", "--global", "vscode"]);
} catch (e) {
client.desktopUI.toast.error("Unable to connect Visual Studio Code");
}
};
disconnect = async (client: v1.DockerDesktopClient) => {
try {
await client.extension.host?.cli.exec("host-binary", ["client", "disconnect", "--global", "vscode"]);
} catch (e) {
client.desktopUI.toast.error("Unable to disconnect Visual Studio Code");
}
};
}

export default new VSCodeClient();