Publish to MCP Registry #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to MCP Registry | |
| # Two ways in: | |
| # 1. workflow_call — the release train (release.yml) invokes this right | |
| # after its npm-publish job, so a tag push now publishes to the MCP | |
| # Registry automatically. The registry validates that the npm package | |
| # at `version` already exists, which is why it's chained *after* | |
| # npm-publish, never racing it. | |
| # 2. workflow_dispatch — kept for manual re-pushes (e.g. re-registering a | |
| # version whose metadata changed) without cutting a new release. Run | |
| # with: gh workflow run publish-mcp-registry.yml -f version=0.2.0 | |
| # Either accepts the version with or without a leading `v` (the release | |
| # train passes the raw tag, e.g. `v0.2.0`); the job strips it. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version already published to npm as @eilodon/calm-mcp (e.g. 0.2.0)' | |
| required: true | |
| workflow_call: | |
| inputs: | |
| version: | |
| description: 'Tag or version already published to npm (e.g. v0.2.0 or 0.2.0)' | |
| required: true | |
| type: string | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # required for OIDC auth to the registry | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - name: Set version in server.json | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| run: | | |
| VERSION="${VERSION#v}" # accept both `v0.2.0` (release train) and `0.2.0` | |
| jq --arg v "$VERSION" \ | |
| '.version = $v | .packages[0].version = $v' \ | |
| server.json > server.tmp.json | |
| mv server.tmp.json 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 (GitHub OIDC — this repo's identity, no stored secret) | |
| run: ./mcp-publisher login github-oidc | |
| - name: Publish server.json to the MCP Registry | |
| run: ./mcp-publisher publish | |
| - name: Verify | |
| run: | | |
| sleep 2 | |
| curl -fsSL "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.Eilodon/calm-mcp" |