@@ -21,7 +21,7 @@ import (
2121 "github.com/docker/mcp-gateway/pkg/workingset"
2222)
2323
24- func Create (ctx context.Context , dao db.DAO , registryClient registryapi.Client , ociService oci.Service , refStr string , servers []string , workingSetID string , legacyCatalogURL string , communityRegistryRef string , title string ) error {
24+ func Create (ctx context.Context , dao db.DAO , registryClient registryapi.Client , ociService oci.Service , refStr string , servers []string , workingSetID string , legacyCatalogURL string , communityRegistryRef string , title string , includePyPI bool ) error {
2525 telemetry .Init ()
2626 start := time .Now ()
2727 var success bool
@@ -49,7 +49,7 @@ func Create(ctx context.Context, dao db.DAO, registryClient registryapi.Client,
4949 return fmt .Errorf ("failed to create catalog from legacy catalog: %w" , err )
5050 }
5151 } else if communityRegistryRef != "" {
52- catalog , err = createCatalogFromCommunityRegistry (ctx , registryClient , communityRegistryRef )
52+ catalog , err = createCatalogFromCommunityRegistry (ctx , registryClient , communityRegistryRef , includePyPI )
5353 if err != nil {
5454 return fmt .Errorf ("failed to create catalog from community registry: %w" , err )
5555 }
@@ -202,13 +202,14 @@ func workingSetServerToCatalogServer(server workingset.Server) Server {
202202type communityRegistryResult struct {
203203 serversAdded int
204204 serversOCI int
205+ serversPyPI int
205206 serversRemote int
206207 serversSkipped int
207208 totalServers int
208209 skippedByType map [string ]int
209210}
210211
211- func createCatalogFromCommunityRegistry (ctx context.Context , registryClient registryapi.Client , registryRef string ) (Catalog , error ) {
212+ func createCatalogFromCommunityRegistry (ctx context.Context , registryClient registryapi.Client , registryRef string , includePyPI bool ) (Catalog , error ) {
212213 baseURL := "https://" + registryRef
213214 servers , err := registryClient .ListServers (ctx , baseURL , "" )
214215 if err != nil {
@@ -217,10 +218,10 @@ func createCatalogFromCommunityRegistry(ctx context.Context, registryClient regi
217218
218219 catalogServers := make ([]Server , 0 )
219220 skippedByType := make (map [string ]int )
220- var ociCount , remoteCount int
221+ var ociCount , remoteCount , pypiCount int
221222
222223 for _ , serverResp := range servers {
223- catalogServer , err := legacycatalog .TransformToDocker (ctx , serverResp .Server , legacycatalog .WithAllowPyPI (false ))
224+ catalogServer , transformSource , err := legacycatalog .TransformToDocker (ctx , serverResp .Server , legacycatalog .WithAllowPyPI (includePyPI ), legacycatalog . WithPyPIResolver ( legacycatalog . DefaultPyPIVersionResolver () ))
224225 if err != nil {
225226 if ! errors .Is (err , legacycatalog .ErrIncompatibleServer ) {
226227 fmt .Fprintf (os .Stderr , "Warning: failed to transform server %q: %v\n " , serverResp .Server .Name , err )
@@ -242,7 +243,12 @@ func createCatalogFromCommunityRegistry(ctx context.Context, registryClient regi
242243 var s Server
243244 switch catalogServer .Type {
244245 case "server" :
245- ociCount ++
246+ switch transformSource {
247+ case legacycatalog .TransformSourcePyPI :
248+ pypiCount ++
249+ default :
250+ ociCount ++
251+ }
246252 s = Server {
247253 Type : workingset .ServerTypeImage ,
248254 Image : catalogServer .Image ,
@@ -272,12 +278,13 @@ func createCatalogFromCommunityRegistry(ctx context.Context, registryClient regi
272278 result := communityRegistryResult {
273279 serversAdded : len (catalogServers ),
274280 serversOCI : ociCount ,
281+ serversPyPI : pypiCount ,
275282 serversRemote : remoteCount ,
276283 serversSkipped : totalSkipped (skippedByType ),
277284 totalServers : len (servers ),
278285 skippedByType : skippedByType ,
279286 }
280- printCommunityRegistryResult (registryRef , result )
287+ printCommunityRegistryResult (registryRef , result , includePyPI )
281288
282289 return Catalog {
283290 CatalogArtifact : CatalogArtifact {
@@ -296,11 +303,14 @@ func totalSkipped(skippedByType map[string]int) int {
296303 return total
297304}
298305
299- func printCommunityRegistryResult (refStr string , result communityRegistryResult ) {
306+ func printCommunityRegistryResult (refStr string , result communityRegistryResult , includePyPI bool ) {
300307 fmt .Fprintf (os .Stderr , "Fetched %d servers from %s\n " , result .serversAdded , refStr )
301308 fmt .Fprintf (os .Stderr , " Total in registry: %d\n " , result .totalServers )
302309 fmt .Fprintf (os .Stderr , " Imported: %d\n " , result .serversAdded )
303310 fmt .Fprintf (os .Stderr , " OCI (stdio): %d\n " , result .serversOCI )
311+ if includePyPI {
312+ fmt .Fprintf (os .Stderr , " PyPI (stdio): %d\n " , result .serversPyPI )
313+ }
304314 fmt .Fprintf (os .Stderr , " Remote: %d\n " , result .serversRemote )
305315 fmt .Fprintf (os .Stderr , " Skipped: %d\n " , result .serversSkipped )
306316
0 commit comments