Skip to content

Commit 94b4ea8

Browse files
authored
"Default" profile support for connected clients. (#273)
1 parent 3c51ecc commit 94b4ea8

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

pkg/client/config.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,20 +196,27 @@ func FindClientsByProfile(ctx context.Context, profileID string) map[string]any
196196
continue
197197
}
198198
clientCfg := processor.ParseConfig()
199-
if clientCfg.WorkingSet == profileID {
199+
if matchesProfile(clientCfg, profileID) {
200200
clients[vendor] = clientCfg
201201
}
202202
}
203203

204204
gordonCfg := GetGordonSetup(ctx)
205-
if gordonCfg.WorkingSet == profileID {
205+
if matchesProfile(gordonCfg, profileID) {
206206
clients[VendorGordon] = gordonCfg
207207
}
208208

209209
codexCfg := GetCodexSetup(ctx)
210-
if codexCfg.WorkingSet == profileID {
210+
if matchesProfile(codexCfg, profileID) {
211211
clients[VendorCodex] = codexCfg
212212
}
213213

214214
return clients
215215
}
216+
217+
func matchesProfile(cfg MCPClientCfg, profileID string) bool {
218+
if cfg.IsMCPCatalogConnected && profileID == "default" && cfg.WorkingSet == "" {
219+
return true
220+
}
221+
return cfg.WorkingSet == profileID
222+
}

pkg/client/config_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,18 @@ func TestFindClientsByProfile(t *testing.T) {
318318
},
319319
expectedVendors: []string{},
320320
},
321+
{
322+
name: "find clients with default profile",
323+
profileID: "default",
324+
mockConfigs: map[string][]byte{
325+
vendorCursor: readTestData(t, "find-profiles/cursor-with-profile.json"),
326+
vendorClaudeDesktop: readTestData(t, "find-profiles/claude-desktop-with-profile.json"),
327+
vendorZed: readTestData(t, "find-profiles/zed-without-profile.json"),
328+
vendorKiro: readTestData(t, "find-profiles/kiro-without-profile.json"),
329+
vendorContinueDev: readTestData(t, "find-profiles/continue-without-profile.yml"),
330+
},
331+
expectedVendors: []string{vendorZed, vendorKiro, vendorContinueDev},
332+
},
321333
{
322334
name: "finds clients without profile when searching for empty string",
323335
profileID: "",
@@ -377,6 +389,10 @@ func TestFindClientsByProfile(t *testing.T) {
377389
}
378390
clientCfg.setParseResult(lists, nil)
379391

392+
if matchesProfile(clientCfg, tc.profileID) {
393+
clientCfg.WorkingSet = tc.profileID // Overwrite if matching
394+
}
395+
380396
shouldMatch := expectedMap[vendor]
381397

382398
if shouldMatch {

0 commit comments

Comments
 (0)