Skip to content

Commit bea02ff

Browse files
remove the term OfficialRegistry from tests
1 parent f5ce5c7 commit bea02ff

File tree

13 files changed

+27
-28
lines changed

13 files changed

+27
-28
lines changed

cmd/docker-mcp/commands/catalog.go

Lines changed: 2 additions & 2 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
}
@@ -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/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/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"},

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,10 @@ func (g *Gateway) reloadConfiguration(ctx context.Context, configuration Configu
332332
g.mcpServer.AddTool(mcpRemoveTool.Tool, mcpRemoveTool.Handler)
333333
g.registeredToolNames = append(g.registeredToolNames, mcpRemoveTool.Tool.Name)
334334

335-
// Add mcp-official-registry-import tool
336-
mcpOfficialRegistryImportTool := g.createMcpOfficialRegistryImportTool(configuration, clientConfig)
337-
g.mcpServer.AddTool(mcpOfficialRegistryImportTool.Tool, mcpOfficialRegistryImportTool.Handler)
338-
g.registeredToolNames = append(g.registeredToolNames, mcpOfficialRegistryImportTool.Tool.Name)
335+
// Add mcp-registry-import tool
336+
mcpRegistryImportTool := g.createMcpRegistryImportTool(configuration, clientConfig)
337+
g.mcpServer.AddTool(mcpRegistryImportTool.Tool, mcpRegistryImportTool.Handler)
338+
g.registeredToolNames = append(g.registeredToolNames, mcpRegistryImportTool.Tool.Name)
339339

340340
// Add mcp-config-set tool
341341
mcpConfigSetTool := g.createMcpConfigSetTool(configuration, clientConfig)
@@ -345,7 +345,7 @@ func (g *Gateway) reloadConfiguration(ctx context.Context, configuration Configu
345345
log(" > mcp-find: tool for finding MCP servers in the catalog")
346346
log(" > mcp-add: tool for adding MCP servers to the registry")
347347
log(" > mcp-remove: tool for removing MCP servers from the registry")
348-
log(" > mcp-official-registry-import: tool for importing servers from official registry URLs")
348+
log(" > mcp-registry-import: tool for importing servers from MCP registry URLs")
349349
log(" > mcp-config-set: tool for setting configuration values for MCP servers")
350350
}
351351

cmd/docker-mcp/internal/oci/types_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func TestServerDetailParsing(t *testing.T) {
1313
// Read test data from external JSON file
14-
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "officialregistry", "server_garmin_mcp.json")
14+
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "mcpregistry", "server_garmin_mcp.json")
1515
jsonData, err := os.ReadFile(testDataPath)
1616
if err != nil {
1717
t.Fatalf("Failed to read test data file %s: %v", testDataPath, err)
@@ -109,7 +109,7 @@ func TestServerDetailParsing(t *testing.T) {
109109

110110
func TestServerDetailToCatalogServer(t *testing.T) {
111111
// Read test data from external JSON file
112-
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "officialregistry", "server_garmin_mcp.json")
112+
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "mcpregistry", "server_garmin_mcp.json")
113113
jsonData, err := os.ReadFile(testDataPath)
114114
if err != nil {
115115
t.Fatalf("Failed to read test data file %s: %v", testDataPath, err)
@@ -159,7 +159,7 @@ func TestServerDetailToCatalogServer(t *testing.T) {
159159

160160
func TestConversionForFileSystem(t *testing.T) {
161161
// Read test data from external JSON file
162-
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "officialregistry", "server_filesystem.json")
162+
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "mcpregistry", "server_filesystem.json")
163163
jsonData, err := os.ReadFile(testDataPath)
164164
if err != nil {
165165
t.Fatalf("Failed to read test data file %s: %v", testDataPath, err)
@@ -343,7 +343,7 @@ func TestConversionForFileSystem(t *testing.T) {
343343

344344
func TestBasicServerConversion(t *testing.T) {
345345
// Read test data from the basic test JSON file
346-
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "officialregistry", "server.test.json")
346+
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "mcpregistry", "server.test.json")
347347
jsonData, err := os.ReadFile(testDataPath)
348348
if err != nil {
349349
t.Fatalf("Failed to read test data file %s: %v", testDataPath, err)
@@ -431,7 +431,7 @@ func TestBasicServerConversion(t *testing.T) {
431431

432432
func TestRemoteServerConversion(t *testing.T) {
433433
// Read test data from remote server JSON file
434-
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "officialregistry", "server.remote.json")
434+
testDataPath := filepath.Join("..", "..", "..", "..", "test", "testdata", "mcpregistry", "server.remote.json")
435435
jsonData, err := os.ReadFile(testDataPath)
436436
if err != nil {
437437
t.Fatalf("Failed to read test data file %s: %v", testDataPath, err)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)