oci

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: MIT Imports: 21 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(ref name.Reference, catalog Catalog, subjectDigest v1.Hash, subjectSize int64, subjectMediaType types.MediaType, push bool) (string, error)

func Import

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

func ImportToServer

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

func InspectArtifact

func InspectArtifact(ociRef string) error

InspectArtifact reads an OCI artifact and outputs formatted JSON content

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

func ReadArtifact

func ReadArtifact(ociRef string) (Catalog, 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

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 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