From 73313213e105a8ff03b798b641b7ef2d505520f3 Mon Sep 17 00:00:00 2001 From: Colby McHenry Date: Thu, 23 Jul 2026 21:23:35 -0500 Subject: [PATCH] fix(installer): warn that copilot-vscode global installs need an open folder VS Code refuses to start a user-level MCP server whose entry uses ${workspaceFolder} in a window with no folder open, surfacing only a cryptic "Variable workspaceFolder can not be resolved" toast (hit live during validation). Global installs now note this up front. Co-Authored-By: Claude Fable 5 --- __tests__/installer-targets.test.ts | 10 ++++++++++ src/installer/targets/copilot-vscode.ts | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/__tests__/installer-targets.test.ts b/__tests__/installer-targets.test.ts index 2e8f70a..3ee37c7 100644 --- a/__tests__/installer-targets.test.ts +++ b/__tests__/installer-targets.test.ts @@ -2095,6 +2095,16 @@ describe('Installer targets — Copilot family', () => { expect(result.notes?.join(' ')).toMatch(/[Rr]estart VS Code/); }); + it('copilot-vscode: global install warns that ${workspaceFolder} needs an open folder; local does not', () => { + const t = getTarget('copilot-vscode')!; + // VS Code refuses to start a user-level server whose entry uses + // ${workspaceFolder} when no folder is open — surface that up front. + const globalNotes = t.install('global', { autoAllow: true }).notes?.join(' '); + expect(globalNotes).toMatch(/open a folder/i); + const localNotes = t.install('local', { autoAllow: true }).notes?.join(' '); + expect(localNotes).not.toMatch(/open a folder/i); + }); + // ---- copilot-cli ---- it('copilot-cli: global install writes ~/.copilot/mcp-config.json with the documented entry shape (tools: ["*"])', () => { diff --git a/src/installer/targets/copilot-vscode.ts b/src/installer/targets/copilot-vscode.ts index ee8e762..985aced 100644 --- a/src/installer/targets/copilot-vscode.ts +++ b/src/installer/targets/copilot-vscode.ts @@ -127,9 +127,16 @@ class CopilotVscodeTarget implements AgentTarget { } install(loc: Location, _opts: InstallOptions): WriteResult { + const notes = ['Restart VS Code for MCP changes to take effect.']; + if (loc === 'global') { + // The global entry pins --path via ${workspaceFolder}; VS Code + // refuses to start it in a window with no folder open, with a + // cryptic "Variable workspaceFolder can not be resolved" toast. + notes.push('VS Code: the server starts per-workspace — open a folder (File → Open Folder) before starting it; a no-folder window reports "Variable workspaceFolder can not be resolved".'); + } return { files: [writeMcpEntry(loc)], - notes: ['Restart VS Code for MCP changes to take effect.'], + notes, }; }