Skip to content

Publish to the MCP Registry from the tag - #2

Merged
craigjmidwinter merged 1 commit into
mainfrom
automate-registry-publish
Jul 31, 2026
Merged

Publish to the MCP Registry from the tag#2
craigjmidwinter merged 1 commit into
mainfrom
automate-registry-publish

Conversation

@craigjmidwinter

Copy link
Copy Markdown
Owner

Automates the registry publish that was done by hand for v0.4.0.

Why

The registry entry names a version and an image tag. Both go stale the moment a new release ships, and keeping them correct manually means: edit server.json, run mcp-publisher login through a device-code flow, publish. Every time. That step gets skipped, and skipping it means the registry advertises a stale version indefinitely.

How

A second job in release.yml that needs: release, so it runs only after goreleaser has actually pushed the image — publishing an entry that points at an unpushed tag would advertise something nobody can pull.

It rewrites both fields from GITHUB_REF_NAME and publishes:

version="${GITHUB_REF_NAME#v}"
jq --arg v "$version" --arg img "ghcr.io/${{ github.repository }}:" \
  '.version = $v | .packages[0].identifier = $img + $v' server.json

Verified against the 2025-12-11 schema with a simulated v0.5.0 tag — output validates, and both fields move together as they must.

Auth is login github-oidc, so there is no registry secret in this repo to store, rotate or leak. The registry trusts the workflow identity.

Guarded to tag pushes only (startsWith(github.ref, 'refs/tags/v')): a workflow_dispatch run carries a branch name rather than a version, and its dry run pushes no image.

Consequence worth knowing

The version committed in server.json is now last release's, and lags by one tag on purpose. The tag is the source of truth; the file is a template CI stamps. README says this explicitly, because a lagging number in a committed file otherwise reads as a bug and invites someone to "fix" it.

Also

CI validates server.json on every PR. A tag release is the worst possible place to discover it is malformed — by then the image is pushed and the GitHub release is cut.

The registry entry names a version and an image tag, both of which go
stale the moment a new release ships. Keeping them right by hand means
remembering to edit server.json, re-run `mcp-publisher login` through a
device-code flow, and publish -- every time. That is a step that gets
skipped, and a skipped step here means the registry advertises an old
version indefinitely.

So the tag does it. A second job rewrites `version` and the image tag
from GITHUB_REF_NAME and publishes. It `needs: release` because the
entry points at an image goreleaser has to have pushed first;
publishing earlier would advertise something nobody can pull.

Authentication is OIDC, so there is no registry token in this
repository to store, rotate or leak -- the registry trusts the workflow
identity directly.

Tag pushes only. A workflow_dispatch run carries a branch name rather
than a version, and its dry run pushes no image at all.

The version left in server.json is now last release's by design; CI
stamps it. README says so, because a lagging number in a committed file
otherwise reads as a bug.

CI also validates server.json on every PR. A tag release is the worst
place to learn it is malformed: by then the image is pushed and the
GitHub release is cut.
@craigjmidwinter
craigjmidwinter merged commit fd3ae79 into main Jul 31, 2026
2 checks passed
@craigjmidwinter
craigjmidwinter deleted the automate-registry-publish branch July 31, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant