Documentation
¶
Index ¶
Constants ¶
const (
DockerCatalogURL = "https://desktop.docker.com/mcp/catalog/v3/catalog.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func ParseServerRef ¶
ParseServerRef strips the optional "docker:" prefix from a server reference.
func WithLoader ¶ added in v1.92.0
WithLoader returns a copy of ctx that carries loader, so calls to ServerSpec / RequiredEnvVars made with the returned context resolve against it instead of the shared [defaultLoader]. Tests use it together with NewStaticLoader to serve a fixed catalog without global state. A nil loader is ignored so callers fall back to the [defaultLoader].
Types ¶
type Loader ¶ added in v1.92.0
type Loader struct {
// contains filtered or unexported fields
}
Loader fetches and memoizes the MCP catalog. A single Loader fetches the catalog at most once and reuses the memoized result for every later call, so callers should share one instance.
The zero value is not usable; construct with NewLoader (production, fetches from the network) or NewStaticLoader (tests, serves a fixed catalog with no network access). A Loader is carried on the context via WithLoader and retrieved with [loaderFrom]; call sites that don't inject one transparently use the shared [defaultLoader].
func NewLoader ¶ added in v1.92.0
func NewLoader() *Loader
NewLoader returns a Loader that fetches the catalog from the network (with on-disk cache fallback) on first use and memoizes the result.
func NewStaticLoader ¶ added in v1.92.0
NewStaticLoader returns a Loader that always serves catalog without touching the network. It is the test seam that replaces the old global override: a test injects it via WithLoader so its goroutines never race a shared package-level variable.