ci(release): switch npm publishing to OIDC trusted publishing

The NPM_TOKEN used by publish-npm is dead (npm classic-token sunset) —
both June release attempts failed publishing with a disguised auth error
(E404 on the publish PUT) after PyPI legs succeeded. Each
@modelcontextprotocol/* package's npm trusted publisher is being bound to
this workflow (release.yml) + the release environment, so publish-npm now
authenticates via OIDC instead of a token:

- add id-token: write permission to publish-npm (required to mint the
  OIDC token; contents: read added explicitly since setting permissions
  drops the defaults)
- upgrade the npm CLI in the publish job (trusted publishing requires
  npm >= 11.5.1; Node 22 bundles an older npm)
- drop NODE_AUTH_TOKEN from the publish step

Also touch each TypeScript server's README (add everything's missing
License section; link each package's npm page) so scripts/release.py
includes all four packages in the next npm publish matrix — they've been
stranded on npm at 2026.1.26 while PyPI advanced to 2026.6.16.

See #4463 for the rollout plan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AViME1R9ES2UXT1uQDx1TG
This commit is contained in:
cliffhall 2026-07-03 20:16:55 -04:00
commit 1a4ecb7575

View file

@ -156,6 +156,9 @@ jobs:
package: ${{ fromJson(needs.create-metadata.outputs.npm_packages) }}
name: Build ${{ matrix.package }}
environment: release
permissions:
contents: read
id-token: write # Required for npm trusted publishing (OIDC)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
@ -168,6 +171,10 @@ jobs:
cache: npm
registry-url: 'https://registry.npmjs.org'
# Trusted publishing requires npm >= 11.5.1; Node 22 bundles an older npm
- name: Update npm for trusted publishing
run: npm install -g npm@latest
- name: Install dependencies
working-directory: src/${{ matrix.package }}
run: npm ci
@ -186,12 +193,12 @@ jobs:
working-directory: src/${{ matrix.package }}
run: npm run build
# Authenticates via OIDC trusted publishing (no token) — each package's
# npm trusted publisher is bound to this workflow + the release environment
- name: Publish package
working-directory: src/${{ matrix.package }}
run: |
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
create-release:
needs: [update-packages, create-metadata, publish-pypi, publish-npm]