oci

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MCPServerArtifactType = "application/vnd.docker.mcp.server"

Variables

This section is empty.

Functions

func CanonicalizeServerName

func CanonicalizeServerName(serverName string) string

canonicalizeServerName replaces all dots in a string with underscores

func CreateArtifactWithSubjectAndPush

func CreateArtifactWithSubjectAndPush(ctx context.Context, ref name.Reference, catalog Catalog, subjectDigest v1.Hash, subjectSize int64, subjectMediaType types.MediaType) (string, error)

func FullName added in v0.28.0

func FullName(ref name.Reference) string

func FullNameWithoutDigest added in v0.28.0

func FullNameWithoutDigest(ref name.Reference) string

func GetArtifactDigest added in v0.28.0

func GetArtifactDigest[T any](artifactType string, content T) (string, error)

func HasDigest added in v0.28.0

func HasDigest(ref name.Reference) bool

func Import

func Import(registryURL string, ociRepository string, push bool) error

func ImportToServer

func ImportToServer(registryURL string) (catalog.Server, error)

func InspectArtifact

func InspectArtifact[T any](ociRef string, expectedArtifactType string) error

InspectArtifact reads an OCI artifact and outputs formatted JSON content

func IsNoSuchImageError added in v0.28.0

func IsNoSuchImageError(err error) bool

func IsValidInputReference added in v0.28.0

func IsValidInputReference(ref name.Reference) bool

func PushArtifact added in v0.25.0

func PushArtifact[T any](ctx context.Context, ref name.Reference, artifactType string, content T, subject *oci.Descriptor) (string, error)

func ReadArtifact

func ReadArtifact[T any](ociRef string, expectedArtifactType string) (T, error)

ReadArtifact reads an OCI artifact by reference and returns parsed Catalog from the first layer if the artifact type is application/vnd.docker.mcp.server, otherwise returns an error

func SelfContainedCatalog

func SelfContainedCatalog(ctx context.Context, dockerClient docker.Client, serverNames []string) (catalog.Catalog, []string, error)

Types

type Argument

type Argument struct {
	InputWithVariables

	Type       string `json:"type"` // named, positional
	ValueHint  string `json:"value_hint,omitempty"`
	IsRepeated bool   `json:"is_repeated,omitempty"`
	Name       string `json:"name,omitempty"` // required if named
}

type Catalog

type Catalog struct {
	Registry []Server `json:"registry"`
}

Catalog represents an OCI catalog structure with a top-level Registry field

type Input

type Input struct {
	Description  string   `json:"description,omitempty"`
	Value        string   `json:"value,omitempty"`
	Required     bool     `json:"is_required,omitempty"`
	Secret       bool     `json:"is_secret,omitempty"`
	DefaultValue string   `json:"default,omitempty"`
	Choices      []string `json:"choices,omitempty"`
	Format       string   `json:"format,omitempty"` // "string", "number", "boolean", "filepath"
}

Input represents input configuration

type InputWithVariables

type InputWithVariables struct {
	Input

	Variables map[string]Input `json:"variables,omitempty"`
}

type KeyValueInput

type KeyValueInput struct {
	InputWithVariables

	Name string `json:"name"`
}

type Package

type Package struct {
	RegistryType     string          `json:"registry_type"`     // npm, pypi, oci, nuget, mcpb
	Identifier       string          `json:"identifier"`        // registry name
	Version          string          `json:"version,omitempty"` // tag or digest
	RegistryBaseURL  string          `json:"registry_base_url,omitempty"`
	Env              []KeyValueInput `json:"environment_variables,omitempty"`
	RuntimeOptions   []Argument      `json:"runtime_arguments,omitempty"`
	PackageArguments []Argument      `json:"package_arguments,omitempty"`
}

Package represents a package definition

type Remote

type Remote = RemoteServer

Remote alias for consistency with existing code

type RemoteServer

type RemoteServer struct {
	URL           string          `json:"url,omitempty"`
	TransportType string          `json:"type,omitempty"` // "streamable-http", "sse"
	Headers       []KeyValueInput `json:"headers,omitempty"`
}

Remote represents a remote server configuration

type Repository

type Repository struct {
	URL    string `json:"url,omitempty"`
	Source string `json:"source,omitempty"`
	ID     string `json:"id,omitempty"`
}

Repository contains repository information for the server

type RuntimeOptions

type RuntimeOptions struct {
	Command []string       `json:"command,omitempty"`
	Args    []string       `json:"args,omitempty"`
	Env     map[string]any `json:"env,omitempty"`
	WorkDir string         `json:"work_dir,omitempty"`
}

RuntimeOptions contains runtime configuration

type Server

type Server struct {
	Server   ServerDetail    `json:"server"`
	Registry json.RawMessage `json:"x-io.modelcontextprotocol.registry"`
}

Server represents a server definition in the OCI catalog

type ServerDetail

type ServerDetail struct {
	Name          string         `json:"name"`
	Description   string         `json:"description"`
	Version       string         `json:"version"`
	VersionDetail *VersionDetail `json:"version_detail,omitempty"`
	Status        string         `json:"status,omitempty"` // "active", "deprecated", or "deleted"
	Repository    Repository     `json:"repository,omitempty"`
	Packages      []Package      `json:"packages,omitempty"`
	Remotes       []Remote       `json:"remotes,omitempty"`
	Meta          map[string]any `json:"_meta,omitempty"`
}

ServerDetail represents the complete server definition based on the MCP registry schema

func (*ServerDetail) ToCatalogServer

func (sd *ServerDetail) ToCatalogServer() catalog.Server

ToCatalogServer converts an OCI ServerDetail to a catalog.Server

type Service added in v0.26.0

type Service interface {
	GetImageDigest(img v1.Image) (string, error)
	GetImageLabels(img v1.Image) (map[string]string, error)
	GetLocalImage(ctx context.Context, ref name.Reference) (v1.Image, error)
	GetRemoteImage(ctx context.Context, ref name.Reference) (v1.Image, error)
}

func NewService added in v0.26.0

func NewService() Service

TODO (cody): migrate everything in the other files over to the service

type VersionDetail

type VersionDetail struct {
	Version string `json:"version"`
}

VersionDetail contains version information

Jump to

Keyboard shortcuts

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