Skip to content

Commit 5001ff9

Browse files
EslaM-XEslaM-X
andauthored
fix(release): support MCP_REGISTRY_GITHUB_TOKEN fallback for non-OIDC namespaces (#127)
Co-authored-by: EslaM-X <eslam@coreguard.dev>
1 parent 7c159d0 commit 5001ff9

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,21 @@ jobs:
5858
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5959
run: node scripts/release-please.mjs
6060

61-
- name: Publish MCP registry (GitHub OIDC - no MCP registry secret required)
61+
- name: Publish MCP registry (OIDC preferred; fallback secret MCP_REGISTRY_GITHUB_TOKEN)
6262
env:
63-
# Exact secret name required for MCP registry publishing: NONE.
64-
# This workflow uses GitHub OIDC (id-token: write) for MCP registry auth.
65-
# The only repository/environment secret required by this workflow is NPM_TOKEN.
63+
# Exact secret name for MCP registry publishing:
64+
# - Preferred: NONE when GitHub OIDC can publish the namespace in server.json.
65+
# - Fallback: MCP_REGISTRY_GITHUB_TOKEN (GitHub PAT with permission to publish
66+
# the server namespace) when OIDC cannot publish that namespace.
67+
# The only always-required repository/environment secret in this workflow is NPM_TOKEN.
6668
MCP_PUBLISHER_VERSION: ${{ env.MCP_PUBLISHER_VERSION }}
69+
MCP_REGISTRY_GITHUB_TOKEN: ${{ secrets.MCP_REGISTRY_GITHUB_TOKEN }}
6770
run: |
6871
set -euo pipefail
6972
PKG_VERSION=$(node -p "require('./packages/agent-commerce/package.json').version")
7073
SERVER_VERSION=$(node -p "require('./packages/agent-commerce/server.json').version")
7174
PKG0_VERSION=$(node -p "require('./packages/agent-commerce/server.json').packages[0].version")
75+
SERVER_NAME=$(node -p "require('./packages/agent-commerce/server.json').name")
7276
if [ "$PKG_VERSION" != "$SERVER_VERSION" ] || [ "$PKG_VERSION" != "$PKG0_VERSION" ]; then
7377
echo "refusing: agent-commerce version mismatch package=$PKG_VERSION server=$SERVER_VERSION package0=$PKG0_VERSION"
7478
exit 1
@@ -90,6 +94,12 @@ jobs:
9094
tar -xzf /tmp/mcp-publisher.tar.gz -C /tmp mcp-publisher
9195
chmod +x /tmp/mcp-publisher
9296
cd packages/agent-commerce
93-
/tmp/mcp-publisher login github-oidc
97+
if [ -n "${MCP_REGISTRY_GITHUB_TOKEN:-}" ]; then
98+
echo "MCP registry auth: using MCP_REGISTRY_GITHUB_TOKEN for namespace $SERVER_NAME"
99+
/tmp/mcp-publisher login github --token "$MCP_REGISTRY_GITHUB_TOKEN"
100+
else
101+
echo "MCP registry auth: using GitHub OIDC (no MCP registry secret). If this namespace is not covered by repo OIDC, configure secret MCP_REGISTRY_GITHUB_TOKEN."
102+
/tmp/mcp-publisher login github-oidc
103+
fi
94104
/tmp/mcp-publisher publish
95-
echo "MCP registry publish completed for @coreguard/agent-commerce@$PKG_VERSION"
105+
echo "MCP registry publish completed for @coreguard/agent-commerce@$PKG_VERSION ($SERVER_NAME)"

‎docs/owner-execution/MCP-REGISTRY-SUBMISSION-PACK.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ node packages/agent-commerce/mcp.mjs
5252

5353
**Rule.** Authenticate to the registry with the **GitHub device flow** (`mcp-publisher login github`) or, in CI, with **GitHub OIDC**. If a token is genuinely unavoidable, use a **fine-grained PAT** scoped to this single task — profile read only, no repository or organization permissions, shortest practical expiry — and treat it as disposable.
5454

55-
**Release workflow automation (exact secret name).** `.github/workflows/release.yml` now publishes the MCP registry entry after a successful npm publish. It uses **GitHub OIDC** (`permissions: id-token: write`) and verifies the `mcp-publisher` Sigstore bundle before publishing. **Exact secret name required for MCP registry publishing: none.** The only repository/environment secret required by that workflow is **`NPM_TOKEN`** (npm publish). Do not add an MCP registry PAT unless you intentionally switch away from OIDC; if that ever happens, use a dedicated least-privilege secret name such as `MCP_REGISTRY_GITHUB_TOKEN` and keep it separate from `NPM_TOKEN`.
55+
**Release workflow automation (exact secret name).** `.github/workflows/release.yml` now publishes the MCP registry entry after a successful npm publish. It verifies the `mcp-publisher` Sigstore bundle before publishing. **Exact secret name required for MCP registry publishing:** **`MCP_REGISTRY_GITHUB_TOKEN`** only when GitHub OIDC cannot publish the server namespace in `packages/agent-commerce/server.json`; otherwise **none** (GitHub OIDC, `permissions: id-token: write`). The only always-required repository/environment secret in that workflow is **`NPM_TOKEN`** (npm publish). Keep `MCP_REGISTRY_GITHUB_TOKEN` separate from `NPM_TOKEN`, least-privilege, and use it only for the MCP registry namespace that needs it.
5656

5757
**Why this note exists.** The 0.1.3 republication on 2026-11-22 exchanged a **classic** personal access token through `POST /v0/auth/github-at`. That token carried broad scopes, including `admin:org`, `delete_repo`, `repo` and `workflow`. It was transmitted only over HTTPS to `registry.modelcontextprotocol.io` and was never written into the repository, a log file, or this document — but a credential with that blast radius should not authorize a directory write. A classic token is also the wrong shape for the registry: it cannot be limited to "publish this one server".
5858

‎docs/releases/0.1.5.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
## What changed
44

55
- **Published tarball now includes `server.json`**. The MCP registry manifest is part of the npm package files, and `scripts/publish-check.mjs` fails closed if `server.json` is missing, malformed, or version-mismatched with `package.json`.
6-
- **MCP registry publishing is automated in the release workflow**. After a successful npm publish, `.github/workflows/release.yml` verifies the published npm version, downloads and Sigstore-verifies `mcp-publisher`, authenticates with GitHub OIDC, and publishes `packages/agent-commerce/server.json`.
7-
- **No new MCP registry secret is required.** The workflow uses GitHub OIDC (`id-token: write`). The only repository/environment secret required by the release workflow remains `NPM_TOKEN`.
6+
- **MCP registry publishing is automated in the release workflow**. After a successful npm publish, `.github/workflows/release.yml` verifies the published npm version, downloads and Sigstore-verifies `mcp-publisher`, authenticates with GitHub OIDC (preferred) or `MCP_REGISTRY_GITHUB_TOKEN` when OIDC cannot publish the configured namespace, and publishes `packages/agent-commerce/server.json`.
7+
- **Exact MCP registry secret name:** **`MCP_REGISTRY_GITHUB_TOKEN`** only when the server namespace in `server.json` is not publishable via repo GitHub OIDC; otherwise none. The only always-required repository/environment secret in the release workflow remains **`NPM_TOKEN`**.
88

99
## Verification
1010

0 commit comments

Comments
 (0)