MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / mcpListCommand

Method mcpListCommand

internal/cli/mcp.go:34–67  ·  view source on GitHub ↗

`cam mcp list` lists local installs grouped by client. When --client is given, only that client is shown.

(state *globalState)

Source from the content-addressed store, hash-verified

32// `cam mcp list` lists local installs grouped by client. When --client is
33// given, only that client is shown.
34func (a *App) mcpListCommand(state *globalState) *cobra.Command {
35 var clientName string
36 cmd := &cobra.Command{
37 Use: "list",
38 Short: "List installed MCP servers",
39 Args: cobra.NoArgs,
40 RunE: func(cmd *cobra.Command, args []string) error {
41 out := cmd.OutOrStdout()
42 clients := clientsForList(clientName)
43 any := false
44 for _, c := range clients {
45 servers, _, err := mcp.ListServers(c, mcp.UserScope)
46 if err != nil {
47 fmt.Fprintf(cmd.ErrOrStderr(), " warning: %s: %v\n", c.Name, err)
48 continue
49 }
50 if len(servers) == 0 {
51 continue
52 }
53 any = true
54 fmt.Fprintf(out, "%s:\n", c.Name)
55 for _, s := range servers {
56 fmt.Fprintf(out, " %s\t%s\t%s\n", s.Name, s.Command, strings.Join(s.Args, " "))
57 }
58 }
59 if !any {
60 fmt.Fprintln(out, "No MCP servers installed")
61 }
62 return nil
63 },
64 }
65 cmd.Flags().StringVarP(&clientName, "client", "c", "", "Limit to a single client")
66 return cmd
67}
68
69// `cam mcp search QUERY` searches the bundled registry AND GitHub for MCP
70// servers matching a keyword — combining local and online sources.

Callers 1

mcpCommandMethod · 0.95

Calls 2

ListServersFunction · 0.92
clientsForListFunction · 0.85

Tested by

no test coverage detected