fix: repair MCP Registry publishing and automate it on release (#3097)

This commit is contained in:
Enes Gules
2026-08-28 12:16:10 +03:00
committed by GitHub
parent 8fa6c6b9d2
commit 0e96f6ebcf
3 changed files with 32 additions and 36 deletions
+16 -17
View File
@@ -4,9 +4,10 @@ on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (defaults to package.json version)"
description: "Version to publish (defaults to packages/mcp/package.json version)"
required: false
type: string
workflow_call:
jobs:
publish-mcp:
@@ -24,31 +25,29 @@ jobs:
with:
node-version: lts/*
- name: Set version
- name: Set version in server.json
run: |
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
# Remove 'v' prefix if it exists
VERSION="${VERSION#v}"
else
VERSION="${{ inputs.version }}"
VERSION="${VERSION#v}"
if [ -z "$VERSION" ]; then
VERSION=$(node -p "require('./packages/mcp/package.json').version")
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Publishing version: $VERSION"
- name: Update package version in server.json
run: |
echo $(jq --arg v "${{ env.VERSION }}" '.version = $v | .packages[0].version = $v' server.json) > server.json
- name: Validate server.json
run: npx mcp-registry-validator validate server.json
jq --arg v "$VERSION" '.version = $v | .packages[].version = $v' server.json > server.tmp && mv server.tmp server.json
- name: Install MCP Publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.4.0/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
- name: Login to MCP Registry
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish
# Retry to tolerate npm propagation delay when chained after a release
run: |
for i in 1 2 3; do
./mcp-publisher publish && exit 0
echo "Publish failed (attempt $i), retrying in 30s..."
sleep 30
done
exit 1
+14
View File
@@ -14,6 +14,9 @@ jobs:
permissions:
contents: write
pull-requests: write
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
steps:
- name: Checkout Repo
uses: actions/checkout@v7
@@ -48,3 +51,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-mcp-registry:
name: Publish to MCP Registry
needs: release
# changesets pushes tags with GITHUB_TOKEN, which cannot trigger other
# workflows — so the registry publish must chain off this job directly.
if: needs.release.outputs.published == 'true' && contains(needs.release.outputs.publishedPackages, '"@upstash/context7-mcp"')
permissions:
id-token: write
contents: read
uses: ./.github/workflows/mcp-registry.yml
+2 -19
View File
@@ -14,29 +14,12 @@
"mimeType": "image/png"
}
],
"version": "2.0.0",
"version": "4.0.3",
"packages": [
{
"registryType": "npm",
"identifier": "@upstash/context7-mcp",
"version": "2.0.2",
"transport": {
"type": "stdio"
},
"environmentVariables": [
{
"name": "CONTEXT7_API_KEY",
"description": "API key for authentication",
"isRequired": false,
"isSecret": true
}
]
},
{
"registryType": "mcpb",
"identifier": "https://github.com/upstash/context7/releases/download/@upstash/context7-mcp@2.0.2/context7.mcpb",
"version": "2.0.2",
"fileSha256": "aea76f179ceb92d22c289147c9d8343fb558d6dec93b144c9794e99239bb8194",
"version": "4.0.3",
"transport": {
"type": "stdio"
},