Skip to content
Closed
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
14 changes: 10 additions & 4 deletions internal/connect/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
{
Expand All @@ -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",
},
{
Expand Down
38 changes: 23 additions & 15 deletions internal/connect/copilot_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}
Expand Down