From f12de879caee571cf4e66e35a9dce63fd9025133 Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Thu, 19 Nov 2026 14:02:37 +0530 Subject: [PATCH 1/3] Publish MCP Bundles to the official MCP Registry on release Adds a reusable workflow that builds server.json for a release tag (version plus the SHA-256 of each .mcpb asset) and publishes it to registry.modelcontextprotocol.io using GitHub OIDC, so no secret or org Owner login is needed for the io.github.Screenly namespace. release.yml calls it after build-release; it can also be run by hand from the Actions tab to publish an existing tag. --- .github/workflows/mcp-registry.yml | 110 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 10 +++ mcpb/server.json | 13 ++++ 3 files changed, 133 insertions(+) create mode 100644 .github/workflows/mcp-registry.yml create mode 100644 mcpb/server.json diff --git a/.github/workflows/mcp-registry.yml b/.github/workflows/mcp-registry.yml new file mode 100644 index 0000000..cf74e73 --- /dev/null +++ b/.github/workflows/mcp-registry.yml @@ -0,0 +1,110 @@ +# Publishes the release's MCP Bundles (.mcpb) to the official MCP Registry +# (registry.modelcontextprotocol.io), which GitHub's MCP directory reads from. +# +# Runs automatically after a tagged release (called from release.yml), and can be +# run by hand from the Actions tab to (re)publish an existing release tag. +# +# Auth is GitHub OIDC: the registry trusts tokens from this repository for the +# io.github.Screenly/* namespace, so no secret or org Owner is needed. + +name: Publish to MCP Registry + +on: + workflow_call: + inputs: + tag: + description: "Release tag to publish, e.g. v26.11.0" + required: true + type: string + workflow_dispatch: + inputs: + tag: + description: "Existing release tag to publish, e.g. v26.11.0" + required: true + type: string + +permissions: + contents: read + +concurrency: + group: mcp-registry + cancel-in-progress: false + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # OIDC login to the MCP Registry + env: + TAG: ${{ inputs.tag }} + MCP_PUBLISHER_VERSION: v1.8.9 + GH_TOKEN: ${{ github.token }} + steps: + # Checks out the ref the workflow runs on (the tag on release, or the chosen + # branch on a manual run), so older tags without mcpb/server.json still work. + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build server.json for this release + shell: bash + run: | + set -euo pipefail + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then + echo "Tag must be semver like v1.2.3, got: $TAG" >&2 + exit 1 + fi + version="${TAG#v}" + base="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}" + + # Must match the mcpb_alias values in release.yml. + aliases=(macos-arm64 macos-x64 windows-x64) + + mkdir -p dist + for alias in "${aliases[@]}"; do + gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \ + --dir dist --pattern "screenly-${alias}.mcpb" + done + + packages='[]' + for alias in "${aliases[@]}"; do + file="screenly-${alias}.mcpb" + sha="$(sha256sum "dist/${file}" | cut -d' ' -f1)" + packages="$(jq -c --arg id "${base}/${file}" --arg sha "$sha" \ + '. + [{registryType: "mcpb", identifier: $id, fileSha256: $sha, transport: {type: "stdio"}}]' \ + <<<"$packages")" + done + + jq --arg version "$version" --argjson packages "$packages" \ + '.version = $version | .packages = $packages' \ + mcpb/server.json > server.json + cat server.json + + - name: Install cosign + uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 + + - name: Download and verify mcp-publisher + shell: bash + run: | + set -euo pipefail + archive="mcp-publisher_linux_amd64.tar.gz" + base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}" + curl --fail --location --silent --show-error --output "$archive" "$base_url/$archive" + curl --fail --location --silent --show-error --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json" + cosign verify-blob \ + --bundle "$archive.sigstore.json" \ + --certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \ + --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \ + "$archive" + tar xzf "$archive" mcp-publisher + rm -f "$archive" "$archive.sigstore.json" + + - name: Validate server.json + run: ./mcp-publisher validate + + - name: Log in to the MCP Registry + run: ./mcp-publisher login github-oidc + + - name: Publish + run: ./mcp-publisher publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 115810a..2b771d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -157,6 +157,16 @@ jobs: with: subject-path: "${{ github.workspace }}/screenly*" + publish-mcp-registry: + name: mcp-registry + needs: build-release + permissions: + contents: read + id-token: write + uses: ./.github/workflows/mcp-registry.yml + with: + tag: ${{ github.ref_name }} + build-docker-image: environment: master name: docker diff --git a/mcpb/server.json b/mcpb/server.json new file mode 100644 index 0000000..3a68cb6 --- /dev/null +++ b/mcpb/server.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json", + "name": "io.github.Screenly/screenly", + "title": "Screenly", + "description": "Manage Screenly digital signage: screens, playlists, assets, labels and Edge Apps.", + "repository": { + "url": "https://github.com/Screenly/cli", + "source": "github" + }, + "websiteUrl": "https://www.screenly.io/docs/developers/mcp/", + "version": "0.0.0", + "packages": [] +} From 372beb39be229462cb77c96d8df263bc878f92fb Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Thu, 19 Nov 2026 14:05:18 +0530 Subject: [PATCH 2/3] MCP registry: harden publish workflow after review - Skip prerelease tags; only stable vX.Y.Z versions are published - Run after build-release even if an unrelated matrix leg failed; the job fails loudly if a .mcpb asset is missing - Read server.json metadata from the release tag when it exists - Per-tag concurrency group so queued runs don't cancel each other - Pin actions/checkout to a commit SHA in the id-token job - Download all bundles in a single gh release download call --- .github/workflows/mcp-registry.yml | 32 ++++++++++++++++++++---------- .github/workflows/release.yml | 4 ++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/mcp-registry.yml b/.github/workflows/mcp-registry.yml index cf74e73..03c8126 100644 --- a/.github/workflows/mcp-registry.yml +++ b/.github/workflows/mcp-registry.yml @@ -27,7 +27,7 @@ permissions: contents: read concurrency: - group: mcp-registry + group: mcp-registry-${{ inputs.tag }} cancel-in-progress: false jobs: @@ -42,17 +42,17 @@ jobs: MCP_PUBLISHER_VERSION: v1.8.9 GH_TOKEN: ${{ github.token }} steps: - # Checks out the ref the workflow runs on (the tag on release, or the chosen - # branch on a manual run), so older tags without mcpb/server.json still work. - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - name: Build server.json for this release shell: bash run: | set -euo pipefail - if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then - echo "Tag must be semver like v1.2.3, got: $TAG" >&2 + # Stable releases only: registry versions are permanent, and a prerelease + # could show up as the newest version in MCP directories. + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Tag must be a stable release like v1.2.3, got: $TAG" >&2 exit 1 fi version="${TAG#v}" @@ -61,11 +61,23 @@ jobs: # Must match the mcpb_alias values in release.yml. aliases=(macos-arm64 macos-x64 windows-x64) - mkdir -p dist + # Use the metadata committed at the release tag, so a manual run from + # another branch can't publish metadata that never shipped. Older tags + # predate mcpb/server.json and fall back to the checked-out copy. + git fetch --quiet --depth=1 origin "refs/tags/${TAG}:refs/tags/${TAG}" + if git show "${TAG}:mcpb/server.json" > template.json 2>/dev/null; then + echo "Using mcpb/server.json from ${TAG}" + else + echo "${TAG} has no mcpb/server.json; using the checked-out copy" + cp mcpb/server.json template.json + fi + + patterns=() for alias in "${aliases[@]}"; do - gh release download "$TAG" --repo "$GITHUB_REPOSITORY" \ - --dir dist --pattern "screenly-${alias}.mcpb" + patterns+=(--pattern "screenly-${alias}.mcpb") done + mkdir -p dist + gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir dist "${patterns[@]}" packages='[]' for alias in "${aliases[@]}"; do @@ -78,7 +90,7 @@ jobs: jq --arg version "$version" --argjson packages "$packages" \ '.version = $version | .packages = $packages' \ - mcpb/server.json > server.json + template.json > server.json cat server.json - name: Install cosign diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b771d1..e08a0ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -160,6 +160,10 @@ jobs: publish-mcp-registry: name: mcp-registry needs: build-release + # Run even if an unrelated matrix leg (e.g. linux-armhf) failed: the publish + # job downloads the .mcpb assets and fails loudly if any are missing. + # Prerelease tags (v1.2.3-rc1) are not published to the registry. + if: ${{ !cancelled() && !contains(github.ref_name, '-') }} permissions: contents: read id-token: write From 34cb7872e239b4ce92833bf8721c7f163865794d Mon Sep 17 00:00:00 2001 From: Salman Faris Date: Thu, 19 Nov 2026 14:06:56 +0530 Subject: [PATCH 3/3] MCP registry: only publish the expected name and repository Addresses Copilot review: fail before OIDC login if server.json's name or repository.url differs from the fixed values, so an edited file can't publish over another io.github.Screenly/* entry. --- .github/workflows/mcp-registry.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/mcp-registry.yml b/.github/workflows/mcp-registry.yml index 03c8126..f019f25 100644 --- a/.github/workflows/mcp-registry.yml +++ b/.github/workflows/mcp-registry.yml @@ -39,6 +39,9 @@ jobs: id-token: write # OIDC login to the MCP Registry env: TAG: ${{ inputs.tag }} + # The only registry entry this workflow may publish. Checked before login. + EXPECTED_NAME: io.github.Screenly/screenly + EXPECTED_REPO: https://github.com/Screenly/cli MCP_PUBLISHER_VERSION: v1.8.9 GH_TOKEN: ${{ github.token }} steps: @@ -91,6 +94,17 @@ jobs: jq --arg version "$version" --argjson packages "$packages" \ '.version = $version | .packages = $packages' \ template.json > server.json + + # Refuse to publish under any other name or repository, so an edited + # server.json can't use this repo's OIDC identity to overwrite another + # io.github.Screenly/* entry. + name="$(jq -r '.name' server.json)" + repo="$(jq -r '.repository.url' server.json)" + if [[ "$name" != "$EXPECTED_NAME" || "$repo" != "$EXPECTED_REPO" ]]; then + echo "Refusing to publish: name=$name repository=$repo" >&2 + echo "Expected name=$EXPECTED_NAME repository=$EXPECTED_REPO" >&2 + exit 1 + fi cat server.json - name: Install cosign