|
99 | 99 | # Automatically generates PEP 740 attestations (like npm provenance) |
100 | 100 | - name: Publish to PyPI |
101 | 101 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 102 | + |
| 103 | + # Job 4: Publish to MCP Registry |
| 104 | + # Runs after successful PyPI publication |
| 105 | + publish-to-mcp-registry: |
| 106 | + name: Publish to MCP Registry |
| 107 | + needs: [publish-to-pypi] |
| 108 | + runs-on: ubuntu-latest |
| 109 | + |
| 110 | + # Required permission for OIDC authentication with MCP Registry |
| 111 | + permissions: |
| 112 | + id-token: write |
| 113 | + contents: read |
| 114 | + |
| 115 | + steps: |
| 116 | + # Check out the repository to access server.json |
| 117 | + - name: Check out repository |
| 118 | + uses: actions/checkout@v4 |
| 119 | + |
| 120 | + # Extract version from git tag (removes 'v' prefix) |
| 121 | + # e.g., v0.1.1 -> 0.1.1 |
| 122 | + - name: Extract version from tag |
| 123 | + id: version |
| 124 | + run: | |
| 125 | + VERSION=${GITHUB_REF#refs/tags/v} |
| 126 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 127 | + echo "Publishing version: $VERSION" |
| 128 | +
|
| 129 | + # Update server.json with the current version |
| 130 | + # This ensures the MCP registry knows which PyPI version to use |
| 131 | + - name: Update server.json version |
| 132 | + run: | |
| 133 | + VERSION="${{ steps.version.outputs.version }}" |
| 134 | + # Update both top-level version and package version |
| 135 | + sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" server.json |
| 136 | + echo "Updated server.json:" |
| 137 | + cat server.json |
| 138 | +
|
| 139 | + # Install MCP Publisher CLI |
| 140 | + # Downloads the latest release from GitHub |
| 141 | + - name: Install MCP Publisher |
| 142 | + run: | |
| 143 | + curl -fsSL https://github.com/modelcontextprotocol/publisher/releases/latest/download/mcp-publisher-linux-amd64 -o mcp-publisher |
| 144 | + chmod +x mcp-publisher |
| 145 | + ./mcp-publisher --version |
| 146 | +
|
| 147 | + # Authenticate with GitHub using OIDC |
| 148 | + # No secrets needed - uses GitHub's identity token |
| 149 | + - name: Login to MCP Registry |
| 150 | + run: ./mcp-publisher login github-oidc |
| 151 | + |
| 152 | + # Publish the server to the MCP Registry |
| 153 | + # This makes it discoverable at registry.modelcontextprotocol.io |
| 154 | + - name: Publish to MCP Registry |
| 155 | + run: ./mcp-publisher publish |
0 commit comments