Help us shape the future of Go! Take the 2026 Go Developer Survey

registry

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveName

func DeriveName(srv Server) string

DeriveName extracts a short, usable name from the server's registry name or title.

func SelectBestPackage

func SelectBestPackage(srv Server) (*Package, *Remote)

SelectBestPackage chooses the best installable option from a server. Returns a package for local install, or a remote for hosted endpoints. Returns nil, nil if no supported option is found.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client for the MCP registry API.

func NewClient

func NewClient() *Client

NewClient creates a client using the official MCP registry.

func NewClientWithBase

func NewClientWithBase(baseURL string) *Client

NewClientWithBase creates a client with a custom base URL (useful for testing).

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string) ([]Server, error)

Search queries the registry for servers matching the given query. Returns an empty slice (not an error) for zero results.

type EnvironmentVar

type EnvironmentVar struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	IsRequired  bool   `json:"isRequired,omitempty"`
	IsSecret    bool   `json:"isSecret,omitempty"`
	Format      string `json:"format,omitempty"`
}

EnvironmentVar describes an environment variable needed by the server.

type InstallSpec

type InstallSpec struct {
	Name              string            // Derived short name for the server
	CommandOrURL      string            // Command (stdio) or URL (HTTP)
	Args              string            // Space-separated arguments
	Env               map[string]string // Environment variables with placeholders
	BearerTokenEnvVar string            // Bearer token env var for HTTP servers
	Headers           map[string]string // Required HTTP headers (non-bearer) for remote servers
}

InstallSpec contains the pre-populated values for the server add form.

func BuildInstallSpec

func BuildInstallSpec(srv Server, pkg *Package, remote *Remote) InstallSpec

BuildInstallSpec converts a server and selected package into form defaults. If pkg is non-nil, builds a local install spec. If remote is non-nil, builds an HTTP spec. Returns an empty InstallSpec (CommandOrURL == "") if neither is provided.

type Metadata

type Metadata struct {
	Count int `json:"count"`
}

Metadata contains pagination/count info.

type Package

type Package struct {
	RegistryType         string            `json:"registryType"`
	RegistryBaseURL      string            `json:"registryBaseUrl,omitempty"`
	Identifier           string            `json:"identifier"`
	Version              string            `json:"version"`
	RuntimeHint          string            `json:"runtimeHint,omitempty"`
	Transport            Transport         `json:"transport"`
	EnvironmentVariables []EnvironmentVar  `json:"environmentVariables,omitempty"`
	PackageArguments     []PackageArgument `json:"packageArguments,omitempty"`
}

Package represents a locally-installable package for an MCP server.

type PackageArgument

type PackageArgument struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	IsRequired  bool   `json:"isRequired,omitempty"`
	Format      string `json:"format,omitempty"`
	Type        string `json:"type,omitempty"` // "named" or empty (positional)
	Default     string `json:"default,omitempty"`
}

PackageArgument describes a command-line argument for the package.

type Remote

type Remote struct {
	Type    string         `json:"type"` // "streamable-http", "sse"
	URL     string         `json:"url"`
	Headers []RemoteHeader `json:"headers,omitempty"`
}

Remote represents a hosted endpoint for an MCP server.

type RemoteHeader

type RemoteHeader struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Value       string `json:"value"`
	IsRequired  bool   `json:"isRequired,omitempty"`
	IsSecret    bool   `json:"isSecret,omitempty"`
}

RemoteHeader describes an HTTP header needed for a remote endpoint.

type Repository

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

Repository contains source code information.

type SearchResponse

type SearchResponse struct {
	Servers  []ServerEntry `json:"servers"`
	Metadata Metadata      `json:"metadata"`
}

SearchResponse is the top-level API response from the MCP registry.

type Server

type Server struct {
	Name        string     `json:"name"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description"`
	Version     string     `json:"version"`
	Repository  Repository `json:"repository"`
	Packages    []Package  `json:"packages,omitempty"`
	Remotes     []Remote   `json:"remotes,omitempty"`
}

Server represents an MCP server in the registry.

type ServerEntry

type ServerEntry struct {
	Server Server         `json:"server"`
	Meta   map[string]any `json:"_meta,omitempty"`
}

ServerEntry wraps a server with its registry metadata.

type Transport

type Transport struct {
	Type string `json:"type"` // "stdio", "sse", "streamable-http"
	URL  string `json:"url,omitempty"`
}

Transport describes how to connect to the MCP server.

Jump to

Keyboard shortcuts

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