From 3301b4adad0a0d0bb5a16e2fab56ed4f5980b09c Mon Sep 17 00:00:00 2001 From: zhanluxianshen Date: Fri, 30 May 2025 15:21:31 +0800 Subject: [PATCH] clean works. Signed-off-by: zhanluxianshen --- internal/api/server.go | 12 +++--------- tools/publisher/main.go | 11 +---------- tools/publisher/mcp.json | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/internal/api/server.go b/internal/api/server.go index c92a1a54..9d686965 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -14,11 +14,8 @@ import ( // Server represents the HTTP server type Server struct { - config *config.Config - registry service.RegistryService - authService auth.Service - router *http.ServeMux - server *http.Server + config *config.Config + server *http.Server } // NewServer creates a new HTTP server @@ -27,10 +24,7 @@ func NewServer(cfg *config.Config, registryService service.RegistryService, auth mux := router.New(cfg, registryService, authService) server := &Server{ - config: cfg, - registry: registryService, - authService: authService, - router: mux, + config: cfg, server: &http.Server{ Addr: cfg.ServerAddress, Handler: mux, diff --git a/tools/publisher/main.go b/tools/publisher/main.go index 9b0c97ff..82889837 100644 --- a/tools/publisher/main.go +++ b/tools/publisher/main.go @@ -88,15 +88,6 @@ func publishToRegistry(registryURL string, mcpData []byte, token string) error { return fmt.Errorf("error parsing mcp.json file: %w", err) } - // Create the publish request payload (without authentication) - publishReq := mcpDetails - - // Convert the request to JSON - jsonData, err := json.Marshal(publishReq) - if err != nil { - return fmt.Errorf("error serializing request: %w", err) - } - // Ensure the URL ends with the publish endpoint if !strings.HasSuffix(registryURL, "/") { registryURL += "/" @@ -104,7 +95,7 @@ func publishToRegistry(registryURL string, mcpData []byte, token string) error { publishURL := registryURL + "v0/publish" // Create and send the request - req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, publishURL, bytes.NewBuffer(jsonData)) + req, err := http.NewRequestWithContext(context.Background(), http.MethodPost, publishURL, bytes.NewBuffer(mcpData)) if err != nil { return fmt.Errorf("error creating request: %w", err) } diff --git a/tools/publisher/mcp.json b/tools/publisher/mcp.json index 6c4b1687..97e6c652 100644 --- a/tools/publisher/mcp.json +++ b/tools/publisher/mcp.json @@ -24,7 +24,7 @@ } ] },{ - "registry_name": "docker>", + "registry_name": "docker", "name": "io.github./-cli", "version": "0.123.223", "runtime_hint": "docker",