From 8eb05f0888c3b41d19d4dd3acf1b70b4591c730a Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 2 Jul 2026 23:35:30 +0300 Subject: [PATCH 1/3] chore: add workflow to auto-update server.json on release --- .github/workflows/update-server-json.yml | 112 +++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .github/workflows/update-server-json.yml diff --git a/.github/workflows/update-server-json.yml b/.github/workflows/update-server-json.yml new file mode 100644 index 0000000..ad3ce8e --- /dev/null +++ b/.github/workflows/update-server-json.yml @@ -0,0 +1,112 @@ +name: Update server.json & publish to MCP Registry + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-server-json: + name: Update server.json with new version + runs-on: ubuntu-24.04 + steps: + - name: Checkout repo + uses: actions/checkout@v7 + + - name: Extract version from release tag + id: version + run: | + # Strip leading 'v' from tag name (e.g. v0.1.6 -> 0.1.6) + TAG="${{ github.event.release.tag_name }}" + if [ -z "$TAG" ]; then + # For workflow_dispatch, use latest git tag + TAG="$(git describe --tags --abbrev=0)" + fi + VERSION="${TAG#v}" + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Show extracted version + run: | + echo "Tag: ${{ steps.version.outputs.tag }}" + echo "Version: ${{ steps.version.outputs.version }}" + + - name: Update server.json + run: | + VERSION="${{ steps.version.outputs.version }}" + echo "Updating server.json version to $VERSION" + + # Update both root and package version in one pass + 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: Commit and push changes + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add server.json + if git diff --cached --quiet; then + echo "No changes to server.json — skipping commit." + exit 0 + fi + + VERSION="${{ steps.version.outputs.version }}" + git commit -m "chore: bump server.json version to $VERSION" + git push + + - name: Validate server.json against MCP schema + run: | + # Basic JSON validity check + jq empty server.json && echo "✓ server.json is valid JSON" + + # Check required fields + REQUIRED_FIELDS="name title description version" + for field in $REQUIRED_FIELDS; do + if jq -e ".$field" server.json > /dev/null 2>&1; then + echo "✓ field '$field' present" + else + echo "✗ field '$field' missing!" + exit 1 + fi + done + + # Optional: publish to the official MCP Registry API + # Uncomment and configure secrets/MCP_REGISTRY_API_KEY to enable. + # + # publish-mcp-registry: + # name: Publish to MCP Registry + # needs: update-server-json + # runs-on: ubuntu-24.04 + # if: ${{ secrets.MCP_REGISTRY_API_KEY != '' }} + # permissions: + # contents: read + # steps: + # - uses: actions/checkout@v7 + # + # - name: Extract version + # id: version + # run: | + # TAG="${{ github.event.release.tag_name }}" + # VERSION="${TAG#v}" + # echo "version=$VERSION" >> "$GITHUB_OUTPUT" + # + # - name: Publish to MCP Registry + # run: | + # curl -X POST https://registry.modelcontextprotocol.io/api/v1/servers \ + # -H "Authorization: Bearer ${{ secrets.MCP_REGISTRY_API_KEY }}" \ + # -H "Content-Type: application/json" \ + # -d @server.json + # + # - name: Publish to Glama.ai + # run: | + # curl -X POST https://glama.ai/api/mcp/servers \ + # -H "Authorization: Bearer ${{ secrets.GLAMA_API_KEY }}" \ + # -H "Content-Type: application/json" \ + # -d @server.json From 480d7361e67f26b826ea601a16635babde961b17 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 2 Jul 2026 23:41:12 +0300 Subject: [PATCH 2/3] fix: switch to mcp-publisher CLI with OIDC auth per official best practices --- .github/workflows/update-server-json.yml | 90 ++++-------------------- 1 file changed, 13 insertions(+), 77 deletions(-) diff --git a/.github/workflows/update-server-json.yml b/.github/workflows/update-server-json.yml index ad3ce8e..4169f22 100644 --- a/.github/workflows/update-server-json.yml +++ b/.github/workflows/update-server-json.yml @@ -1,4 +1,4 @@ -name: Update server.json & publish to MCP Registry +name: Publish to MCP Registry on: release: @@ -6,11 +6,12 @@ on: workflow_dispatch: permissions: - contents: write + contents: read + id-token: write # Required for OIDC authentication with MCP Registry jobs: - update-server-json: - name: Update server.json with new version + publish: + name: Publish server.json to MCP Registry runs-on: ubuntu-24.04 steps: - name: Checkout repo @@ -19,94 +20,29 @@ jobs: - name: Extract version from release tag id: version run: | - # Strip leading 'v' from tag name (e.g. v0.1.6 -> 0.1.6) TAG="${{ github.event.release.tag_name }}" if [ -z "$TAG" ]; then - # For workflow_dispatch, use latest git tag TAG="$(git describe --tags --abbrev=0)" fi VERSION="${TAG#v}" echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Show extracted version - run: | - echo "Tag: ${{ steps.version.outputs.tag }}" - echo "Version: ${{ steps.version.outputs.version }}" - - - name: Update server.json + - name: Set version in server.json run: | VERSION="${{ steps.version.outputs.version }}" - echo "Updating server.json version to $VERSION" - - # Update both root and package version in one pass + 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: Commit and push changes - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - git add server.json - if git diff --cached --quiet; then - echo "No changes to server.json — skipping commit." - exit 0 - fi - - VERSION="${{ steps.version.outputs.version }}" - git commit -m "chore: bump server.json version to $VERSION" - git push - - - name: Validate server.json against MCP schema + - name: Install mcp-publisher run: | - # Basic JSON validity check - jq empty server.json && echo "✓ server.json is valid JSON" + 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 - # Check required fields - REQUIRED_FIELDS="name title description version" - for field in $REQUIRED_FIELDS; do - if jq -e ".$field" server.json > /dev/null 2>&1; then - echo "✓ field '$field' present" - else - echo "✗ field '$field' missing!" - exit 1 - fi - done + - name: Authenticate to MCP Registry (OIDC) + run: ./mcp-publisher login github-oidc - # Optional: publish to the official MCP Registry API - # Uncomment and configure secrets/MCP_REGISTRY_API_KEY to enable. - # - # publish-mcp-registry: - # name: Publish to MCP Registry - # needs: update-server-json - # runs-on: ubuntu-24.04 - # if: ${{ secrets.MCP_REGISTRY_API_KEY != '' }} - # permissions: - # contents: read - # steps: - # - uses: actions/checkout@v7 - # - # - name: Extract version - # id: version - # run: | - # TAG="${{ github.event.release.tag_name }}" - # VERSION="${TAG#v}" - # echo "version=$VERSION" >> "$GITHUB_OUTPUT" - # - # - name: Publish to MCP Registry - # run: | - # curl -X POST https://registry.modelcontextprotocol.io/api/v1/servers \ - # -H "Authorization: Bearer ${{ secrets.MCP_REGISTRY_API_KEY }}" \ - # -H "Content-Type: application/json" \ - # -d @server.json - # - # - name: Publish to Glama.ai - # run: | - # curl -X POST https://glama.ai/api/mcp/servers \ - # -H "Authorization: Bearer ${{ secrets.GLAMA_API_KEY }}" \ - # -H "Content-Type: application/json" \ - # -d @server.json + - name: Publish server to MCP Registry + run: ./mcp-publisher publish From b5638bf75595de36a32118ecf169833f63ecdbe2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 2 Jul 2026 23:54:34 +0300 Subject: [PATCH 3/3] chore: rename update-server-json.yml to publish-mcp-registry.yml --- .../{update-server-json.yml => publish-mcp-registry.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{update-server-json.yml => publish-mcp-registry.yml} (100%) diff --git a/.github/workflows/update-server-json.yml b/.github/workflows/publish-mcp-registry.yml similarity index 100% rename from .github/workflows/update-server-json.yml rename to .github/workflows/publish-mcp-registry.yml