Skip to content

Commit 2d783fc

Browse files
[Discovery] Publish to the MCP Registry after each stable release (#1132)
* Publish server.json to the MCP Registry after each stable release The MCP Registry workflow only ever validated server.json; nothing published it. Release now calls it with the released version: it checks out the release tag, waits for npm to serve @pascal-app/mcp with its mcpName, publishes, and fails unless the registry lists the version. * MCP Registry publish: validate the manifest against fixed values, scope the signing key - Hard-code the server name and package, check the version is a stable semver with no line breaks, and pass it to later steps as a step output. - Run publish in the mcp-registry environment with a concurrency group, and delete the registry token afterwards. - Require version on manual dispatch; pass only MCP_REGISTRY_PRIVATE_KEY from release.yml instead of inheriting every secret. - Document the CI-only DNS key, its environment and its rotation. Co-authored-by: Aymeric Rabot <Aymericr@users.noreply.github.com> * MCP Registry publish: pin the validated commit and repeat the full check - validate resolves the release tag to its commit and outputs it; publish checks out that commit, confirms the tag still points at it, and repeats the full manifest check (name, version, package entry, remote) before login. - Check the version input before any checkout, in both jobs. - Delete ~/.config/mcp-publisher/token.json after publishing, keeping the older token path as a fallback. - Query npm at registry.npmjs.org from outside the checkout. - release.yml: call the registry workflow only for a stable @pascal-app/mcp version. - Docs: the mcp-registry environment as it is set up, the secret's location, and how publish runs queue. Co-authored-by: Aymeric Rabot <Aymericr@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Aymeric Rabot <Aymericr@users.noreply.github.com>
1 parent a03c508 commit 2d783fc

4 files changed

Lines changed: 283 additions & 12 deletions

File tree

‎.github/workflows/mcp-registry.yml‎

Lines changed: 223 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,110 @@ on:
1212
- server.json
1313
- packages/mcp/package.json
1414
- .github/workflows/mcp-registry.yml
15-
# Run before publishing: the hosted deployment must already serve this version.
15+
# Release calls this after npm has the version; dispatch it by hand to recover a missed one.
16+
workflow_call:
17+
inputs:
18+
version:
19+
description: Released @pascal-app/mcp version; checks out its release tag
20+
required: true
21+
type: string
22+
publish:
23+
required: true
24+
type: boolean
25+
secrets:
26+
MCP_REGISTRY_PRIVATE_KEY:
27+
required: false
1628
workflow_dispatch:
29+
inputs:
30+
version:
31+
description: Released @pascal-app/mcp version; checks out its release tag
32+
required: true
33+
type: string
34+
publish:
35+
description: Publish server.json to the MCP Registry
36+
type: boolean
37+
default: false
38+
check-hosted:
39+
description: Check that the hosted API catalog and server card report this version
40+
type: boolean
41+
default: true
1742

1843
env:
1944
MCP_PUBLISHER_VERSION: 1.8.1
2045
MCP_PUBLISHER_LINUX_AMD64_SHA256: a06c9096dcb9727c13555b6be26c7effa707b01f06a4c561ba7a3635443cf2cc
46+
NAME: app.pascal/editor
47+
PACKAGE: "@pascal-app/mcp"
48+
REMOTE_URL: https://editor.pascal.app/api/mcp
49+
# validate and publish both run these, so the two jobs apply the same rules.
50+
CHECK_VERSION: |
51+
case "$INPUT_VERSION" in
52+
*$'\r'* | *$'\n'*)
53+
echo "::error::version contains a line break"
54+
exit 1
55+
;;
56+
esac
57+
if ! [[ "$INPUT_VERSION" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
58+
echo "::error::version must be a stable semver release such as 1.2.3"
59+
exit 1
60+
fi
61+
CHECK_MANIFEST: |
62+
jq --exit-status --arg name "$NAME" --arg package "$PACKAGE" --arg version "$INPUT_VERSION" \
63+
--arg remote "$REMOTE_URL" '
64+
.name == $name
65+
and .version == $version
66+
and .packages == [{
67+
"registryType": "npm",
68+
"registryBaseUrl": "https://registry.npmjs.org",
69+
"identifier": $package,
70+
"version": $version,
71+
"runtimeHint": "npx",
72+
"transport": { "type": "stdio" }
73+
}]
74+
and .remotes == [{ "type": "streamable-http", "url": $remote }]
75+
' server.json >/dev/null || {
76+
echo "::error::server.json must be $NAME@$INPUT_VERSION with only the npm package $PACKAGE@$INPUT_VERSION over stdio and only the remote $REMOTE_URL"
77+
exit 1
78+
}
79+
jq --exit-status --arg name "$NAME" --arg package "$PACKAGE" --arg version "$INPUT_VERSION" '
80+
.name == $package and .mcpName == $name and .version == $version
81+
' packages/mcp/package.json >/dev/null || {
82+
echo "::error::packages/mcp/package.json must be $PACKAGE@$INPUT_VERSION with mcpName $NAME"
83+
exit 1
84+
}
2185
2286
jobs:
2387
validate:
2488
runs-on: ubuntu-latest
2589
permissions:
2690
contents: read
91+
outputs:
92+
commit: ${{ steps.commit.outputs.sha }}
2793
steps:
94+
- name: Check the version input
95+
if: inputs.version != ''
96+
env:
97+
INPUT_VERSION: ${{ inputs.version }}
98+
run: bash -euo pipefail -c "$CHECK_VERSION"
99+
28100
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
29101
with:
102+
ref: ${{ inputs.version && format('refs/tags/@pascal-app/mcp@{0}', inputs.version) || '' }}
30103
persist-credentials: false
31104

105+
# publish checks out this exact commit, not the tag.
106+
- name: Resolve the release tag to its commit
107+
id: commit
108+
if: inputs.version != ''
109+
env:
110+
INPUT_VERSION: ${{ inputs.version }}
111+
run: |
112+
sha=$(git rev-parse --verify "refs/tags/@pascal-app/mcp@${INPUT_VERSION}^{commit}")
113+
if [ "$sha" != "$(git rev-parse HEAD)" ]; then
114+
echo "::error::the checkout is not the commit of @pascal-app/mcp@$INPUT_VERSION"
115+
exit 1
116+
fi
117+
echo "sha=$sha" >> "$GITHUB_OUTPUT"
118+
32119
- name: Install MCP Registry publisher
33120
run: |
34121
curl --fail --location \
@@ -38,7 +125,7 @@ jobs:
38125
tar -xzf "$RUNNER_TEMP/mcp-publisher.tar.gz" -C "$RUNNER_TEMP" mcp-publisher
39126
40127
- name: Validate MCP Registry manifest
41-
run: "$RUNNER_TEMP/mcp-publisher validate"
128+
run: '"$RUNNER_TEMP/mcp-publisher" validate'
42129

43130
# The registry verifies npm ownership through the published package's mcpName. A
44131
# prerelease tree keeps the manifest on the last stable version.
@@ -58,6 +145,12 @@ jobs:
58145
}]
59146
' server.json
60147
148+
- name: Release manifest matches the expected server
149+
if: inputs.version != ''
150+
env:
151+
INPUT_VERSION: ${{ inputs.version }}
152+
run: bash -euo pipefail -c "$CHECK_MANIFEST"
153+
61154
# OAuth is discovered from the 401 challenge, so the remote declares no headers.
62155
- name: Verify hosted endpoint contract
63156
run: |
@@ -81,16 +174,143 @@ jobs:
81174
'resource_metadata="https://editor.pascal.app/.well-known/oauth-protected-resource"' \
82175
"$RUNNER_TEMP/mcp-response.headers"
83176
177+
# The registry reads mcpName from the npm tarball, so this waits until npm serves the
178+
# version, and it fails unless the registry lists the version afterwards.
179+
publish:
180+
if: inputs.publish
181+
needs: validate
182+
runs-on: ubuntu-latest
183+
# The environment's deployment rule allows only main; it holds MCP_REGISTRY_PRIVATE_KEY.
184+
environment: mcp-registry
185+
# GitHub keeps one running and one waiting run per group: a third queued run replaces
186+
# the waiting one. That is accepted, since every run publishes a version only once.
187+
concurrency:
188+
group: mcp-registry-publish
189+
cancel-in-progress: false
190+
permissions:
191+
contents: read
192+
env:
193+
VERSIONS_URL: https://registry.modelcontextprotocol.io/v0/servers/app.pascal%2Feditor/versions
194+
steps:
195+
- name: Check the version input and validated commit
196+
env:
197+
INPUT_VERSION: ${{ inputs.version }}
198+
EXPECTED_COMMIT: ${{ needs.validate.outputs.commit }}
199+
run: |
200+
bash -euo pipefail -c "$CHECK_VERSION"
201+
if ! [[ "$EXPECTED_COMMIT" =~ ^[0-9a-f]{40}$ ]]; then
202+
echo "::error::validate did not report the commit it checked"
203+
exit 1
204+
fi
205+
206+
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
207+
with:
208+
ref: ${{ needs.validate.outputs.commit }}
209+
persist-credentials: false
210+
211+
- name: Checkout is the commit validate checked
212+
env:
213+
INPUT_VERSION: ${{ inputs.version }}
214+
EXPECTED_COMMIT: ${{ needs.validate.outputs.commit }}
215+
run: |
216+
if [ "$(git rev-parse HEAD)" != "$EXPECTED_COMMIT" ]; then
217+
echo "::error::the checkout is not the commit validate checked ($EXPECTED_COMMIT)"
218+
exit 1
219+
fi
220+
tag="refs/tags/@pascal-app/mcp@$INPUT_VERSION"
221+
refs=$(git ls-remote origin "$tag" "$tag^{}")
222+
tag_commit=$(awk -v t="$tag^{}" '$2 == t { print $1 }' <<< "$refs")
223+
[ -n "$tag_commit" ] || tag_commit=$(awk -v t="$tag" '$2 == t { print $1 }' <<< "$refs")
224+
if [ "$tag_commit" != "$EXPECTED_COMMIT" ]; then
225+
echo "::error::@pascal-app/mcp@$INPUT_VERSION no longer points at the commit validate checked ($EXPECTED_COMMIT)"
226+
exit 1
227+
fi
228+
229+
# Later steps take the version only from this step's output.
230+
- name: Release manifest matches the expected server
231+
id: manifest
232+
env:
233+
INPUT_VERSION: ${{ inputs.version }}
234+
run: |
235+
bash -euo pipefail -c "$CHECK_MANIFEST"
236+
echo "version=$INPUT_VERSION" >> "$GITHUB_OUTPUT"
237+
238+
# A fresh publish can take a few minutes to show up in `npm view`. It runs outside
239+
# the checkout so the repository's .npmrc does not apply.
240+
- name: Wait for npm to serve the version
241+
working-directory: ${{ runner.temp }}
242+
env:
243+
VERSION: ${{ steps.manifest.outputs.version }}
244+
run: |
245+
for _ in $(seq 1 30); do
246+
if [ "$(npm view --registry https://registry.npmjs.org "$PACKAGE@$VERSION" mcpName 2>/dev/null)" = "$NAME" ]; then
247+
echo "$PACKAGE@$VERSION is on npm with mcpName $NAME"
248+
exit 0
249+
fi
250+
sleep 20
251+
done
252+
echo "::error::$PACKAGE@$VERSION with mcpName $NAME is not on npm after 10 minutes"
253+
exit 1
254+
255+
- name: Install MCP Registry publisher
256+
run: |
257+
curl --fail --location \
258+
"https://github.com/modelcontextprotocol/registry/releases/download/v${MCP_PUBLISHER_VERSION}/mcp-publisher_linux_amd64.tar.gz" \
259+
--output "$RUNNER_TEMP/mcp-publisher.tar.gz"
260+
echo "${MCP_PUBLISHER_LINUX_AMD64_SHA256} $RUNNER_TEMP/mcp-publisher.tar.gz" | sha256sum --check
261+
tar -xzf "$RUNNER_TEMP/mcp-publisher.tar.gz" -C "$RUNNER_TEMP" mcp-publisher
262+
263+
# The app.pascal namespace is verified through CI's own pascal.app DNS TXT record,
264+
# whose Ed25519 private key is the MCP_REGISTRY_PRIVATE_KEY environment secret.
265+
- name: Publish to the MCP Registry
266+
env:
267+
VERSION: ${{ steps.manifest.outputs.version }}
268+
MCP_REGISTRY_PRIVATE_KEY: ${{ secrets.MCP_REGISTRY_PRIVATE_KEY }}
269+
run: |
270+
if curl --silent --fail "$VERSIONS_URL" \
271+
| jq --exit-status --arg v "$VERSION" 'any(.servers[]; .server.version == $v)' >/dev/null; then
272+
echo "$NAME@$VERSION is already in the MCP Registry"
273+
exit 0
274+
fi
275+
if [ -z "$MCP_REGISTRY_PRIVATE_KEY" ]; then
276+
echo "::error::MCP_REGISTRY_PRIVATE_KEY is not set, so $NAME@$VERSION cannot be published. See wiki/npm-release.md#mcp-registry."
277+
exit 1
278+
fi
279+
"$RUNNER_TEMP/mcp-publisher" login dns --domain pascal.app --private-key "$MCP_REGISTRY_PRIVATE_KEY"
280+
"$RUNNER_TEMP/mcp-publisher" publish
281+
282+
# mcp-publisher 1.8.1 keeps its token in token.json; the older path is a fallback.
283+
- name: Remove the registry token
284+
if: always()
285+
run: rm -f ~/.config/mcp-publisher/token.json ~/.mcpregistry_registry_token
286+
287+
- name: Registry lists the version
288+
env:
289+
VERSION: ${{ steps.manifest.outputs.version }}
290+
run: |
291+
for _ in $(seq 1 10); do
292+
if curl --silent --fail "$VERSIONS_URL" \
293+
| jq --exit-status --arg v "$VERSION" 'any(.servers[]; .server.version == $v)' >/dev/null; then
294+
echo "$NAME@$VERSION is in the MCP Registry"
295+
exit 0
296+
fi
297+
sleep 15
298+
done
299+
echo "::error::$NAME@$VERSION is not in the MCP Registry: $VERSIONS_URL"
300+
exit 1
301+
84302
# The hosted API catalog and server card are served by the hosted deployment, not
85303
# this repository, so they only match after that deployment picks up this version.
304+
# It does not gate the registry publish.
86305
hosted-matches-manifest:
87-
if: github.event_name == 'workflow_dispatch'
306+
if: inputs.check-hosted
88307
runs-on: ubuntu-latest
89308
permissions:
90309
contents: read
91310
steps:
92311
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
93312
with:
313+
ref: ${{ inputs.version && format('refs/tags/@pascal-app/mcp@{0}', inputs.version) || '' }}
94314
persist-credentials: false
95315

96316
- name: Verify live API catalog matches manifest

‎.github/workflows/release.yml‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
outputs:
5858
version: ${{ steps.version.outputs.version }}
5959
channel: ${{ steps.version.outputs.channel }}
60+
mcp-version: ${{ steps.version.outputs.mcp-version }}
6061
env:
6162
# Verbose npm logs show the OIDC token exchange and the registry's
6263
# rejection reason when trusted publishing is misconfigured; tokens are
@@ -219,8 +220,7 @@ jobs:
219220
# leaves them on the last stable release.
220221
bun scripts/sync-agent-versions.ts
221222
222-
# Publishing server.json to the MCP Registry stays a manual owner step after
223-
# this release lands; see wiki/npm-release.md.
223+
# The mcp-registry job publishes server.json once this job has pushed the tag.
224224
- name: Validate MCP Registry manifest
225225
env:
226226
MCP_PUBLISHER_VERSION: 1.8.1
@@ -237,6 +237,7 @@ jobs:
237237
run: |
238238
echo "version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
239239
echo "channel=$NPM_TAG" >> "$GITHUB_OUTPUT"
240+
echo "mcp-version=$(jq -r '.version' packages/mcp/package.json)" >> "$GITHUB_OUTPUT"
240241
241242
# OIDC trusted publishing can only mint a token for a package that already
242243
# exists on npm with a trusted publisher. A package that was never
@@ -441,6 +442,24 @@ jobs:
441442
gh release upload "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" --clobber
442443
echo "🌐 Uploaded $(basename "$ARCHIVE") to $TAG"
443444
445+
# A beta, or a bump=none rerun of one, leaves server.json on the last stable version,
446+
# which is already listed.
447+
mcp-registry:
448+
needs: release
449+
if: >-
450+
inputs.dry-run == false
451+
&& needs.release.outputs.channel == 'latest'
452+
&& needs.release.outputs.mcp-version != ''
453+
&& !contains(needs.release.outputs.mcp-version, '-')
454+
permissions:
455+
contents: read
456+
uses: ./.github/workflows/mcp-registry.yml
457+
with:
458+
version: ${{ needs.release.outputs.mcp-version }}
459+
publish: true
460+
secrets:
461+
MCP_REGISTRY_PRIVATE_KEY: ${{ secrets.MCP_REGISTRY_PRIVATE_KEY }}
462+
444463
# The self-host image, built from the release tag on native runners (a Next
445464
# build under QEMU takes most of an hour) and stitched into one multi-arch
446465
# manifest. Tagged with the npm version so the container and the CLI runtime

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ Also listed on [Smithery](https://smithery.ai/servers/pascalapp/editor).
133133
`app.pascal/editor`. It lists the `@pascal-app/mcp` npm package and the hosted Streamable HTTP
134134
endpoint, which signs in with OAuth. Its version is the `@pascal-app/mcp` package version:
135135
`bun scripts/sync-agent-versions.ts` rewrites it, and the Cursor plugin's CLI pin, from the
136-
package versions, and CI fails when they drift. A Pascal owner publishes from `main` after a
137-
release; see [wiki/npm-release.md](wiki/npm-release.md#mcp-registry).
136+
package versions, and CI fails when they drift. Each stable release publishes it to the registry
137+
after npm has the package. The signing key is CI's own `pascal.app` DNS key, stored only as a secret of
138+
the `mcp-registry` environment (limited to `main`), never as a repository secret; see
139+
[wiki/npm-release.md](wiki/npm-release.md#mcp-registry).
138140

139141
## Using Published Packages
140142

0 commit comments

Comments
 (0)