From e6ddd44235b198424f5fe9e1c2a44c2fb58526d9 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Mon, 6 Jul 2026 22:47:06 +0300 Subject: [PATCH] fix: resolve MCP registry publish race condition by merging into publish workflow The MCP registry publish workflow (publish-mcp-registry.yml) ran concurrently with the PyPI publish workflow on release events. The MCP Registry validates that the PyPI package exists before accepting the server.json, but due to the race condition it got a 404. Fix by merging the MCP registry publishing as a dependent job (needs: publish) into publish.yml, ensuring PyPI upload completes before the MCP Registry validation runs. Removed the standalone publish-mcp-registry.yml to avoid duplicate triggers. --- .github/workflows/publish-mcp-registry.yml | 48 ---------------------- .github/workflows/publish.yml | 43 ++++++++++++++++++- 2 files changed, 42 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/publish-mcp-registry.yml diff --git a/.github/workflows/publish-mcp-registry.yml b/.github/workflows/publish-mcp-registry.yml deleted file mode 100644 index 4169f22..0000000 --- a/.github/workflows/publish-mcp-registry.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Publish to MCP Registry - -on: - release: - types: [published] - workflow_dispatch: - -permissions: - contents: read - id-token: write # Required for OIDC authentication with MCP Registry - -jobs: - publish: - name: Publish server.json to MCP Registry - runs-on: ubuntu-24.04 - steps: - - name: Checkout repo - uses: actions/checkout@v7 - - - name: Extract version from release tag - id: version - run: | - TAG="${{ github.event.release.tag_name }}" - if [ -z "$TAG" ]; then - TAG="$(git describe --tags --abbrev=0)" - fi - VERSION="${TAG#v}" - echo "tag=$TAG" >> "$GITHUB_OUTPUT" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Set version in server.json - run: | - VERSION="${{ steps.version.outputs.version }}" - echo "Setting server.json version to $VERSION" - jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.json.tmp - mv server.json.tmp server.json - echo "=== Updated server.json ===" - cat server.json - - - name: Install mcp-publisher - run: | - 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: Authenticate to MCP Registry (OIDC) - run: ./mcp-publisher login github-oidc - - - name: Publish server to MCP Registry - run: ./mcp-publisher publish diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bf4975d..8198943 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish to PyPI +name: Publish to PyPI and MCP Registry on: release: @@ -72,3 +72,44 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 + + publish-mcp-registry: + name: Publish server.json to MCP Registry + needs: publish + runs-on: ubuntu-24.04 + permissions: + contents: read + id-token: write # Required for OIDC authentication with MCP Registry + steps: + - name: Checkout repo + uses: actions/checkout@v7 + + - name: Extract version from release tag + id: version + run: | + TAG="${{ github.event.release.tag_name }}" + if [ -z "$TAG" ]; then + TAG="$(git describe --tags --abbrev=0)" + fi + VERSION="${TAG#v}" + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Set version in server.json + run: | + VERSION="${{ steps.version.outputs.version }}" + echo "Setting server.json version to $VERSION" + jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.json.tmp + mv server.json.tmp server.json + echo "=== Updated server.json ===" + cat server.json + + - name: Install mcp-publisher + run: | + 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: Authenticate to MCP Registry (OIDC) + run: ./mcp-publisher login github-oidc + + - name: Publish server to MCP Registry + run: ./mcp-publisher publish