Skip to content

Commit edb5110

Browse files
bszafranowclaude
andauthored
ci: publish server.json to the Official MCP Registry from GitHub Actions (#7)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 7430c11 commit edb5110

4 files changed

Lines changed: 112 additions & 3 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish to MCP Registry
2+
3+
# Publishes server.json to the Official MCP Registry (registry.modelcontextprotocol.io) as
4+
# io.github.tester-army/testerarmy, which feeds Glama, PulseMCP and the other aggregators.
5+
#
6+
# Authentication is GitHub Actions OIDC: the registry grants the io.github.<repository owner>/*
7+
# namespace to workflows running in this organisation's repositories. A personal
8+
# `mcp-publisher login github` only gets that namespace for org Owners (plain members are refused),
9+
# so this workflow is the route that needs nobody's personal login and no stored secret.
10+
#
11+
# Runs when server.json (or this file) lands on main, and on demand from the Actions tab. Manual
12+
# runs are limited to main because the registry authorises on the repository owner alone and never
13+
# looks at the branch: without the guard, any writer could publish an unreviewed branch under the
14+
# org name. The `mcp-registry-publish` environment exists so an org Owner can add a deployment
15+
# branch rule and a required reviewer in Settings > Environments without touching this file; until
16+
# then the `if:` below is the gate.
17+
#
18+
# The registry refuses a version it already has, so the job first checks whether server.json's
19+
# version is published and skips cleanly if so. To publish again, bump "version" in server.json
20+
# together with the plugin manifests; scripts/check-plugin-manifests.sh fails if they differ.
21+
22+
on:
23+
push:
24+
branches: [main]
25+
paths:
26+
- "server.json"
27+
- ".github/workflows/publish-mcp-registry.yml"
28+
workflow_dispatch:
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
publish:
35+
if: github.ref == 'refs/heads/main'
36+
runs-on: ubuntu-latest
37+
environment: mcp-registry-publish
38+
# One publish at a time; a parallel run for the same version would only fail.
39+
concurrency: publish-mcp-registry
40+
permissions:
41+
id-token: write # OIDC token exchanged with the registry
42+
contents: read
43+
env:
44+
# If "login github-oidc" fails with "invalid audience", the registry moved ahead of this
45+
# binary: bump to the latest release at https://github.com/modelcontextprotocol/registry/releases
46+
MCP_PUBLISHER_VERSION: "1.8.1"
47+
REGISTRY_URL: https://registry.modelcontextprotocol.io
48+
steps:
49+
- uses: actions/checkout@v5
50+
51+
- name: Install mcp-publisher (download checksum verified)
52+
run: |
53+
base="https://github.com/modelcontextprotocol/registry/releases/download/v${MCP_PUBLISHER_VERSION}"
54+
curl -fsSL --retry 3 "$base/mcp-publisher_linux_amd64.tar.gz" -o mcp-publisher_linux_amd64.tar.gz
55+
curl -fsSL --retry 3 "$base/registry_${MCP_PUBLISHER_VERSION}_checksums.txt" -o checksums.txt
56+
sha256sum --check --ignore-missing checksums.txt
57+
tar xzf mcp-publisher_linux_amd64.tar.gz mcp-publisher
58+
./mcp-publisher --version
59+
60+
# The registry's own validator: schema plus the semantic rules the publish endpoint applies.
61+
- name: Validate server.json against the registry
62+
run: ./mcp-publisher validate server.json
63+
64+
- name: Skip if this version is already published
65+
id: check
66+
run: |
67+
name=$(jq -r .name server.json)
68+
version=$(jq -r .version server.json)
69+
encoded=$(jq -rn --arg n "$name" '$n | @uri')
70+
if curl -fsS -o /dev/null "$REGISTRY_URL/v0/servers/$encoded/versions/$version"; then
71+
echo "::notice::$name@$version is already in the registry; bump version in server.json to publish again"
72+
echo "skip=true" >> "$GITHUB_OUTPUT"
73+
fi
74+
75+
- name: Log in with GitHub Actions OIDC
76+
if: steps.check.outputs.skip != 'true'
77+
run: ./mcp-publisher login github-oidc
78+
79+
- name: Publish
80+
if: steps.check.outputs.skip != 'true'
81+
run: ./mcp-publisher publish server.json
82+
83+
# Exact lookup: 404 (and a failed step) if the version is not there.
84+
- name: Confirm the registry entry
85+
run: |
86+
set -euo pipefail
87+
name=$(jq -r .name server.json)
88+
version=$(jq -r .version server.json)
89+
encoded=$(jq -rn --arg n "$name" '$n | @uri')
90+
entry=$(curl -fsS --retry 3 "$REGISTRY_URL/v0/servers/$encoded/versions/$version" \
91+
| jq '{name: .server.name, version: .server.version, status: ._meta["io.modelcontextprotocol.registry/official"].status, isLatest: ._meta["io.modelcontextprotocol.registry/official"].isLatest, publishedAt: ._meta["io.modelcontextprotocol.registry/official"].publishedAt}')
92+
echo "$entry"
93+
{
94+
echo "### MCP Registry: $name@$version"
95+
echo '```json'
96+
echo "$entry"
97+
echo '```'
98+
echo "Glama connector page (claim it once it appears): https://glama.ai/mcp/connectors/$name"
99+
} >> "$GITHUB_STEP_SUMMARY"

‎.github/workflows/validate-plugin.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- ".codex-plugin/**"
1111
- ".cursor-plugin/**"
1212
- "assets/**"
13+
- "server.json"
1314
- "scripts/check-plugin-manifests.sh"
1415
- ".github/workflows/validate-plugin.yml"
1516
push:
@@ -19,7 +20,7 @@ jobs:
1920
validate:
2021
runs-on: ubuntu-latest
2122
steps:
22-
- uses: actions/checkout@v4
23+
- uses: actions/checkout@v5
2324
- name: Manifests parse and agree with each other
2425
run: scripts/check-plugin-manifests.sh
2526
- name: Root manifest and mcp.json match the Agent Plugins schemas

‎glama.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://glama.ai/mcp/schemas/server.json",
3+
"maintainers": ["okwasniewski", "szymonrybczak", "lil-bsz"]
4+
}

‎scripts/check-plugin-manifests.sh‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
2-
# Keeps the four plugin manifests in step. Run locally or in CI.
2+
# Keeps the plugin manifests and the MCP Registry manifest (server.json) in step. Run locally or in CI.
33
set -euo pipefail
44
cd "$(dirname "$0")/.."
55

6-
files=(.claude-plugin/plugin.json .claude-plugin/marketplace.json .codex-plugin/plugin.json .cursor-plugin/plugin.json plugin.json .mcp.json mcp.json)
6+
files=(.claude-plugin/plugin.json .claude-plugin/marketplace.json .codex-plugin/plugin.json .cursor-plugin/plugin.json plugin.json .mcp.json mcp.json server.json)
77
for f in "${files[@]}"; do jq -e . "$f" >/dev/null || { echo "invalid JSON: $f"; exit 1; }; done
88

99
# name, version and description must match across every manifest and the marketplace entry
@@ -27,6 +27,11 @@ u2=$(jq -r '.mcpServers.testerarmy.url' mcp.json)
2727
[ "$(jq -r '.mcpServers.testerarmy.type' .mcp.json)" = "http" ] || { echo ".mcp.json must use type http (Claude Code)"; exit 1; }
2828
[ "$(jq -r '.mcpServers.testerarmy.type' mcp.json)" = "streamable-http" ] || { echo "mcp.json must use type streamable-http (Agent Plugins)"; exit 1; }
2929

30+
# the registry manifest is published from main by .github/workflows/publish-mcp-registry.yml:
31+
# same version as the plugins, same server URL as the MCP files
32+
[ "$(jq -r .version server.json)" = "$(jq -r .version plugin.json)" ] || { echo "version differs in server.json (bump it with the plugin manifests)"; exit 1; }
33+
[ "$(jq -r '.remotes[0].url' server.json)" = "$u1" ] || { echo "server.json remotes[0].url differs from the MCP files"; exit 1; }
34+
3035
# referenced logo must exist
3136
for p in "$(jq -r .logo .cursor-plugin/plugin.json)" "$(jq -r .interface.logo .codex-plugin/plugin.json)"; do
3237
[ -f "${p#./}" ] || { echo "missing logo file: $p"; exit 1; }

0 commit comments

Comments
 (0)