Skip to content

Commit 0932ad5

Browse files
authored
ci: publish MCP registry metadata (#627)
1 parent 14bbcf4 commit 0932ad5

2 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish MCP Registry
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
workflow_dispatch:
8+
inputs:
9+
release_tag:
10+
description: GitHub Release tag to publish metadata for, for example v0.16.5.
11+
required: true
12+
type: string
13+
checkout_ref:
14+
description: Optional branch, tag, or commit SHA to publish from. Defaults to the selected workflow ref.
15+
required: false
16+
type: string
17+
18+
permissions:
19+
contents: read
20+
id-token: write
21+
22+
jobs:
23+
publish-mcp-registry:
24+
name: Publish MCP Registry
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30+
with:
31+
ref: ${{ github.event.inputs.checkout_ref || github.ref }}
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
35+
with:
36+
node-version: "22"
37+
38+
- name: Resolve release metadata
39+
id: meta
40+
run: |
41+
set -euo pipefail
42+
PACKAGE_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('package.json', 'utf8')).version")"
43+
SERVER_VERSION="$(node -p "JSON.parse(require('node:fs').readFileSync('server.json', 'utf8')).version")"
44+
TAG_NAME="${{ github.event.release.tag_name || github.event.inputs.release_tag }}"
45+
VERSION="${TAG_NAME#v}"
46+
if [ "$VERSION" != "$PACKAGE_VERSION" ]; then
47+
echo "Release tag $TAG_NAME does not match package.json version $PACKAGE_VERSION" >&2
48+
exit 1
49+
fi
50+
if [ "$VERSION" != "$SERVER_VERSION" ]; then
51+
echo "Release tag $TAG_NAME does not match server.json version $SERVER_VERSION" >&2
52+
exit 1
53+
fi
54+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
55+
shell: bash
56+
57+
- name: Check MCP metadata sync
58+
run: node scripts/sync-mcp-metadata.mjs --check
59+
60+
- name: Install mcp-publisher
61+
run: |
62+
set -euo pipefail
63+
curl -L "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
64+
shell: bash
65+
66+
- name: Authenticate to MCP Registry
67+
run: ./mcp-publisher login github-oidc
68+
69+
- name: Publish server to MCP Registry
70+
run: ./mcp-publisher publish server.json

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
"check:quick": "pnpm lint && pnpm typecheck",
105105
"sync:mcp-metadata": "node scripts/sync-mcp-metadata.mjs",
106106
"check:mcp-metadata": "node scripts/sync-mcp-metadata.mjs --check",
107+
"version": "node scripts/sync-mcp-metadata.mjs && git add server.json",
107108
"check:tooling": "pnpm lint && pnpm typecheck && pnpm check:mcp-metadata && pnpm build",
108109
"check:unit": "pnpm test:unit && pnpm test:smoke",
109110
"check": "pnpm check:tooling && pnpm check:fallow && pnpm check:unit",

0 commit comments

Comments
 (0)