From 68f28444b7547b1167ba349a552cb1ebe6ecf127 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 20 Nov 2026 15:16:40 -0300 Subject: [PATCH 1/4] fix(connect): match the clientInfo names VS Code's Copilot paths send VS Code 1.147's Copilot agent host initializes with clientInfo.name "vscode-agent-host", and its Copilot CLI sessions with the agent host off send "vscode". Both read ~/.copilot/mcp-config.json, so they belong to the copilot client. The copilot row stayed connected_never_seen and the sessions showed up as an "other" row (or, for "vscode", under the VS Code client). Move "vscode" from the VS Code client to copilot and add "vscode-agent-host". The VS Code Local harness sends the product's long name, so the VS Code client also gains "Visual Studio Code - Insiders". Fixes #1959 --- internal/connect/clients.go | 14 ++++++--- internal/connect/copilot_client_test.go | 38 +++++++++++++++---------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/internal/connect/clients.go b/internal/connect/clients.go index f6b59416e..133387d9d 100644 --- a/internal/connect/clients.go +++ b/internal/connect/clients.go @@ -103,7 +103,10 @@ var allClients = []ClientDef{ ServerKey: "servers", Supported: true, Icon: "vscode", - ClientInfoNames: []string{"Visual Studio Code", "visual-studio-code", "vscode"}, + // The Local harness sends productService.nameLong (mcpServerRequestHandler.ts). + // "vscode" is not here: it is what Copilot CLI sessions inside VS Code send, + // and those read the Copilot config (see the "copilot" client below). + ClientInfoNames: []string{"Visual Studio Code", "Visual Studio Code - Insiders", "visual-studio-code"}, ReloadHint: "Run \"MCP: List Servers\" → Restart (or reload the window) in VS Code to load MCPProxy", }, { @@ -118,9 +121,12 @@ var allClients = []ClientDef{ // and not from Code/User/mcp.json. That file belongs to the older // Local harness, which the "vscode" client above still serves (#1896). // - // Presence is matched exactly against clientInfo.name: the Copilot CLI - // sends "copilot-cli", other Copilot hosts "github-copilot-developer". - ClientInfoNames: []string{"copilot-cli", "github-copilot-developer", "copilot"}, + // Presence is matched exactly against clientInfo.name, which the Copilot + // SDK sets from its host's clientName: VS Code's agent host sends + // "vscode-agent-host" (#1959), VS Code's Copilot CLI sessions with the + // agent host off send "vscode"; the Copilot CLI itself sends "copilot-cli" + // or "github-copilot-developer". + ClientInfoNames: []string{"copilot-cli", "vscode-agent-host", "vscode", "github-copilot-developer", "copilot"}, ReloadHint: "Reload the VS Code window (or restart Copilot CLI) to load MCPProxy", }, { diff --git a/internal/connect/copilot_client_test.go b/internal/connect/copilot_client_test.go index 538441abd..50fa15ea8 100644 --- a/internal/connect/copilot_client_test.go +++ b/internal/connect/copilot_client_test.go @@ -47,21 +47,29 @@ func TestConnectCopilotWritesTheCopilotUserConfig(t *testing.T) { } // Presence ("seen", calls in the last 24h) is matched exactly against the -// clientInfo.name of the MCP initialize request. The Copilot CLI sends -// "copilot-cli" and other Copilot hosts send "github-copilot-developer", so -// both have to be aliases of this client or it never shows as connected. -func TestCopilotClientInfoNamesMatchWhatCopilotSends(t *testing.T) { - def := FindClient("copilot") - if def == nil { - t.Fatal("copilot client is not registered") - } - have := make(map[string]bool, len(def.ClientInfoNames)) - for _, name := range def.ClientInfoNames { - have[name] = true - } - for _, want := range []string{"copilot-cli", "github-copilot-developer"} { - if !have[want] { - t.Errorf("ClientInfoNames = %v, missing %q", def.ClientInfoNames, want) +// clientInfo.name of the MCP initialize request, so each name a host sends has +// to be an alias of the client whose config that host reads (#1959). Copilot +// hosts read ~/.copilot/mcp-config.json: the Copilot CLI ("copilot-cli", +// "github-copilot-developer"), VS Code's agent host ("vscode-agent-host") and +// VS Code's Copilot CLI sessions with the agent host off ("vscode"). VS Code's +// Local harness reads Code/User/mcp.json and sends the product's long name. +func TestClientInfoNamesMatchWhatEachHostSends(t *testing.T) { + for id, wants := range map[string][]string{ + "copilot": {"copilot-cli", "github-copilot-developer", "vscode-agent-host", "vscode"}, + "vscode": {"Visual Studio Code", "Visual Studio Code - Insiders"}, + } { + def := FindClient(id) + if def == nil { + t.Fatalf("%s client is not registered", id) + } + have := make(map[string]bool, len(def.ClientInfoNames)) + for _, name := range def.ClientInfoNames { + have[name] = true + } + for _, want := range wants { + if !have[want] { + t.Errorf("%s: ClientInfoNames = %v, missing %q", id, def.ClientInfoNames, want) + } } } } From 1e23a59fc793688aa371526c597e5117007affa1 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 20 Nov 2026 15:20:11 -0300 Subject: [PATCH 2/4] chore(connect): trim client alias comments --- internal/connect/clients.go | 9 +-------- internal/connect/copilot_client_test.go | 8 +------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/internal/connect/clients.go b/internal/connect/clients.go index 133387d9d..8fa3e263f 100644 --- a/internal/connect/clients.go +++ b/internal/connect/clients.go @@ -103,9 +103,6 @@ var allClients = []ClientDef{ ServerKey: "servers", Supported: true, Icon: "vscode", - // The Local harness sends productService.nameLong (mcpServerRequestHandler.ts). - // "vscode" is not here: it is what Copilot CLI sessions inside VS Code send, - // and those read the Copilot config (see the "copilot" client below). ClientInfoNames: []string{"Visual Studio Code", "Visual Studio Code - Insiders", "visual-studio-code"}, ReloadHint: "Run \"MCP: List Servers\" → Restart (or reload the window) in VS Code to load MCPProxy", }, @@ -121,11 +118,7 @@ var allClients = []ClientDef{ // and not from Code/User/mcp.json. That file belongs to the older // Local harness, which the "vscode" client above still serves (#1896). // - // Presence is matched exactly against clientInfo.name, which the Copilot - // SDK sets from its host's clientName: VS Code's agent host sends - // "vscode-agent-host" (#1959), VS Code's Copilot CLI sessions with the - // agent host off send "vscode"; the Copilot CLI itself sends "copilot-cli" - // or "github-copilot-developer". + // VS Code sends "vscode-agent-host", or "vscode" with the agent host off. ClientInfoNames: []string{"copilot-cli", "vscode-agent-host", "vscode", "github-copilot-developer", "copilot"}, ReloadHint: "Reload the VS Code window (or restart Copilot CLI) to load MCPProxy", }, diff --git a/internal/connect/copilot_client_test.go b/internal/connect/copilot_client_test.go index 50fa15ea8..87afeb63c 100644 --- a/internal/connect/copilot_client_test.go +++ b/internal/connect/copilot_client_test.go @@ -46,13 +46,7 @@ func TestConnectCopilotWritesTheCopilotUserConfig(t *testing.T) { } } -// Presence ("seen", calls in the last 24h) is matched exactly against the -// clientInfo.name of the MCP initialize request, so each name a host sends has -// to be an alias of the client whose config that host reads (#1959). Copilot -// hosts read ~/.copilot/mcp-config.json: the Copilot CLI ("copilot-cli", -// "github-copilot-developer"), VS Code's agent host ("vscode-agent-host") and -// VS Code's Copilot CLI sessions with the agent host off ("vscode"). VS Code's -// Local harness reads Code/User/mcp.json and sends the product's long name. +// Each clientInfo.name a host sends must be an alias of the client whose config it reads (#1959). func TestClientInfoNamesMatchWhatEachHostSends(t *testing.T) { for id, wants := range map[string][]string{ "copilot": {"copilot-cli", "github-copilot-developer", "vscode-agent-host", "vscode"}, From c86b30d09b4ca83a3543626219eb196170751d26 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 20 Nov 2026 15:24:29 -0300 Subject: [PATCH 3/4] fix(connect): keep "vscode" on the VS Code client The clientName 'vscode' Copilot CLI sessions get their MCP servers through VS Code's MCP gateway, so nothing shows that name reaching MCPProxy with the Copilot credential. With the agent host off, VS Code falls back to the Local harness, which the VS Code client already matches. --- internal/connect/clients.go | 6 +++--- internal/connect/copilot_client_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/connect/clients.go b/internal/connect/clients.go index 8fa3e263f..4d65a6a34 100644 --- a/internal/connect/clients.go +++ b/internal/connect/clients.go @@ -103,7 +103,7 @@ var allClients = []ClientDef{ ServerKey: "servers", Supported: true, Icon: "vscode", - ClientInfoNames: []string{"Visual Studio Code", "Visual Studio Code - Insiders", "visual-studio-code"}, + ClientInfoNames: []string{"Visual Studio Code", "Visual Studio Code - Insiders", "visual-studio-code", "vscode"}, ReloadHint: "Run \"MCP: List Servers\" → Restart (or reload the window) in VS Code to load MCPProxy", }, { @@ -118,8 +118,8 @@ var allClients = []ClientDef{ // and not from Code/User/mcp.json. That file belongs to the older // Local harness, which the "vscode" client above still serves (#1896). // - // VS Code sends "vscode-agent-host", or "vscode" with the agent host off. - ClientInfoNames: []string{"copilot-cli", "vscode-agent-host", "vscode", "github-copilot-developer", "copilot"}, + // VS Code's agent host sends "vscode-agent-host" (#1959). + ClientInfoNames: []string{"copilot-cli", "vscode-agent-host", "github-copilot-developer", "copilot"}, ReloadHint: "Reload the VS Code window (or restart Copilot CLI) to load MCPProxy", }, { diff --git a/internal/connect/copilot_client_test.go b/internal/connect/copilot_client_test.go index 87afeb63c..917a4c00c 100644 --- a/internal/connect/copilot_client_test.go +++ b/internal/connect/copilot_client_test.go @@ -49,7 +49,7 @@ func TestConnectCopilotWritesTheCopilotUserConfig(t *testing.T) { // Each clientInfo.name a host sends must be an alias of the client whose config it reads (#1959). func TestClientInfoNamesMatchWhatEachHostSends(t *testing.T) { for id, wants := range map[string][]string{ - "copilot": {"copilot-cli", "github-copilot-developer", "vscode-agent-host", "vscode"}, + "copilot": {"copilot-cli", "github-copilot-developer", "vscode-agent-host"}, "vscode": {"Visual Studio Code", "Visual Studio Code - Insiders"}, } { def := FindClient(id) From 2badb788d61a6fcc298a02f50e8f132eac80d49c Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Fri, 20 Nov 2026 15:27:48 -0300 Subject: [PATCH 4/4] chore(connect): keep the existing alias comments and test --- internal/connect/clients.go | 4 ++- internal/connect/copilot_client_test.go | 35 ++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/internal/connect/clients.go b/internal/connect/clients.go index 4d65a6a34..99d82f7e6 100644 --- a/internal/connect/clients.go +++ b/internal/connect/clients.go @@ -118,7 +118,9 @@ var allClients = []ClientDef{ // and not from Code/User/mcp.json. That file belongs to the older // Local harness, which the "vscode" client above still serves (#1896). // - // VS Code's agent host sends "vscode-agent-host" (#1959). + // Presence is matched exactly against clientInfo.name: the Copilot CLI + // sends "copilot-cli", VS Code's agent host "vscode-agent-host" (#1959), + // other Copilot hosts "github-copilot-developer". ClientInfoNames: []string{"copilot-cli", "vscode-agent-host", "github-copilot-developer", "copilot"}, ReloadHint: "Reload the VS Code window (or restart Copilot CLI) to load MCPProxy", }, diff --git a/internal/connect/copilot_client_test.go b/internal/connect/copilot_client_test.go index 917a4c00c..fefb0e775 100644 --- a/internal/connect/copilot_client_test.go +++ b/internal/connect/copilot_client_test.go @@ -46,24 +46,23 @@ func TestConnectCopilotWritesTheCopilotUserConfig(t *testing.T) { } } -// Each clientInfo.name a host sends must be an alias of the client whose config it reads (#1959). -func TestClientInfoNamesMatchWhatEachHostSends(t *testing.T) { - for id, wants := range map[string][]string{ - "copilot": {"copilot-cli", "github-copilot-developer", "vscode-agent-host"}, - "vscode": {"Visual Studio Code", "Visual Studio Code - Insiders"}, - } { - def := FindClient(id) - if def == nil { - t.Fatalf("%s client is not registered", id) - } - have := make(map[string]bool, len(def.ClientInfoNames)) - for _, name := range def.ClientInfoNames { - have[name] = true - } - for _, want := range wants { - if !have[want] { - t.Errorf("%s: ClientInfoNames = %v, missing %q", id, def.ClientInfoNames, want) - } +// Presence ("seen", calls in the last 24h) is matched exactly against the +// clientInfo.name of the MCP initialize request. The Copilot CLI sends +// "copilot-cli", VS Code's agent host "vscode-agent-host" (#1959) and other +// Copilot hosts send "github-copilot-developer", so all of them have to be +// aliases of this client or it never shows as connected. +func TestCopilotClientInfoNamesMatchWhatCopilotSends(t *testing.T) { + def := FindClient("copilot") + if def == nil { + t.Fatal("copilot client is not registered") + } + have := make(map[string]bool, len(def.ClientInfoNames)) + for _, name := range def.ClientInfoNames { + have[name] = true + } + for _, want := range []string{"copilot-cli", "vscode-agent-host", "github-copilot-developer"} { + if !have[want] { + t.Errorf("ClientInfoNames = %v, missing %q", def.ClientInfoNames, want) } } }