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
1843env :
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
2286jobs :
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 \
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
0 commit comments