Skip to content

Add read-only Claude Code marketplace.json compatibility endpoint - #602

Open
danielle-mustillo wants to merge 3 commits into
agentregistry-dev:mainfrom
danielle-mustillo:marketplace
Open

Add read-only Claude Code marketplace.json compatibility endpoint#602
danielle-mustillo wants to merge 3 commits into
agentregistry-dev:mainfrom
danielle-mustillo:marketplace

Conversation

@danielle-mustillo

Copy link
Copy Markdown

Description

Adds a read-only GET /plugin-marketplace/marketplace.json endpoint that re-exposes AgentRegistry's Plugin resources in the Claude Code marketplace.json shape (code.claude.com/docs/en/plugin-marketplaces), so a bare URL to this endpoint can be registered directly with claude plugin marketplace add.

  • Motivation: let AgentRegistry serve as a source for claude plugin marketplace add without a separate export step.
  • What changed:
    • pkg/pluginmarketplace: translates a resolved v1alpha1.Plugin source pin into the marketplace.json url/git-subdir source forms (phase 1 — no github shorthand 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 RBAC ListFilter as the native Plugin read path.
    • internal/registry/config / router wiring: new PLUGIN_MARKETPLACE_COMPAT_ENABLED flag (default false) 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

Add optional read-only Claude Code marketplace.json compatibility endpoint (`PLUGIN_MARKETPLACE_COMPAT_ENABLED`), letting `claude plugin marketplace add` point directly at an AgentRegistry Plugin catalogue.

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).

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>
Comment thread internal/registry/config/config.go

@ilackarms ilackarms left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants