Skip to content

Commit f780345

Browse files
Merge pull request #146 from docker/slim/list-versus-ls
list versus ls update docs for using oss mcp community registry
2 parents ea7355e + f85a4b1 commit f780345

36 files changed

+237
-229
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ docker mcp catalog ls
8484
docker mcp catalog show docker-mcp
8585
```
8686

87-
More about [the MCP Catalog](docs/catalog.md).
87+
* more about [the MCP Catalog](docs/catalog.md).
88+
* more about [importing from the OSS MCP Community Registry](docs/catalog.md#importing-from-the-oss-mcp-community-registry).
8889

8990
### MCP Gateway Operations
9091

@@ -106,7 +107,7 @@ Enable and disable the set of MCP servers that will be available for default cli
106107

107108
```bash
108109
# List enabled servers
109-
docker mcp server list
110+
docker mcp server ls
110111

111112
# Enable one or more servers
112113
docker mcp server enable <server-name> [server-name...]
@@ -166,10 +167,10 @@ docker mcp --help
166167
docker mcp tools count
167168

168169
# List all available MCP tools
169-
docker mcp tools list
170+
docker mcp tools ls
170171

171172
# List all available MCP tools in JSON format
172-
docker mcp tools list --format=json
173+
docker mcp tools ls --format=json
173174

174175
# Inspect a specific tool
175176
docker mcp tools inspect <tool-name>

cmd/docker-mcp/catalog/ls.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/docker/mcp-gateway/cmd/docker-mcp/internal/telemetry"
1010
)
1111

12-
func Ls(ctx context.Context, outputJSON bool) error {
12+
func Ls(ctx context.Context, format Format) error {
1313
// Initialize telemetry
1414
telemetry.Init()
1515

@@ -25,7 +25,7 @@ func Ls(ctx context.Context, outputJSON bool) error {
2525
// Record successful operation
2626
telemetry.RecordCatalogOperation(ctx, "ls", "all", float64(duration.Milliseconds()), true)
2727

28-
if outputJSON {
28+
if format == JSON {
2929
data, err := json.Marshal(cfg)
3030
if err != nil {
3131
return err

cmd/docker-mcp/commands/catalog.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ command will import servers from the MCP registry URL into that catalog.`,
5858
// If mcp-registry flag is provided, import to existing catalog
5959
if mcpRegistry != "" {
6060
if dryRun {
61-
return runOfficialregistryImport(cmd.Context(), mcpRegistry, nil)
61+
return runMcpregistryImport(cmd.Context(), mcpRegistry, nil)
6262
}
6363
return importMCPRegistryToCatalog(cmd.Context(), args[0], mcpRegistry)
6464
}
@@ -87,7 +87,7 @@ cannot be exported as it is managed by Docker.`,
8787

8888
func lsCatalogCommand() *cobra.Command {
8989
var opts struct {
90-
JSON bool
90+
Format catalog.Format
9191
}
9292
cmd := &cobra.Command{
9393
Use: "ls",
@@ -96,15 +96,15 @@ func lsCatalogCommand() *cobra.Command {
9696
Args: cobra.NoArgs,
9797
Example: ` # List all catalogs
9898
docker mcp catalog ls
99-
99+
100100
# List catalogs in JSON format
101-
docker mcp catalog ls --json`,
101+
docker mcp catalog ls --format=json`,
102102
RunE: func(cmd *cobra.Command, _ []string) error {
103-
return catalog.Ls(cmd.Context(), opts.JSON)
103+
return catalog.Ls(cmd.Context(), opts.Format)
104104
},
105105
}
106106
flags := cmd.Flags()
107-
flags.BoolVar(&opts.JSON, "json", false, "Print as JSON.")
107+
flags.Var(&opts.Format, "format", fmt.Sprintf("Output format. Supported: %s.", catalog.SupportedFormats()))
108108
return cmd
109109
}
110110

@@ -281,7 +281,7 @@ func importMCPRegistryToCatalog(ctx context.Context, catalogName, mcpRegistryURL
281281

282282
// Fetch server from MCP registry
283283
var servers []catalogTypes.Server
284-
if err := runOfficialregistryImport(ctx, mcpRegistryURL, &servers); err != nil {
284+
if err := runMcpregistryImport(ctx, mcpRegistryURL, &servers); err != nil {
285285
return fmt.Errorf("failed to fetch server from MCP registry: %w", err)
286286
}
287287

cmd/docker-mcp/commands/feature.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ func featureDisableCommand(dockerCli command.Cli) *cobra.Command {
118118
// featureListCommand creates the `feature list` command
119119
func featureListCommand(dockerCli command.Cli) *cobra.Command {
120120
return &cobra.Command{
121-
Use: "list",
122-
Short: "List all available features and their status",
123-
Long: "List all available experimental features and show whether they are enabled or disabled.",
121+
Use: "ls",
122+
Aliases: []string{"list"},
123+
Short: "List all available features and their status",
124+
Long: "List all available experimental features and show whether they are enabled or disabled.",
124125
RunE: func(_ *cobra.Command, _ []string) error {
125126
configFile := dockerCli.ConfigFile()
126127

cmd/docker-mcp/commands/gateway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func gatewayCommand(docker docker.Client, dockerCli command.Cli) *cobra.Command
110110
if len(mcpRegistryUrls) > 0 {
111111
var mcpServers []catalogTypes.Server
112112
for _, registryURL := range mcpRegistryUrls {
113-
if err := runOfficialregistryImport(cmd.Context(), registryURL, &mcpServers); err != nil {
113+
if err := runMcpregistryImport(cmd.Context(), registryURL, &mcpServers); err != nil {
114114
return fmt.Errorf("failed to fetch server from MCP registry %s: %w", registryURL, err)
115115
}
116116
}

cmd/docker-mcp/commands/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/docker/mcp-gateway/cmd/docker-mcp/internal/oci"
1212
)
1313

14-
func runOfficialregistryImport(ctx context.Context, serverURL string, servers *[]catalog.Server) error {
14+
func runMcpregistryImport(ctx context.Context, serverURL string, servers *[]catalog.Server) error {
1515
// Validate URL
1616
parsedURL, err := url.Parse(serverURL)
1717
if err != nil {

cmd/docker-mcp/commands/officialregistry_test.go renamed to cmd/docker-mcp/commands/mcpregistry_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88
)
99

10-
func TestOfficialregistryImportCommand(t *testing.T) {
10+
func TestMcpregistryImportCommand(t *testing.T) {
1111
// Test server that serves the Garmin MCP example JSON
1212
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1313
if r.Method != http.MethodGet {
@@ -69,43 +69,43 @@ func TestOfficialregistryImportCommand(t *testing.T) {
6969

7070
// Test the import function
7171
ctx := context.Background()
72-
err := runOfficialregistryImport(ctx, testServer.URL, nil)
72+
err := runMcpregistryImport(ctx, testServer.URL, nil)
7373
if err != nil {
7474
t.Errorf("Expected no error, got: %v", err)
7575
}
7676
}
7777

78-
func TestOfficialregistryImportCommand_InvalidURL(t *testing.T) {
78+
func TestMcpregistryImportCommand_InvalidURL(t *testing.T) {
7979
ctx := context.Background()
8080

8181
// Test invalid URL
82-
err := runOfficialregistryImport(ctx, "not-a-url", nil)
82+
err := runMcpregistryImport(ctx, "not-a-url", nil)
8383
if err == nil {
8484
t.Error("Expected error for invalid URL, got none")
8585
}
8686

8787
// Test unsupported scheme
88-
err = runOfficialregistryImport(ctx, "ftp://example.com", nil)
88+
err = runMcpregistryImport(ctx, "ftp://example.com", nil)
8989
if err == nil {
9090
t.Error("Expected error for unsupported scheme, got none")
9191
}
9292
}
9393

94-
func TestOfficialregistryImportCommand_HTTPError(t *testing.T) {
94+
func TestMcpregistryImportCommand_HTTPError(t *testing.T) {
9595
// Test server that returns 404
9696
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
9797
w.WriteHeader(http.StatusNotFound)
9898
}))
9999
defer testServer.Close()
100100

101101
ctx := context.Background()
102-
err := runOfficialregistryImport(ctx, testServer.URL, nil)
102+
err := runMcpregistryImport(ctx, testServer.URL, nil)
103103
if err == nil {
104104
t.Error("Expected error for 404 response, got none")
105105
}
106106
}
107107

108-
func TestOfficialregistryImportCommand_InvalidJSON(t *testing.T) {
108+
func TestMcpregistryImportCommand_InvalidJSON(t *testing.T) {
109109
// Test server that returns invalid JSON
110110
testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
111111
w.Header().Set("Content-Type", "application/json")
@@ -118,7 +118,7 @@ func TestOfficialregistryImportCommand_InvalidJSON(t *testing.T) {
118118
defer testServer.Close()
119119

120120
ctx := context.Background()
121-
err := runOfficialregistryImport(ctx, testServer.URL, nil)
121+
err := runMcpregistryImport(ctx, testServer.URL, nil)
122122
if err == nil {
123123
t.Error("Expected error for invalid JSON, got none")
124124
}

cmd/docker-mcp/commands/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ func serverCommand(docker docker.Client) *cobra.Command {
2121

2222
var outputJSON bool
2323
lsCommand := &cobra.Command{
24-
Use: "list",
25-
Aliases: []string{"ls"},
24+
Use: "ls",
25+
Aliases: []string{"list"},
2626
Short: "List enabled servers",
2727
Args: cobra.NoArgs,
2828
RunE: func(cmd *cobra.Command, _ []string) error {

cmd/docker-mcp/commands/tools.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ func toolsCommand(docker docker.Client) *cobra.Command {
2525
cmd.PersistentFlags().StringSliceVar(&gatewayArgs, "gateway-arg", nil, "Additional arguments passed to the gateway")
2626

2727
cmd.AddCommand(&cobra.Command{
28-
Use: "list",
29-
Aliases: []string{"ls"},
28+
Use: "ls",
29+
Aliases: []string{"list"},
3030
Short: "List tools",
3131
Args: cobra.NoArgs,
3232
RunE: func(cmd *cobra.Command, _ []string) error {

cmd/docker-mcp/internal/gateway/dynamic_mcps.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,16 @@ func (g *Gateway) createMcpRemoveTool(_ Configuration, clientConfig *clientConfi
363363
}
364364
}
365365

366-
// mcpOfficialRegistryImportTool implements a tool for importing servers from official registry URLs
367-
func (g *Gateway) createMcpOfficialRegistryImportTool(configuration Configuration, _ *clientConfig) *ToolRegistration {
366+
func (g *Gateway) createMcpRegistryImportTool(configuration Configuration, _ *clientConfig) *ToolRegistration {
368367
tool := &mcp.Tool{
369-
Name: "mcp-official-registry-import",
370-
Description: "Import MCP servers from an official registry URL. Fetches server definitions via HTTP GET and adds them to the local catalog.",
368+
Name: "mcp-registry-import",
369+
Description: "Import MCP servers from an MCP registry URL. Fetches server definitions via HTTP GET and adds them to the local catalog.",
371370
InputSchema: &jsonschema.Schema{
372371
Type: "object",
373372
Properties: map[string]*jsonschema.Schema{
374373
"url": {
375374
Type: "string",
376-
Description: "URL to fetch the official registry JSON from (must be a valid HTTP/HTTPS URL)",
375+
Description: "URL to fetch the server details JSON (must be a valid HTTP/HTTPS URL)",
377376
},
378377
},
379378
Required: []string{"url"},

0 commit comments

Comments
 (0)