types

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package types contains the core type definitions for the MCP registry system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortServersByName

func SortServersByName(servers []ServerMetadata)

SortServersByName sorts a slice of ServerMetadata by name

Types

type BaseServerMetadata

type BaseServerMetadata struct {
	// Name is the identifier for the MCP server, used when referencing the server in commands
	// If not provided, it will be auto-generated from the registry key
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
	// Description is a human-readable description of the server's purpose and functionality
	Description string `json:"description" yaml:"description"`
	// Tier represents the tier classification level of the server, e.g., "Official" or "Community"
	Tier string `json:"tier" yaml:"tier"`
	// Status indicates whether the server is currently active or deprecated
	Status string `json:"status" yaml:"status"`
	// Transport defines the communication protocol for the server
	// For containers: stdio, sse, or streamable-http
	// For remote servers: sse or streamable-http (stdio not supported)
	Transport string `json:"transport" yaml:"transport"`
	// Tools is a list of tool names provided by this MCP server
	Tools []string `json:"tools" yaml:"tools"`
	// Metadata contains additional information about the server such as popularity metrics
	Metadata *Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	// RepositoryURL is the URL to the source code repository for the server
	RepositoryURL string `json:"repository_url,omitempty" yaml:"repository_url,omitempty"`
	// Tags are categorization labels for the server to aid in discovery and filtering
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
	// CustomMetadata allows for additional user-defined metadata
	CustomMetadata map[string]any `json:"custom_metadata,omitempty" yaml:"custom_metadata,omitempty"`
}

BaseServerMetadata contains common fields shared between container and remote MCP servers

type EnvVar

type EnvVar struct {
	// Name is the environment variable name (e.g., API_KEY)
	Name string `json:"name" yaml:"name"`
	// Description is a human-readable explanation of the variable's purpose
	Description string `json:"description" yaml:"description"`
	// Required indicates whether this environment variable must be provided
	// If true and not provided via command line or secrets, the user will be prompted for a value
	Required bool `json:"required" yaml:"required"`
	// Default is the value to use if the environment variable is not explicitly provided
	// Only used for non-required variables
	Default string `json:"default,omitempty" yaml:"default,omitempty"`
	// Secret indicates whether this environment variable contains sensitive information
	// If true, the value will be stored as a secret rather than as a plain environment variable
	Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
}

EnvVar represents an environment variable for an MCP server

type Group

type Group struct {
	// Name is the identifier for the group, used when referencing the group in commands
	Name string `json:"name" yaml:"name"`
	// Description is a human-readable description of the group's purpose and functionality
	Description string `json:"description" yaml:"description"`
	// Servers is a map of server names to their corresponding server definitions within this group
	Servers map[string]*ImageMetadata `json:"servers,omitempty" yaml:"servers,omitempty"`
	// RemoteServers is a map of server names to their corresponding remote server definitions within this group
	RemoteServers map[string]*RemoteServerMetadata `json:"remote_servers,omitempty" yaml:"remote_servers,omitempty"`
}

Group represents a collection of related MCP servers that can be deployed together

func (*Group) GetAllGroupServers

func (g *Group) GetAllGroupServers() []ServerMetadata

GetAllGroupServers returns all servers from a specific group (both container and remote) as a unified list

type Header struct {
	// Name is the header name (e.g., X-API-Key, Authorization)
	Name string `json:"name" yaml:"name"`
	// Description is a human-readable explanation of the header's purpose
	Description string `json:"description" yaml:"description"`
	// Required indicates whether this header must be provided
	// If true and not provided via command line or secrets, the user will be prompted for a value
	Required bool `json:"required" yaml:"required"`
	// Default is the value to use if the header is not explicitly provided
	// Only used for non-required headers
	Default string `json:"default,omitempty" yaml:"default,omitempty"`
	// Secret indicates whether this header contains sensitive information
	// If true, the value will be stored as a secret rather than as plain text
	Secret bool `json:"secret,omitempty" yaml:"secret,omitempty"`
	// Choices provides a list of valid values for the header (optional)
	Choices []string `json:"choices,omitempty" yaml:"choices,omitempty"`
}

Header represents an HTTP header for remote MCP server authentication

type ImageMetadata

type ImageMetadata struct {
	BaseServerMetadata `yaml:",inline"`
	// Image is the Docker image reference for the MCP server
	Image string `json:"image" yaml:"image"`
	// TargetPort is the port for the container to expose (only applicable to SSE and Streamable HTTP transports)
	TargetPort int `json:"target_port,omitempty" yaml:"target_port,omitempty"`
	// Permissions defines the security profile and access permissions for the server
	Permissions *permissions.Profile `json:"permissions,omitempty" yaml:"permissions,omitempty"`
	// EnvVars defines environment variables that can be passed to the server
	EnvVars []*EnvVar `json:"env_vars,omitempty" yaml:"env_vars,omitempty"`
	// Args are the default command-line arguments to pass to the MCP server container.
	// These arguments will be used only if no command-line arguments are provided by the user.
	// If the user provides arguments, they will override these defaults.
	Args []string `json:"args,omitempty" yaml:"args,omitempty"`
	// DockerTags lists the available Docker tags for this server image
	DockerTags []string `json:"docker_tags,omitempty" yaml:"docker_tags,omitempty"`
	// Provenance contains verification and signing metadata
	Provenance *Provenance `json:"provenance,omitempty" yaml:"provenance,omitempty"`
}

ImageMetadata represents the metadata for an MCP server image stored in our registry.

func (*ImageMetadata) GetCustomMetadata

func (i *ImageMetadata) GetCustomMetadata() map[string]any

GetCustomMetadata returns custom metadata

func (*ImageMetadata) GetDescription

func (i *ImageMetadata) GetDescription() string

GetDescription returns the server description

func (*ImageMetadata) GetEnvVars

func (i *ImageMetadata) GetEnvVars() []*EnvVar

GetEnvVars returns environment variables

func (*ImageMetadata) GetMetadata

func (i *ImageMetadata) GetMetadata() *Metadata

GetMetadata returns the server metadata

func (*ImageMetadata) GetName

func (i *ImageMetadata) GetName() string

GetName returns the server name

func (*ImageMetadata) GetRepositoryURL

func (i *ImageMetadata) GetRepositoryURL() string

GetRepositoryURL returns the repository URL

func (*ImageMetadata) GetStatus

func (i *ImageMetadata) GetStatus() string

GetStatus returns the server status

func (*ImageMetadata) GetTags

func (i *ImageMetadata) GetTags() []string

GetTags returns the server tags

func (*ImageMetadata) GetTier

func (i *ImageMetadata) GetTier() string

GetTier returns the server tier

func (*ImageMetadata) GetTools

func (i *ImageMetadata) GetTools() []string

GetTools returns the list of tools provided by the server

func (*ImageMetadata) GetTransport

func (i *ImageMetadata) GetTransport() string

GetTransport returns the server transport

func (*ImageMetadata) IsRemote

func (*ImageMetadata) IsRemote() bool

IsRemote returns false for container servers

type Metadata

type Metadata struct {
	// Stars represents the popularity rating or number of stars for the server
	Stars int `json:"stars" yaml:"stars"`
	// Pulls indicates how many times the server image has been downloaded
	Pulls int `json:"pulls" yaml:"pulls"`
	// LastUpdated is the timestamp when the server was last updated, in RFC3339 format
	LastUpdated string `json:"last_updated" yaml:"last_updated"`
}

Metadata represents metadata about an MCP server

func (*Metadata) ParsedTime

func (m *Metadata) ParsedTime() (time.Time, error)

ParsedTime returns the LastUpdated field as a time.Time

type OAuthConfig

type OAuthConfig struct {
	// Issuer is the OAuth/OIDC issuer URL (e.g., https://accounts.google.com)
	// Used for OIDC discovery to find authorization and token endpoints
	Issuer string `json:"issuer,omitempty" yaml:"issuer,omitempty"`
	// AuthorizeURL is the OAuth authorization endpoint URL
	// Used for non-OIDC OAuth flows when issuer is not provided
	AuthorizeURL string `json:"authorize_url,omitempty" yaml:"authorize_url,omitempty"`
	// TokenURL is the OAuth token endpoint URL
	// Used for non-OIDC OAuth flows when issuer is not provided
	TokenURL string `json:"token_url,omitempty" yaml:"token_url,omitempty"`
	// ClientID is the OAuth client ID for authentication
	ClientID string `json:"client_id,omitempty" yaml:"client_id,omitempty"`
	// Scopes are the OAuth scopes to request
	// If not specified, defaults to ["openid", "profile", "email"] for OIDC
	Scopes []string `json:"scopes,omitempty" yaml:"scopes,omitempty"`
	// UsePKCE indicates whether to use PKCE for the OAuth flow
	// Defaults to true for enhanced security
	UsePKCE bool `json:"use_pkce,omitempty" yaml:"use_pkce,omitempty"`
	// OAuthParams contains additional OAuth parameters to include in the authorization request
	// These are server-specific parameters like "prompt", "response_mode", etc.
	OAuthParams map[string]string `json:"oauth_params,omitempty" yaml:"oauth_params,omitempty"`
	// CallbackPort is the specific port to use for the OAuth callback server
	// If not specified, a random available port will be used
	CallbackPort int `json:"callback_port,omitempty" yaml:"callback_port,omitempty"`
	// Resource is the OAuth 2.0 resource indicator (RFC 8707)
	Resource string `json:"resource,omitempty" yaml:"resource,omitempty"`
}

OAuthConfig represents OAuth/OIDC configuration for remote server authentication

type Provenance

type Provenance struct {
	SigstoreURL       string               `json:"sigstore_url" yaml:"sigstore_url"`
	RepositoryURI     string               `json:"repository_uri" yaml:"repository_uri"`
	RepositoryRef     string               `json:"repository_ref,omitempty" yaml:"repository_ref,omitempty"`
	SignerIdentity    string               `json:"signer_identity" yaml:"signer_identity"`
	RunnerEnvironment string               `json:"runner_environment" yaml:"runner_environment"`
	CertIssuer        string               `json:"cert_issuer" yaml:"cert_issuer"`
	Attestation       *VerifiedAttestation `json:"attestation,omitempty" yaml:"attestation,omitempty"`
}

Provenance contains metadata about the image's provenance and signing status

type Registry

type Registry struct {
	// Version is the schema version of the registry
	Version string `json:"version" yaml:"version"`
	// LastUpdated is the timestamp when the registry was last updated, in RFC3339 format
	LastUpdated string `json:"last_updated" yaml:"last_updated"`
	// Servers is a map of server names to their corresponding server definitions
	Servers map[string]*ImageMetadata `json:"servers" yaml:"servers"`
	// RemoteServers is a map of server names to their corresponding remote server definitions
	// These are MCP servers accessed via HTTP/HTTPS using the thv proxy command
	RemoteServers map[string]*RemoteServerMetadata `json:"remote_servers,omitempty" yaml:"remote_servers,omitempty"`
	// Groups is a slice of group definitions containing related MCP servers
	Groups []*Group `json:"groups,omitempty" yaml:"groups,omitempty"`
}

Registry represents the top-level structure of the MCP registry

func (*Registry) GetAllGroups

func (reg *Registry) GetAllGroups() []*Group

GetAllGroups returns all groups in the registry

func (*Registry) GetAllServers

func (reg *Registry) GetAllServers() []ServerMetadata

GetAllServers returns all servers (both container and remote) as a unified list

func (*Registry) GetGroupByName

func (reg *Registry) GetGroupByName(name string) (*Group, bool)

GetGroupByName returns a group by name

func (*Registry) GetServerByName

func (reg *Registry) GetServerByName(name string) (ServerMetadata, bool)

GetServerByName returns a server by name (either container or remote)

type RemoteServerMetadata

type RemoteServerMetadata struct {
	BaseServerMetadata `yaml:",inline"`
	// URL is the endpoint URL for the remote MCP server (e.g., https://api.example.com/mcp)
	URL string `json:"url" yaml:"url"`
	// Headers defines HTTP headers that can be passed to the remote server for authentication
	// These are used with the thv proxy command's authentication features
	Headers []*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
	// OAuthConfig provides OAuth/OIDC configuration for authentication to the remote server
	// Used with the thv proxy command's --remote-auth flags
	OAuthConfig *OAuthConfig `json:"oauth_config,omitempty" yaml:"oauth_config,omitempty"`
	// EnvVars defines environment variables that can be passed to configure the client
	// These might be needed for client-side configuration when connecting to the remote server
	EnvVars []*EnvVar `json:"env_vars,omitempty" yaml:"env_vars,omitempty"`
}

RemoteServerMetadata represents the metadata for a remote MCP server accessed via HTTP/HTTPS. Remote servers are accessed through the thv proxy command which handles authentication and tunneling.

func (*RemoteServerMetadata) GetCustomMetadata

func (r *RemoteServerMetadata) GetCustomMetadata() map[string]any

GetCustomMetadata returns custom metadata

func (*RemoteServerMetadata) GetDescription

func (r *RemoteServerMetadata) GetDescription() string

GetDescription returns the server description

func (*RemoteServerMetadata) GetEnvVars

func (r *RemoteServerMetadata) GetEnvVars() []*EnvVar

GetEnvVars returns environment variables

func (*RemoteServerMetadata) GetMetadata

func (r *RemoteServerMetadata) GetMetadata() *Metadata

GetMetadata returns the server metadata

func (*RemoteServerMetadata) GetName

func (r *RemoteServerMetadata) GetName() string

GetName returns the server name

func (*RemoteServerMetadata) GetRawImplementation

func (r *RemoteServerMetadata) GetRawImplementation() any

GetRawImplementation returns the underlying RemoteServerMetadata pointer

func (*RemoteServerMetadata) GetRepositoryURL

func (r *RemoteServerMetadata) GetRepositoryURL() string

GetRepositoryURL returns the repository URL

func (*RemoteServerMetadata) GetStatus

func (r *RemoteServerMetadata) GetStatus() string

GetStatus returns the server status

func (*RemoteServerMetadata) GetTags

func (r *RemoteServerMetadata) GetTags() []string

GetTags returns the server tags

func (*RemoteServerMetadata) GetTier

func (r *RemoteServerMetadata) GetTier() string

GetTier returns the server tier

func (*RemoteServerMetadata) GetTools

func (r *RemoteServerMetadata) GetTools() []string

GetTools returns the list of tools provided by the server

func (*RemoteServerMetadata) GetTransport

func (r *RemoteServerMetadata) GetTransport() string

GetTransport returns the server transport

func (*RemoteServerMetadata) IsRemote

func (*RemoteServerMetadata) IsRemote() bool

IsRemote returns true for remote servers

type ServerMetadata

type ServerMetadata interface {
	// GetName returns the server name
	GetName() string
	// GetDescription returns the server description
	GetDescription() string
	// GetTier returns the server tier
	GetTier() string
	// GetStatus returns the server status
	GetStatus() string
	// GetTransport returns the server transport
	GetTransport() string
	// GetTools returns the list of tools provided by the server
	GetTools() []string
	// GetMetadata returns the server metadata
	GetMetadata() *Metadata
	// GetRepositoryURL returns the repository URL
	GetRepositoryURL() string
	// GetTags returns the server tags
	GetTags() []string
	// GetCustomMetadata returns custom metadata
	GetCustomMetadata() map[string]any
	// IsRemote returns true if this is a remote server
	IsRemote() bool
	// GetEnvVars returns environment variables
	GetEnvVars() []*EnvVar
}

ServerMetadata is an interface that both ImageMetadata and RemoteServerMetadata implement

type VerifiedAttestation

type VerifiedAttestation struct {
	PredicateType string `json:"predicate_type,omitempty" yaml:"predicate_type,omitempty"`
	Predicate     any    `json:"predicate,omitempty" yaml:"predicate,omitempty"`
}

VerifiedAttestation represents the verified attestation information

Jump to

Keyboard shortcuts

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