`cam mcp server ` queries the bundled registry.
()
| 239 | |
| 240 | // `cam mcp server <list|search|show>` queries the bundled registry. |
| 241 | func (a *App) mcpServerCommand() *cobra.Command { |
| 242 | cmd := &cobra.Command{Use: "server", Short: "Browse the bundled MCP registry"} |
| 243 | cmd.AddCommand(&cobra.Command{ |
| 244 | Use: "list", |
| 245 | Short: "List bundled servers", |
| 246 | Args: cobra.NoArgs, |
| 247 | RunE: func(cmd *cobra.Command, args []string) error { |
| 248 | r, err := mcp.LoadBundledRegistry() |
| 249 | if err != nil { |
| 250 | return err |
| 251 | } |
| 252 | for _, name := range r.Names() { |
| 253 | s, _ := r.Get(name) |
| 254 | display := s.DisplayName |
| 255 | if display == "" { |
| 256 | display = s.Name |
| 257 | } |
| 258 | fmt.Fprintf(cmd.OutOrStdout(), "%-40s %s\n", s.Name, display) |
| 259 | } |
| 260 | return nil |
| 261 | }, |
| 262 | }) |
| 263 | cmd.AddCommand(&cobra.Command{ |
| 264 | Use: "search QUERY", |
| 265 | Short: "Search bundled servers", |
| 266 | Args: cobra.ExactArgs(1), |
| 267 | RunE: func(cmd *cobra.Command, args []string) error { |
| 268 | r, err := mcp.LoadBundledRegistry() |
| 269 | if err != nil { |
| 270 | return err |
| 271 | } |
| 272 | matches := r.Search(args[0]) |
| 273 | for _, s := range matches { |
| 274 | fmt.Fprintf(cmd.OutOrStdout(), "%-40s %s\n", s.Name, s.Description) |
| 275 | } |
| 276 | if len(matches) == 0 { |
| 277 | fmt.Fprintf(cmd.OutOrStdout(), "No matches for %q\n", args[0]) |
| 278 | } |
| 279 | return nil |
| 280 | }, |
| 281 | }) |
| 282 | cmd.AddCommand(&cobra.Command{ |
| 283 | Use: "show NAME", |
| 284 | Short: "Show bundled server schema", |
| 285 | Args: cobra.ExactArgs(1), |
| 286 | RunE: func(cmd *cobra.Command, args []string) error { |
| 287 | r, err := mcp.LoadBundledRegistry() |
| 288 | if err != nil { |
| 289 | return err |
| 290 | } |
| 291 | s, ok := r.Get(args[0]) |
| 292 | if !ok { |
| 293 | return fmt.Errorf("server not found: %s", args[0]) |
| 294 | } |
| 295 | b, _ := json.MarshalIndent(s, "", " ") |
| 296 | fmt.Fprintln(cmd.OutOrStdout(), string(b)) |
| 297 | return nil |
| 298 | }, |
no test coverage detected