Add read-only Claude Code marketplace.json compatibility endpoint - #602
Add read-only Claude Code marketplace.json compatibility endpoint#602danielle-mustillo wants to merge 3 commits into
Conversation
gen-openapi force-enabled MCPRegistryCompatEnabled for spec generation but not PluginMarketplaceCompatEnabled, so the new marketplace.json endpoint was silently missing from openapi.yaml and the generated TS client. Enable it the same way and regenerate. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ilackarms
left a comment
There was a problem hiding this comment.
Nice, clean phase-1 cut — the reuse of the MCP compat pattern (flag-gated public path + per-kind ListFilter seam) makes the downstream RBAC story work with zero extra wiring, and the tests exercise the cursor walk properly. A few things around edge states of the served document below.
| } | ||
|
|
||
| repo := p.Spec.Source.Git.Repository | ||
| sha := p.Status.ResolvedSource.Commit |
There was a problem hiding this comment.
FromPlugin reads the repository URL/subfolder from spec but the pinned SHA from status.resolvedSource (which has no URL of its own). Since the controller keeps Ready=True while re-resolving a spec edit on an already-Ready plugin, there's a window where a just-edited plugin emits the new URL paired with the old repo's commit — a pin Claude Code can't install. Could we also require status.observedGeneration >= metadata.generation (mirroring pluginReconciled) and treat a mismatch as ErrNotResolved, so the entry is skipped until the new spec is actually resolved? A small test for the spec-edited-while-Ready case would lock this in.
| if name == "" { | ||
| name = DefaultMarketplaceName | ||
| } | ||
| resp := pluginmarketplace.MarketplaceResponse{ |
There was a problem hiding this comment.
With zero resolved plugins the document serializes as "plugins": null (the generated OpenAPI even reports type: [array, "null"]), while the marketplace.json schema expects an array — and an empty registry is exactly the state a first-time setup will be in when registering the URL. Could we initialize Plugins to an empty slice (the MCP compat endpoint does this via make(..., 0, len(rows))) so an empty catalogue emits "plugins": []? An empty-catalogue handler test would cover it.
| // partial/broken entry. | ||
| continue | ||
| } | ||
| resp.Plugins = append(resp.Plugins, entry) |
There was a problem hiding this comment.
The catalogue flattens all namespaces but emits bare metadata.name as the marketplace entry name, so two same-named plugins in different namespaces yield duplicate name entries in one document — ambiguous for claude plugin install <name>@<marketplace>. Would you consider a collision policy here — e.g. skip-with-log on duplicates, or a namespace-qualified name (the MCP compat endpoint qualifies its names) — so multi-tenant catalogues stay unambiguous?
Description
Adds a read-only
GET /plugin-marketplace/marketplace.jsonendpoint that re-exposes AgentRegistry'sPluginresources in the Claude Codemarketplace.jsonshape (code.claude.com/docs/en/plugin-marketplaces), so a bare URL to this endpoint can be registered directly withclaude plugin marketplace add.claude plugin marketplace addwithout a separate export step.pkg/pluginmarketplace: translates a resolvedv1alpha1.Pluginsource pin into themarketplace.jsonurl/git-subdirsource forms (phase 1 — nogithubshorthand form, since AgentRegistry always resolves to a concrete repository URL).internal/registry/api/handlers/pluginmarketplace: the HTTP handler, walking every Plugin row across all namespaces (paginated internally) and skipping any not-yet-resolved or unsupported-source entries so the document never contains a partial/broken entry. Honors the same optional per-kind RBACListFilteras the native Plugin read path.internal/registry/config/ router wiring: newPLUGIN_MARKETPLACE_COMPAT_ENABLEDflag (defaultfalse) and optional path prefix, since the endpoint flattens every namespace into one unscoped catalogue.docs/plugin-marketplace-compatibility.md: usage docs.Change Type
/kind feature
Changelog
Additional Notes
Off by default. The endpoint flattens every namespace into a single catalogue with no built-in scoping in OSS (nil
ListFilter) — enable only where a full, unscoped Plugin catalogue is acceptable to expose (a public OSS registry, or behind a trusted gateway).