Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 30 additions & 19 deletions pkg/catalog/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,36 @@ type topLevel struct {
// MCP Servers

type Server struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type" json:"type"`
Image string `yaml:"image" json:"image"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
LongLived bool `yaml:"longLived,omitempty" json:"longLived,omitempty"`
Remote Remote `yaml:"remote" json:"remote"`
SSEEndpoint string `yaml:"sseEndpoint,omitempty" json:"sseEndpoint,omitempty"` // Deprecated: Use Remote instead
OAuth *OAuth `yaml:"oauth,omitempty" json:"oauth,omitempty"`
Secrets []Secret `yaml:"secrets,omitempty" json:"secrets,omitempty"`
Env []Env `yaml:"env,omitempty" json:"env,omitempty"`
Command []string `yaml:"command,omitempty" json:"command,omitempty"`
Volumes []string `yaml:"volumes,omitempty" json:"volumes,omitempty"`
User string `yaml:"user,omitempty" json:"user,omitempty"`
DisableNetwork bool `yaml:"disableNetwork,omitempty" json:"disableNetwork,omitempty"`
AllowHosts []string `yaml:"allowHosts,omitempty" json:"allowHosts,omitempty"`
Tools []Tool `yaml:"tools,omitempty" json:"tools,omitempty"`
Config []any `yaml:"config,omitempty" json:"config,omitempty"`
Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty"`
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type" json:"type"`
Image string `yaml:"image" json:"image"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
LongLived bool `yaml:"longLived,omitempty" json:"longLived,omitempty"`
Remote Remote `yaml:"remote" json:"remote"`
SSEEndpoint string `yaml:"sseEndpoint,omitempty" json:"sseEndpoint,omitempty"` // Deprecated: Use Remote instead
OAuth *OAuth `yaml:"oauth,omitempty" json:"oauth,omitempty"`
Secrets []Secret `yaml:"secrets,omitempty" json:"secrets,omitempty"`
Env []Env `yaml:"env,omitempty" json:"env,omitempty"`
Command []string `yaml:"command,omitempty" json:"command,omitempty"`
Volumes []string `yaml:"volumes,omitempty" json:"volumes,omitempty"`
User string `yaml:"user,omitempty" json:"user,omitempty"`
DisableNetwork bool `yaml:"disableNetwork,omitempty" json:"disableNetwork,omitempty"`
AllowHosts []string `yaml:"allowHosts,omitempty" json:"allowHosts,omitempty"`
Tools []Tool `yaml:"tools,omitempty" json:"tools,omitempty"`
Config []any `yaml:"config,omitempty" json:"config,omitempty"`
Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty"`
Metadata *Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}

type Metadata struct {
Pulls int `yaml:"pulls,omitempty" json:"pulls,omitempty"`
Stars int `yaml:"stars,omitempty" json:"stars,omitempty"`
GithubStars int `yaml:"githubStars,omitempty" json:"githubStars,omitempty"`
Category string `yaml:"category,omitempty" json:"category,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
License string `yaml:"license,omitempty" json:"license,omitempty"`
Owner string `yaml:"owner,omitempty" json:"owner,omitempty"`
}

func (s *Server) IsOAuthServer() bool {
Expand Down
50 changes: 50 additions & 0 deletions pkg/workingset/workingset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,47 @@ type: remote`,
},
},
},
{
name: "image with full metadata including pulls and owner",
server: Server{
Type: ServerTypeImage,
Image: "testimage:v1.0",
},
labels: map[string]string{
"io.docker.server.metadata": `name: GitHub Server
type: server
image: testimage:v1.0
description: Official GitHub MCP Server
title: GitHub Official
metadata:
pulls: 42055
githubStars: 24479
category: devops
tags:
- github
- devops
license: MIT License
owner: github`,
},
expectError: false,
expected: &ServerSnapshot{
Server: catalog.Server{
Name: "GitHub Server",
Type: "server",
Image: "testimage:v1.0",
Description: "Official GitHub MCP Server",
Title: "GitHub Official",
Metadata: &catalog.Metadata{
Pulls: 42055,
GithubStars: 24479,
Category: "devops",
Tags: []string{"github", "devops"},
License: "MIT License",
Owner: "github",
},
},
},
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -671,6 +712,15 @@ type: remote`,
if tt.expected.Server.Description != "" {
assert.Equal(t, tt.expected.Server.Description, snapshot.Server.Description)
}
if tt.expected.Server.Metadata != nil {
require.NotNil(t, snapshot.Server.Metadata)
assert.Equal(t, tt.expected.Server.Metadata.Pulls, snapshot.Server.Metadata.Pulls)
assert.Equal(t, tt.expected.Server.Metadata.GithubStars, snapshot.Server.Metadata.GithubStars)
assert.Equal(t, tt.expected.Server.Metadata.Category, snapshot.Server.Metadata.Category)
assert.Equal(t, tt.expected.Server.Metadata.Tags, snapshot.Server.Metadata.Tags)
assert.Equal(t, tt.expected.Server.Metadata.License, snapshot.Server.Metadata.License)
assert.Equal(t, tt.expected.Server.Metadata.Owner, snapshot.Server.Metadata.Owner)
}
}
})
}
Expand Down
Loading