fix(mcp): read .claude.json + mcp_servers.json, handle type/transport + array commands

This commit is contained in:
2026-05-23 11:41:57 +01:00
parent 9633f9ad4c
commit 8f5200a7f2
6 changed files with 186 additions and 68 deletions
+21 -12
View File
@@ -32,20 +32,29 @@ func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
e := map[string]any{}
switch style {
case MCPClaudeStyle:
if s.Command != "" {
e["command"] = s.Command
}
if len(s.Args) > 0 {
e["args"] = s.Args
}
// Claude Code's actual entry shape uses "type" (not "transport").
// Default to stdio when no URL is set.
t := s.Transport
if s.URL != "" {
if t == "" {
t = "http"
}
e["type"] = t
e["url"] = s.URL
}
if s.Transport != "" {
e["transport"] = s.Transport
}
if len(s.Env) > 0 {
e["env"] = s.Env
} else {
if t == "" {
t = "stdio"
}
e["type"] = t
if s.Command != "" {
e["command"] = s.Command
}
if len(s.Args) > 0 {
e["args"] = s.Args
}
if len(s.Env) > 0 {
e["env"] = s.Env
}
}
case MCPCrushStyle:
if s.URL != "" {