# MCP Registry(registry.modelcontextprotocol.io)へ server.json を公開する。 # 組織名前空間 io.github.JasmyLab-JANCTION/* は GitHub Actions の OIDC でだけ取れる(個人の端末からの device login では # 個人名前空間しか付かない)。タグ v* の push で走る(PyPI の publish.yml と同時)ほか、Actions 画面/gh から手動でも走らせられる。 # 先に PyPI に同じ版が上がっていること(server.json の packages[].version と一致)。 name: mcp-registry on: push: tags: ["v*"] workflow_dispatch: jobs: publish: runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - uses: actions/checkout@v7 - name: Install mcp-publisher run: | curl -fsSL "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 ./mcp-publisher --version # 11/19: 登録簿の版は PyPI のパッケージの版。publish.yml が「クライアントに変化なし」で上げなかったタグでは登録簿も更新しない - uses: actions/setup-python@v7 with: python-version: "3.12" - name: Did the client change? (tag push only) id: diff if: github.event_name == 'push' run: python -m pip install -U pip build && python -m build --wheel && python scripts/client_changed.py dist/*.whl - name: Wait for the PyPI release to be visible (tag push only) if: github.event_name == 'push' && steps.diff.outputs.changed == 'true' run: | V=$(python3 -c "import json;print(json.load(open('server.json'))['packages'][0]['version'])") for i in $(seq 1 30); do curl -fsS "https://pypi.org/pypi/janction-render/$V/json" >/dev/null && exit 0 sleep 20 done echo "janction-render $V not on PyPI yet" >&2; exit 1 - name: Login (GitHub OIDC) if: github.event_name != 'push' || steps.diff.outputs.changed == 'true' run: ./mcp-publisher login github-oidc # PyPI の JSON に出ても、Registry 側の検査はしばらく「その版が無い」と 400 を返す(0.4.119〜0.4.121 が 3 回続けて落ちた、10/15)。 # 1 分おきに 10 回までやり直す - name: Publish if: github.event_name != 'push' || steps.diff.outputs.changed == 'true' run: | for i in $(seq 1 10); do ./mcp-publisher publish && exit 0 echo "publish failed (try $i), retrying in 60 s" >&2 sleep 60 done exit 1