Context7 Platform -- Up-to-date docs for AI agents
fix: repair MCP Registry publishing and automate it on release (#3097)
Enes Gules0e96f6ebcf09
diff --git a/.github/workflows/mcp-registry.yml b/.github/workflows/mcp-registry.ymlindex b5adecf4..1e341344 100644--- a/.github/workflows/mcp-registry.yml+++ b/.github/workflows/mcp-registry.yml@@ -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: falsetype: string+ workflow_call:jobs:publish-mcp:@@ -24,31 +25,29 @@ jobs:with:node-version: lts/*- - name: Set version+ - name: Set version in server.jsonrun: |- 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" ]; thenVERSION=$(node -p "require('./packages/mcp/package.json').version")fi- echo "VERSION=$VERSION" >> $GITHUB_ENVecho "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 Publisherrun: |- 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 Registryrun: ./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 1diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex dd7e22e8..188e09b8 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -14,6 +14,9 @@ jobs:permissions:contents: writepull-requests: write+ outputs:+ published: ${{ steps.changesets.outputs.published }}+ publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}steps:- name: Checkout Repouses: 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.ymldiff --git a/server.json b/server.jsonindex 75b79240..946317df 100644--- a/server.json+++ b/server.json@@ -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/[email protected]/context7.mcpb",- "version": "2.0.2",- "fileSha256": "aea76f179ceb92d22c289147c9d8343fb558d6dec93b144c9794e99239bb8194",+ "version": "4.0.3","transport": {"type": "stdio"},