catalog

package
v0.40.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DockerCatalogFilename = "docker-mcp.yaml"
)

Variables

View Source
var ErrIncompatibleServer = errors.New("incompatible server")

ErrIncompatibleServer is returned by TransformToDocker when the server has no compatible package type (e.g. no OCI+stdio package and no remote).

Functions

func TransformToDocker added in v0.39.0

func TransformToDocker(ctx context.Context, serverDetail ServerDetail, opts ...TransformOption) (*Server, TransformSource, error)

TransformToDocker transforms a ServerDetail (community format) to Server (catalog format). The returned TransformSource indicates which package type was used (oci, pypi, or remote).

Types

type Catalog

type Catalog struct {
	Servers map[string]Server
}

func Get

func Get(ctx context.Context) (Catalog, error)

func GetWithOptions

func GetWithOptions(ctx context.Context, useConfigured bool, additionalCatalogs []string) (Catalog, error)

GetWithOptions loads catalogs with enhanced options for configured catalogs and additional catalogs

func ReadFrom

func ReadFrom(ctx context.Context, fileOrURLs []string) (Catalog, error)

func ReadOne added in v0.28.0

func ReadOne(ctx context.Context, fileOrURL string) (Catalog, string, string, error)

type Config

type Config struct {
	Secrets []Secret `yaml:"secrets,omitempty" json:"secrets,omitempty"`
	Env     []Env    `yaml:"env,omitempty" json:"env,omitempty"`
}

type Container

type Container struct {
	Image   string   `yaml:"image" json:"image"`
	Command []string `yaml:"command" json:"command"`
	Volumes []string `yaml:"volumes" json:"volumes"`
	User    string   `yaml:"user,omitempty" json:"user,omitempty"`
}

type Env

type Env struct {
	Name  string `yaml:"name" json:"name"`
	Value string `yaml:"value" json:"value"`
}

type Items

type Items struct {
	Type string `yaml:"type" json:"type"`
}

type Metadata added in v0.29.0

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"`
	// RegistryURL is the full URL to the server in the community MCP registry
	// e.g., "https://registry.modelcontextprotocol.io/v0/servers/io.github.arm%2Farm-mcp/versions/1.0.2"
	RegistryURL string `yaml:"registryUrl,omitempty" json:"registryUrl,omitempty"`
}

type OAuth

type OAuth struct {
	Providers []OAuthProvider `yaml:"providers,omitempty" json:"providers,omitempty"`
	Scopes    []string        `yaml:"scopes,omitempty" json:"scopes,omitempty"`
}

type OAuthProvider

type OAuthProvider struct {
	Provider string `yaml:"provider" json:"provider"`
	Secret   string `json:"secret,omitempty" yaml:"secret,omitempty"`
	Env      string `json:"env,omitempty" yaml:"env,omitempty"`
}

type Parameters

type Parameters struct {
	Type       string     `yaml:"type" json:"type"`
	Properties Properties `yaml:"properties" json:"properties"`
	Required   []string   `yaml:"required" json:"required"`
}

type Properties

type Properties map[string]Property

func (*Properties) ToMap

func (p *Properties) ToMap() map[string]any

type Property

type Property struct {
	Type        string `yaml:"type" json:"type"`
	Description string `yaml:"description" json:"description"`
	Items       *Items `yaml:"items,omitempty" json:"items,omitempty"`
}

type PyPIVersionResolver added in v0.40.2

type PyPIVersionResolver func(ctx context.Context, identifier, version, registryBaseURL string) (string, bool)

PyPIVersionResolver resolves the minimum Python version for a PyPI package. It returns the minimum Python version string (e.g., "3.10") or empty string if unknown, and a boolean indicating whether the package was found.

func DefaultPyPIVersionResolver added in v0.40.2

func DefaultPyPIVersionResolver() PyPIVersionResolver

DefaultPyPIVersionResolver creates a resolver using the default HTTP client with proxy transport.

func NewPyPIVersionResolver added in v0.40.2

func NewPyPIVersionResolver(httpClient *http.Client) PyPIVersionResolver

NewPyPIVersionResolver creates a resolver that queries the PyPI JSON API.

type RegistryEntry added in v0.39.0

type RegistryEntry = v0.ServerResponse

Type aliases for imported types from the registry package

type Remote

type Remote struct {
	URL       string            `yaml:"url,omitempty" json:"url,omitempty"`
	Transport string            `yaml:"transport_type,omitempty" json:"transport_type,omitempty"`
	Headers   map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
}

type Run

type Run struct {
	Command []string          `yaml:"command,omitempty" json:"command,omitempty"`
	Volumes []string          `yaml:"volumes,omitempty" json:"volumes,omitempty"`
	Env     map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
}

type Secret

type Secret struct {
	Name string `yaml:"name" json:"name"`
	Env  string `yaml:"env" json:"env"`
}

type Server

type Server struct {
	Name           string    `yaml:"name,omitempty" json:"name,omitempty" validate:"required,min=1"`
	Type           string    `yaml:"type" json:"type" validate:"required,oneof=server remote poci"`
	Image          string    `yaml:"image" json:"image"`
	Description    string    `yaml:"description,omitempty" json:"description,omitempty"`
	Title          string    `yaml:"title,omitempty" json:"title,omitempty"`
	Icon           string    `yaml:"icon,omitempty" json:"icon,omitempty"`
	ReadmeURL      string    `yaml:"readme,omitempty" json:"readme,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"`
	ExtraHosts     []string  `yaml:"extraHosts,omitempty" json:"extraHosts,omitempty"`
	Tools          []Tool    `yaml:"tools,omitempty" json:"tools,omitempty" validate:"dive"`
	Config         []any     `yaml:"config,omitempty" json:"config,omitempty"`
	Prefix         string    `yaml:"prefix,omitempty" json:"prefix,omitempty"`
	Metadata       *Metadata `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	// Policy describes the policy decision for this server.
	Policy *policy.Decision `yaml:"policy,omitempty" json:"policy,omitempty"`
}

func (*Server) HasExplicitOAuthProviders added in v0.40.1

func (s *Server) HasExplicitOAuthProviders() bool

HasExplicitOAuthProviders returns true if this is a remote server with explicit OAuth provider metadata in the catalog (e.g. oauth.providers YAML). Community servers that discover OAuth dynamically will return false here.

func (*Server) IsOAuthServer added in v0.27.0

func (s *Server) IsOAuthServer() bool

type ServerConfig

type ServerConfig struct {
	Name    string
	Spec    Server
	Config  map[string]any
	Secrets map[string]string
}

func (*ServerConfig) IsRemote added in v0.35.0

func (sc *ServerConfig) IsRemote() bool

IsRemote returns true if this server is a remote MCP server (not a Docker container)

type ServerDetail added in v0.39.0

type ServerDetail = v0.ServerJSON

Type aliases for imported types from the registry package

type Tool

type Tool struct {
	Name        string `yaml:"name" json:"name" validate:"required,min=1"`
	Description string `yaml:"description" json:"description"`

	// These will only be set for oci catalogs (not legacy catalogs).
	Arguments   *[]ToolArgument  `yaml:"arguments,omitempty" json:"arguments,omitempty"`
	Annotations *ToolAnnotations `yaml:"annotations,omitempty" json:"annotations,omitempty"`

	// This is only used for POCIs.
	Container  Container  `yaml:"container,omitempty" json:"container,omitempty"`
	Parameters Parameters `yaml:"parameters,omitempty" json:"parameters,omitempty"`
	// Policy describes the policy decision for this tool.
	Policy *policy.Decision `yaml:"policy,omitempty" json:"policy,omitempty"`
}

type ToolAnnotations added in v0.35.0

type ToolAnnotations struct {
	Title           string `json:"title,omitempty" yaml:"title,omitempty"`
	ReadOnlyHint    *bool  `json:"readOnlyHint,omitempty" yaml:"readOnlyHint,omitempty"`
	DestructiveHint *bool  `json:"destructiveHint,omitempty" yaml:"destructiveHint,omitempty"`
	IdempotentHint  *bool  `json:"idempotentHint,omitempty" yaml:"idempotentHint,omitempty"`
	OpenWorldHint   *bool  `json:"openWorldHint,omitempty" yaml:"openWorldHint,omitempty"`
}

type ToolArgument added in v0.35.0

type ToolArgument struct {
	Name        string `json:"name" yaml:"name"`
	Type        string `json:"type" yaml:"type"`
	Items       *Items `json:"items,omitempty" yaml:"items,omitempty"`
	Description string `json:"desc" yaml:"desc"`
	Optional    bool   `json:"optional,omitempty" yaml:"optional,omitempty"`
}

type ToolGroup

type ToolGroup struct {
	Name  string `yaml:"name" json:"name"`
	Tools []Tool `yaml:"tools" json:"tools"`
}

type TransformOption added in v0.40.2

type TransformOption func(*transformOptions)

TransformOption configures the behavior of TransformToDocker.

func WithAllowPyPI added in v0.40.2

func WithAllowPyPI(allow bool) TransformOption

WithAllowPyPI controls whether PyPI packages are considered during transformation. By default, PyPI packages are allowed.

func WithPyPIResolver added in v0.40.2

func WithPyPIResolver(resolver PyPIVersionResolver) TransformOption

WithPyPIResolver sets the PyPI version resolver used to determine the Python version for PyPI packages. If not set, the default Python version is used.

type TransformSource added in v0.40.2

type TransformSource string

TransformSource describes the package type that TransformToDocker resolved.

const (
	TransformSourceOCI    TransformSource = "oci"
	TransformSourcePyPI   TransformSource = "pypi"
	TransformSourceRemote TransformSource = "remote"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL