| 189 | } |
| 190 | |
| 191 | func serverToMap(server Server) map[string]any { |
| 192 | out := map[string]any{} |
| 193 | if server.Type != "" { |
| 194 | out["type"] = server.Type |
| 195 | } |
| 196 | if server.URL != "" { |
| 197 | out["url"] = server.URL |
| 198 | } |
| 199 | if server.Command != "" { |
| 200 | out["command"] = server.Command |
| 201 | } |
| 202 | if len(server.Args) > 0 { |
| 203 | out["args"] = server.Args |
| 204 | } |
| 205 | if len(server.Env) > 0 { |
| 206 | out["env"] = server.Env |
| 207 | } |
| 208 | return out |
| 209 | } |
| 210 | |
| 211 | func mapToServer(name string, raw map[string]any) Server { |
| 212 | s := Server{Name: name} |