Documentation
¶
Overview ¶
Catalog (Spec 109 FR-060-067, data-model §9): a source-agnostic, ranked view over every enabled registry ("catalog source"), fanned out in parallel and merged into one ordered list. This is the shared backend for GET /catalog/search, the CLI `catalog` command group and MCP `search_servers` with `registry` omitted.
Spec 110 (catalog popularity signal): a PopularityProvider resolves GitHub star counts for repo keys (GitHubRepoKey), backed by a cached, rate-limited fetcher (githubStarsProvider is the production implementation — see popularity_github.go). It is installed process-wide via SetPopularityProvider (FR-010) so BuildCatalogHit and SearchAll can reach it without threading a dependency through every call site.
Index ¶
- Constants
- Variables
- func AllowPrivateRegistryFetchForTest() (restore func())
- func CatalogInstallTarget(install CatalogInstall) string
- func GitHubRepoKey(sourceCodeURL string) (key string, ok bool)
- func NewGitHubStarsProvider(opts PopularityOptions) *githubStarsProvider
- func Rank(a, b CatalogHit, q string) bool
- func RecordedRegistryHandlerForTest(corpus []json.RawMessage) http.Handler
- func RegistryKeyEnvVar(id string) string
- func ResetListingCacheForTest()
- func SearchAll(ctx context.Context, q, tag string, limit int, opts SearchOptions) ([]CatalogHit, *CatalogSections, []SourceError)
- func SetAllowPrivateRegistryFetch(allow bool)
- func SetCatalogWarmBehindForTest(timeout time.Duration, slots int) (restore func())
- func SetGitHubAPIBaseForTest(base string) (restore func())
- func SetPopularityProvider(p PopularityProvider)
- func SetPopularityProviderForTest(p PopularityProvider) (restore func())
- func SetRegistriesForTest(regs []RegistryEntry) (restore func())
- func SetRegistriesFromConfig(cfg *config.Config)
- func SetVersion(v string)
- func ValidateRegistrySourceURL(rawURL string) error
- type CatalogHit
- type CatalogInput
- type CatalogInstall
- type CatalogResult
- type CatalogSections
- type LookupState
- type Popularity
- type PopularityOptions
- type PopularityProvider
- type RegistryEntry
- type RequiredInput
- type SearchOptions
- type ServerEntry
- type SourceError
- type SourceProbe
Constants ¶
const ( // FallbackCachedListing is the SourceError.Fallback value, and the // `fallback` field of GET /catalog/search's unavailable[] on every surface. FallbackCachedListing = "cached_listing" )
Variables ¶
var ( // ErrRegistrySourceUnusable means the source answered but is not an official // v0.1 registry (404 on every candidate, HTML, non-JSON, or JSON that is not // a server list). This is a definitive verdict: the add is refused so the // user learns immediately, rather than at the next search. ErrRegistrySourceUnusable = errors.New("registry source is not a modelcontextprotocol/registry v0.1 endpoint") // ErrRegistrySourceUnreachable means the source could not be contacted at all // (DNS failure, connection refused, timeout). This says nothing about whether // the URL is a valid registry, so callers may still persist the source. ErrRegistrySourceUnreachable = errors.New("registry source could not be reached") )
var ( ErrRegistryNotFound = errors.New("registry not found") ErrServerNotFound = errors.New("server not found in registry") )
Sentinel errors for single-server lookup. Surfaces map these to stable error codes (registry_not_found / server_not_found) for cross-surface consistency (CN-004).
var ErrBlockedRegistryHost = errors.New("registry host is not allowed (internal/non-routable address)")
ErrBlockedRegistryHost is returned when a registry URL targets — or resolves to — a non-routable / internal address. It bounds CWE-918 (request forgery): a malicious or typo'd registry source must never let the daemon fetch from loopback, RFC1918/CGNAT private space, link-local (incl. the 169.254.169.254 cloud-metadata endpoint), or other internal ranges.
var ErrRegistryKeyMissing = errors.New("registry requires an API key that is not configured")
ErrRegistryKeyMissing is returned when a registry declares RequiresKey but no API key is configured for it. Calling surfaces should treat this as "registry unavailable" and continue rather than failing the whole search (FR-008 / SC-006).
var ErrRegistryRedirectRefused = errors.New("registry redirect refused")
ErrRegistryRedirectRefused means a registry answered with a redirect our policy will not follow (off the configured host, a non-http scheme, or too many hops). Like a non-200 status, this is the host ANSWERING — so the add-time probe must treat it as a definitive verdict about the source, not as "the network is down" (which would tolerate it and persist a registry that can never work).
Functions ¶
func AllowPrivateRegistryFetchForTest ¶ added in v0.70.0
func AllowPrivateRegistryFetchForTest() (restore func())
AllowPrivateRegistryFetchForTest relaxes the SSRF guard (internal/registries SetAllowPrivateRegistryFetch, MCP-1076) so a test's registry fixture can be an httptest.Server on loopback, and returns a restore func.
func CatalogInstallTarget ¶ added in v0.70.0
func CatalogInstallTarget(install CatalogInstall) string
CatalogInstallTarget returns a stable string identifying an install's target (a URL, or a command + args), used to join a catalog entry against a configured server (contracts/rest-api.md#catalog "added"): a manually added server matches on this alone, a catalog-added one also needs a matching source_registry_id.
func GitHubRepoKey ¶ added in v0.70.0
GitHubRepoKey normalizes a source-code URL into a lower-cased "owner/repo" key when it identifies a github.com repository whose owner and repo both pass GitHub's name rules (Spec 110 FR-003). It handles every edge-case form spec.md calls out: a `git+` prefix, a `.git` suffix, a monorepo subpath (only the first two path segments are taken), a `www.` prefix, a trailing slash, and mixed case. Anything else — a non-GitHub host, a gist, a malformed URL, or an owner/repo that fails the name rules (including the literal repo names "." and "..") — returns ok=false and never causes a fetch.
func NewGitHubStarsProvider ¶ added in v0.70.0
func NewGitHubStarsProvider(opts PopularityOptions) *githubStarsProvider
NewGitHubStarsProvider constructs the production PopularityProvider. When the FR-011 kill switch is set, the returned provider still answers Lookup from whatever is already cached (e.g. a bbolt store from before the switch was flipped) but starts no worker goroutines and Resolve is a no-op — a caller never needs to branch on the switch itself.
func Rank ¶ added in v0.70.0
func Rank(a, b CatalogHit, q string) bool
Rank is the pure, deterministic catalog ordering (Spec 109 D37.1, data-model §9, contracts/rest-api.md#catalog): match tier desc (how well the NAME matches q: publisher equals q > exact name > name prefix > name token > substring or description > namespace-only), official source desc, verified desc, popularity desc (missing = 0, Spec 110 FR-004), title asc, id asc. It reports whether a sorts strictly before b. An empty q puts every hit in tier 0, so browse-time order is official, verified, popularity, title, id.
func RecordedRegistryHandlerForTest ¶ added in v0.70.0
func RecordedRegistryHandlerForTest(corpus []json.RawMessage) http.Handler
RecordedRegistryHandlerForTest serves an official-protocol v0.1 registry (GET /v0.1/servers) from a recorded corpus of wrapped {server, _meta} items (Spec 109 D37.12). It reproduces the live registry's search semantics, which is what makes the catalog bug reproducible offline: `search` is a case-insensitive substring of server.name only, results are in byte order of the name, `version=latest` keeps only isLatest entries, `limit` defaults to 100, and `cursor` is the last name of the previous page (exclusive).
func RegistryKeyEnvVar ¶ added in v0.35.0
RegistryKeyEnvVar returns the environment variable a key-requiring registry reads its API key from: MCPPROXY_REGISTRY_<ID>_API_KEY, with the ID upper-cased and any non-alphanumeric character replaced by an underscore. e.g. "azure-mcp-demo" -> "MCPPROXY_REGISTRY_AZURE_MCP_DEMO_API_KEY".
func ResetListingCacheForTest ¶ added in v0.70.0
func ResetListingCacheForTest()
ResetListingCacheForTest empties the per-source listing cache (Spec 109 D35) so a test neither inherits nor leaks cached listings.
func SearchAll ¶ added in v0.70.0
func SearchAll(ctx context.Context, q, tag string, limit int, opts SearchOptions) ([]CatalogHit, *CatalogSections, []SourceError)
SearchAll fans the catalog fetch out to every enabled registry in parallel (FR-060), each bounded by opts.SourceTimeout (default 5s), merges the results, de-duplicates by (source, id), ranks them with Rank, and returns unavailable[] for sources that failed or timed out. An empty q additionally populates sections (official + popular, ≤ 12 each); a non-empty q leaves sections nil.
A typed q is fetched in full (searchCatalogSource, ≤ typedFetchCap per source) and ranked BEFORE it is truncated to `limit` (Spec 109 D37.3): the official registry returns names in byte order, so truncating first would let its alphabet decide what the user can see. A fetch that outlives the budget finishes in the background and refreshes the listing cache (D37.11, see catalog_warm_behind.go).
func SetAllowPrivateRegistryFetch ¶ added in v0.45.0
func SetAllowPrivateRegistryFetch(allow bool)
SetAllowPrivateRegistryFetch sets the SSRF allow-policy from config. Exposed so SetRegistriesFromConfig (and only it) can propagate the user's flag. The test-force override keeps loopback fetches working in the test binary.
func SetCatalogWarmBehindForTest ¶ added in v0.70.0
SetCatalogWarmBehindForTest overrides the warm-behind background timeout and the per-source slot count (Spec 109 D37.11) and returns a restore func.
func SetGitHubAPIBaseForTest ¶ added in v0.70.0
func SetGitHubAPIBaseForTest(base string) (restore func())
SetGitHubAPIBaseForTest overrides the GitHub API base URL new githubStarsProvider instances read at construction (default githubAPIBaseURLDefault), so a test can point NewGitHubStarsProvider at an httptest.Server. Combine with AllowPrivateRegistryFetchForTest, since the SSRF guard otherwise blocks a loopback target. Returns a restore func.
func SetPopularityProvider ¶ added in v0.70.0
func SetPopularityProvider(p PopularityProvider)
SetPopularityProvider installs the process-wide popularity provider (FR-010). nil disables all popularity lookups: BuildCatalogHit adds no stars and SearchAll enqueues no fetches — Docker's source-native Installs signal is unaffected either way (it never goes through this seam).
func SetPopularityProviderForTest ¶ added in v0.70.0
func SetPopularityProviderForTest(p PopularityProvider) (restore func())
SetPopularityProviderForTest installs p as the process-wide popularity provider (Spec 110 FR-010) and returns a restore func reinstalling whatever was previously installed (typically nil).
func SetRegistriesForTest ¶ added in v0.70.0
func SetRegistriesForTest(regs []RegistryEntry) (restore func())
SetRegistriesForTest replaces the effective registry list wholesale (no merge with the shipped defaults, unlike SetRegistriesFromConfig) and returns a restore func that reinstalls the previous list.
func SetRegistriesFromConfig ¶
SetRegistriesFromConfig builds the effective registry list by MERGING the built-in defaults with the user's configured registries, keyed by ID (FR-006). Built-in defaults come first (in their canonical order); a config entry with a new ID is appended, and a config entry whose ID collides with a default overrides it in place. This means adding one custom registry no longer drops the shipped defaults, and no rebuild is required.
func SetVersion ¶ added in v0.36.0
func SetVersion(v string)
SetVersion sets the version reported in the registry User-Agent header.
func ValidateRegistrySourceURL ¶ added in v0.45.0
ValidateRegistrySourceURL is the add-source / edit-source fail-fast: it rejects a user-supplied registry URL whose host is a literal IP in a blocked range, so `registry add-source https://169.254.169.254/...` is refused up front with a clear error instead of failing later at fetch time. It performs NO DNS lookup (keeping add/edit pure and offline) — hostname sources pass here and are guarded authoritatively when the daemon actually dials them.
Types ¶
type CatalogHit ¶ added in v0.70.0
type CatalogHit struct {
Entry ServerEntry
Source string
Title string
Publisher string
Verified bool
Official bool
// Curated marks a hit from the built-in reference source (Spec 109 D35):
// the shipped, hand-picked basics. buildSections lists them first in the
// Official section. Pure data, set by BuildCatalogHit.
Curated bool
// FromCache marks a hit served from the per-source listing cache because
// the source's live fetch failed (Spec 109 D35); see listing_cache.go.
FromCache bool
Popularity *Popularity
// contains filtered or unexported fields
}
CatalogHit is the internal ranked catalog result (Go only, never marshalled): it keeps the existing registries.ServerEntry untouched so GET /registries/{id}/servers and MCP search_servers keep serving its JSON unchanged (contracts/rest-api.md#catalog).
func BuildCatalogHit ¶ added in v0.70.0
func BuildCatalogHit(reg *RegistryEntry, entry ServerEntry) CatalogHit
BuildCatalogHit derives the catalog-only fields (Title, Publisher, Verified, Official, Popularity) from a registry entry. Official means the hit came from a built-in (trusted) source and feeds Rank and the Official section (Spec 109 D37.6). Verified is narrower (D37.5): for a trusted official-protocol entry it means the publisher's namespace owns the source repository; for a trusted reference or Docker entry it stays "trusted source"; an untrusted source never verifies. Exported so a single-entry lookup (CLI `catalog show`) can build the same CatalogHit shape SearchAll uses internally.
type CatalogInput ¶ added in v0.70.0
type CatalogInput struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
SecretLike bool `json:"secret_like"`
}
CatalogInput is the REST DTO for one required input (FR-061), folding the D13 name heuristic into SecretLike so a registry that omits or falsifies its own isSecret flag still defaults the field to Secret (FR-065).
type CatalogInstall ¶ added in v0.70.0
type CatalogInstall struct {
URL string `json:"url,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
}
CatalogInstall is the REST/MCP install target: either a remote URL or a local command + args, never both (data-model §9).
type CatalogResult ¶ added in v0.70.0
type CatalogResult struct {
Source string `json:"source"`
ID string `json:"id"`
Title string `json:"title"`
Publisher string `json:"publisher,omitempty"`
Verified bool `json:"verified"`
Official bool `json:"official"`
Popularity *Popularity `json:"popularity,omitempty"`
Description string `json:"description"`
Transport string `json:"transport"`
Install CatalogInstall `json:"install"`
RequiredInputs []CatalogInput `json:"required_inputs,omitempty"`
SourceCodeURL string `json:"source_code_url,omitempty"`
Added bool `json:"added"`
// AddedServerName identifies the one visible installed server that made
// Added true. It is intentionally omitted when no unique match exists.
// This lets clients open a credential-bearing install without attempting to
// join against redacted GET /servers fields.
AddedServerName string `json:"added_server_name,omitempty"`
// FromCache is true when this hit came from the source's cached listing
// because its live search failed. The source is also in unavailable[] with
// fallback="cached_listing" (Spec 109 D35).
FromCache bool `json:"from_cache,omitempty"`
}
CatalogResult is the GET /catalog/search response DTO (data-model §9), built from a CatalogHit by ToCatalogResult. It is a distinct type from ServerEntry so that type's JSON shape (url, installCmd, registry, required_inputs[].secret) is never renamed.
func ToCatalogResult ¶ added in v0.70.0
func ToCatalogResult(h CatalogHit, added bool) CatalogResult
ToCatalogResult builds the REST DTO from an internal hit. added is computed by the caller (httpapi layer, FR-007 scoped join) — SearchAll itself has no notion of the calling caller's visibility.
type CatalogSections ¶ added in v0.70.0
type CatalogSections struct {
Official []CatalogHit
Popular []CatalogHit
}
CatalogSections groups the empty-query landing results (FR-060): the official-source hits and the top-popularity hits across every source, each capped at catalogSectionCap. Internal (CatalogHit, not the REST DTO) — callers convert with ToCatalogResult once they know each entry's Added state (FR-007).
type LookupState ¶ added in v0.70.0
type LookupState int
LookupState is PopularityProvider.Lookup's classification of a cached entry (Spec 110 FR-008, zcode review round 1 finding 7):
- LookupFresh: a positive signal (stars) within its TTL. Display it; no fetch needed.
- LookupStale: a positive signal past its TTL. Still display it (stale-while-revalidate), but it needs a refresh.
- LookupNegative: no signal to display, and still within its TTL — either a confirmed 404/451, or a transient-error entry backing off within its own (shorter) TTL. Not re-fetched yet either way.
- LookupAbsent: no signal, and free to (re)fetch now — never seen, or past a negative/error entry's TTL.
const ( LookupAbsent LookupState = iota LookupFresh LookupStale LookupNegative )
type Popularity ¶ added in v0.70.0
type Popularity struct {
Stars *int `json:"stars,omitempty"`
Installs *int `json:"installs,omitempty"`
}
Popularity carries a source's own popularity signal — stars for a GitHub-hosted server, install/download counts otherwise. Either or both may be nil; a source that reports neither leaves Popularity itself nil.
type PopularityOptions ¶ added in v0.70.0
type PopularityOptions struct {
// DB is the bbolt database to persist the cache to. nil means memory
// only (the CLI in-process fallback — plan.md wiring table).
DB *bbolt.DB
// Logger receives best-effort diagnostics (store errors, etc). A nil
// Logger falls back to zap.NewNop().
Logger *zap.Logger
}
PopularityOptions configures NewGitHubStarsProvider.
type PopularityProvider ¶ added in v0.70.0
type PopularityProvider interface {
// Lookup returns the cached star count for key without any I/O. See
// LookupState for what each state means; only Fresh and Stale carry a
// meaningful `stars` value.
Lookup(key string) (stars int, state LookupState)
// Resolve enqueues any of keys that are Stale or Absent for a background
// fetch (de-duplicated against what's already queued/in-flight) and
// waits up to wait — bounded by ctx — for them to land. Fetching
// continues after Resolve returns even if the wait/ctx expired first.
// Resolve returns immediately, without enqueueing anything, when the
// provider is breaker-paused, its rolling budget is exhausted, or none of
// the requested keys were admitted (e.g. all already fresh, or the queue
// was full) — see popularity_github.go.
Resolve(ctx context.Context, keys []string, wait time.Duration)
}
PopularityProvider is the seam BuildCatalogHit and SearchAll use to read and refresh a GitHub repo's star count.
type RegistryEntry ¶
type RegistryEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"`
ServersURL string `json:"servers_url,omitempty"`
Tags []string `json:"tags,omitempty"`
Protocol string `json:"protocol,omitempty"`
Count interface{} `json:"count,omitempty"` // number or string
// RequiresKey marks a registry that needs an API key to be queried. When
// true and no key is configured, SearchServers skips it with
// ErrRegistryKeyMissing so the calling surface can mark it unavailable
// instead of failing the whole search (FR-008).
RequiresKey bool `json:"requires_key,omitempty"`
// Provenance is the trust tag (MCP-866): config.RegistryProvenanceOfficial
// for built-in defaults, config.RegistryProvenanceCustom for user-added
// registries. Computed authoritatively by SetRegistriesFromConfig — never
// trusted by self-assertion.
Provenance string `json:"provenance,omitempty"`
}
RegistryEntry represents a registry in the embedded registry list
func FindRegistry ¶
func FindRegistry(idOrName string) *RegistryEntry
FindRegistry finds a registry by ID or name (case-insensitive)
func ListRegistries ¶
func ListRegistries() []RegistryEntry
ListRegistries returns a copy of all available registries
func (*RegistryEntry) IsTrusted ¶ added in v0.36.0
func (r *RegistryEntry) IsTrusted() bool
IsTrusted reports whether this is an official, shipped-by-default registry. Trust is never granted by omission — an absent provenance tag is untrusted.
type RequiredInput ¶ added in v0.35.0
type RequiredInput struct {
Name string `json:"name"` // Env var name (e.g. GITHUB_TOKEN)
Description string `json:"description,omitempty"` // Optional human hint
Secret bool `json:"secret,omitempty"` // Mask in UI/logs when true
}
RequiredInput declares a single env var / key a server needs before it will work. Surfaces use this to prompt the user (FR-003).
func DetectRequiredInputs ¶ added in v0.35.0
func DetectRequiredInputs(entry *ServerEntry) []RequiredInput
DetectRequiredInputs returns the env vars / keys a server needs before it can run (FR-003 plumbing). It is best-effort and combines two sources:
(a) any RequiredInputs already declared on the entry (e.g. from a registry
payload that surfaced them explicitly), and
(b) a heuristic scan of the install command and URL for ${VAR} / $VAR
placeholders (decision O1 — no rich per-registry schema in this spec).
Results are de-duplicated by Name and returned in a stable (sorted) order so the same entry always yields the same list across surfaces (CN-004).
type SearchOptions ¶ added in v0.70.0
type SearchOptions struct {
SourceTimeout time.Duration
// Source narrows results to one catalog source id (GET
// /catalog/search?source=). Applied BEFORE ranking/truncation to
// `limit`, not after: an official/verified source's hits sort first by
// design, so a post-hoc filter on an already-truncated top-`limit` list
// could silently drop a narrower source's real matches that simply
// didn't survive the pre-filter truncation.
Source string
// PopularityWait bounds how long SearchAll waits (Spec 110 FR-007) for a
// background popularity fetch to land before returning. Zero — the Go
// zero value, i.e. left unset — means the default (800ms), matching
// every other *Timeout-shaped field in this struct (see SourceTimeout).
// A NEGATIVE value disables the wait entirely: SearchAll still enqueues
// the misses for background fetching, it just never blocks for them.
// The wait never outlives ctx.
PopularityWait time.Duration
}
SearchOptions configures a catalog search. SourceTimeout defaults to 5s; only tests set another value (T109a, SC-011).
type ServerEntry ¶
type ServerEntry struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
URL string `json:"url"` // MCP endpoint for remote server connections only
SourceCodeURL string `json:"source_code_url,omitempty"` // URL to source code repository
InstallCmd string `json:"installCmd,omitempty"` // Command to install the server locally
ConnectURL string `json:"connectUrl,omitempty"` // Alternative connection URL for remote servers
UpdatedAt string `json:"updatedAt,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
Registry string `json:"registry,omitempty"` // Which registry this came from
// Repository detection information
RepositoryInfo *experiments.GuessResult `json:"repository_info,omitempty"` // Detected npm/pypi package info
// RequiredInputs are env vars / keys the user must supply before the server
// can run (FR-003 plumbing). Best-effort: populated either from explicit
// registry payload fields or via a heuristic scan of the install command for
// ${VAR} / $VAR placeholders (see DetectRequiredInputs). Empty for most
// servers in this spec — no rich per-registry schema yet (decision O1).
RequiredInputs []RequiredInput `json:"required_inputs,omitempty"`
// Popularity carries a source-NATIVE popularity signal discovered while
// parsing this entry (Spec 110 FR-001) — currently only parseDocker's
// pull_count → Installs. Deliberately `json:"-"`: it must never appear in
// ServerEntry's own JSON (GET /registries/{id}/servers, search_servers),
// which stays unchanged. BuildCatalogHit copies it into CatalogHit and
// layers in GitHub stars from the popularity provider's cache.
Popularity *Popularity `json:"-"`
// Title is the source's own display title (server.json "title" for the
// official protocol), and Version the entry's published version. Both are
// `json:"-"` like Popularity: ServerEntry's wire JSON is unchanged. The
// catalog reads Title for display and matching (Spec 109 D37.10) and
// collapseOfficialVersions reads Version.
Title string `json:"-"`
Version string `json:"-"`
// contains filtered or unexported fields
}
ServerEntry represents an MCP server discovered via a registry
func FindServerByID ¶ added in v0.35.0
func FindServerByID(ctx context.Context, registryID, serverID string, guesser *experiments.Guesser) (*ServerEntry, error)
FindServerByID resolves a single server within a registry by its exact ID. It performs a live registry fetch and is the shared resolution path used by every add-from-registry surface (CN-001/CN-004). Returns ErrRegistryNotFound when registryID does not resolve and ErrServerNotFound when no server matches.
func SearchServers ¶
func SearchServers(ctx context.Context, registryID, tag, query string, limit int, guesser *experiments.Guesser) ([]ServerEntry, error)
SearchServers searches the given registry for servers matching optional tag and query with optional repository guessing and result limiting
type SourceError ¶ added in v0.70.0
type SourceError struct {
Source string `json:"source"`
Reason string `json:"reason"`
// Fallback is "cached_listing" when SearchAll answered for this source from
// its cached listing instead (the hits carry FromCache); CachedAt is when
// that listing was last refreshed. Both are empty when there was nothing to
// fall back on (Spec 109 D35).
Fallback string `json:"fallback,omitempty"`
CachedAt *time.Time `json:"cached_at,omitempty"`
}
SourceError records a catalog source that failed or timed out, surfaced as GET /catalog/search's unavailable[] (FR-060).
type SourceProbe ¶ added in v0.50.0
SourceProbe is the outcome of a successful probe: the exact URL to fetch and the protocol to parse it with.
func ProbeRegistrySource ¶ added in v0.50.0
func ProbeRegistrySource(ctx context.Context, rawURL string) (*SourceProbe, error)
ProbeRegistrySource fetches a candidate registry URL and classifies it. The URL the user pasted is always tried FIRST and, if it works, stored verbatim. Only a base URL that turns out not to serve a list itself falls back to the official /v0.1/servers collection.