Skip to content

Commit 5eb5696

Browse files
committed
feat(registry): publish to the MCP Registry from CI, with the version guarded
The registry is upstream of the directory ecosystem — Glama, PulseMCP and mcp.so sync from it — so one listing reaches the places a numeric directory form never would. It needs a server.json manifest, which is what this adds. Two things were learned the hard way and are worth recording. The schema served at 2025-07-09 is stale and snake_case; the live registry is 2025-12-11 and camelCase, and a local ajv run against the older file reported "valid" for a document the registry rejects with a 422. The manifest here was validated against the live registry instead. And `mcp-publisher login github` is broken in every published build (modelcontextprotocol/registry#1543, fixed by #1588, unreleased as of v1.8.1), so auth is OIDC from Actions — a separate code path, and the better answer regardless, since publishing by hand is one more step to forget on release day. server.json is now a fourth place the version lives, and the one with the widest blast radius: a stale entry advertises a release users cannot install, across several directories at once. The drift guard covers it — version, npm entry version, npm identifier, reverse-DNS name and the registry's 100-character description cap — and the workflow refuses to publish a mismatch rather than shipping a bad listing. Each assertion was verified by injection: wrong version, wrong identifier, snake_case regression, over-long description, bad name. 434 tests.
1 parent 612acc9 commit 5eb5696

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish to MCP Registry
2+
3+
# The registry is the upstream of the directory ecosystem — Glama, PulseMCP and mcp.so
4+
# sync from it. Publishing by hand means the listing drifts from the release the moment
5+
# anyone forgets a step, which is the bug class this repo has already shipped three
6+
# times. So it runs on the release itself.
7+
#
8+
# Auth is OIDC, not the interactive device flow: `mcp-publisher login github` is broken
9+
# in every published build (modelcontextprotocol/registry#1543, fixed by #1588 but
10+
# unreleased as of v1.8.1). OIDC is a separate code path and is unaffected.
11+
12+
on:
13+
release:
14+
types: [published]
15+
workflow_dispatch:
16+
17+
env:
18+
PUBLISHER_VERSION: v1.8.1
19+
20+
jobs:
21+
publish:
22+
name: publish server.json
23+
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write # required for OIDC; nothing else needs elevating
26+
contents: read
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
# A listing that advertises a version users cannot install is worse than no
31+
# listing. Fail here rather than publish a mismatch.
32+
- name: server.json must match the published package
33+
run: |
34+
server_version=$(jq -r '.version' server.json)
35+
package_version=$(jq -r '.version' packages/cli/package.json)
36+
package_name=$(jq -r '.name' packages/cli/package.json)
37+
declared=$(jq -r '.packages[] | select(.registryType=="npm") | .version' server.json)
38+
identifier=$(jq -r '.packages[] | select(.registryType=="npm") | .identifier' server.json)
39+
40+
echo "server.json $server_version (npm entry: $identifier@$declared)"
41+
echo "packages/cli $package_name@$package_version"
42+
43+
[ "$server_version" = "$package_version" ] || { echo "::error::server.json version != packages/cli version"; exit 1; }
44+
[ "$declared" = "$package_version" ] || { echo "::error::server.json npm package version != packages/cli version"; exit 1; }
45+
[ "$identifier" = "$package_name" ] || { echo "::error::server.json npm identifier != published package name"; exit 1; }
46+
47+
# On a release, the tag is the source of truth for what was just shipped.
48+
if [ "${{ github.event_name }}" = "release" ]; then
49+
tag="${{ github.event.release.tag_name }}"
50+
[ "${tag#v}" = "$package_version" ] || { echo "::error::tag $tag does not match version $package_version"; exit 1; }
51+
fi
52+
53+
# The version is pinned rather than tracking latest: this step holds an OIDC token,
54+
# so the binary it runs should change only when we decide it does.
55+
- name: Install mcp-publisher
56+
run: |
57+
curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/download/${PUBLISHER_VERSION}/mcp-publisher_linux_amd64.tar.gz" \
58+
| tar xz mcp-publisher
59+
./mcp-publisher --version
60+
61+
- name: Validate against the live registry
62+
run: ./mcp-publisher validate
63+
64+
- name: Authenticate (GitHub Actions OIDC)
65+
run: ./mcp-publisher login github-oidc
66+
67+
- name: Publish
68+
run: ./mcp-publisher publish

‎packages/shared/src/protocol.test.ts‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,31 @@ describe("version and tool count cannot drift from what users are told", () => {
226226
}
227227
}
228228
});
229+
230+
// server.json is a fourth place the version lives, and the one with the widest blast
231+
// radius: the MCP Registry publishes from it and Glama, PulseMCP and mcp.so sync from
232+
// the registry. A stale version here advertises a release users cannot install, in
233+
// several directories at once, and nothing in the build would have noticed.
234+
it("server.json agrees with the published package", () => {
235+
const server = JSON.parse(read("server.json")) as {
236+
name: string;
237+
description: string;
238+
version: string;
239+
packages?: { registryType: string; identifier: string; version: string }[];
240+
};
241+
expect(server.version).toBe(TOWER_VERSION);
242+
243+
// Reverse-DNS, exactly one slash — the registry rejects anything else.
244+
expect(server.name).toMatch(/^[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+$/);
245+
246+
// The registry caps description at 100 characters and rejects the whole submission
247+
// over it — which is why this is not the same string as the README one-liner.
248+
expect(server.description.length).toBeLessThanOrEqual(100);
249+
250+
const npm = server.packages?.find((p) => p.registryType === "npm");
251+
expect(npm, "server.json declares no npm package").toBeDefined();
252+
const pkg = JSON.parse(read("packages/cli/package.json")) as { name: string };
253+
expect(npm?.identifier).toBe(pkg.name);
254+
expect(npm?.version).toBe(TOWER_VERSION);
255+
});
229256
});

‎server.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3+
"name": "io.github.Rohanxmalik/tower",
4+
"title": "Tower",
5+
"description": "Multiplayer for AI coding agents: collision detection before the edit, messaging, delegation.",
6+
"version": "0.11.0",
7+
"websiteUrl": "https://rohanxmalik.github.io/Tower",
8+
"repository": {
9+
"url": "https://github.com/Rohanxmalik/Tower",
10+
"source": "github",
11+
"id": "1287233581"
12+
},
13+
"packages": [
14+
{
15+
"registryType": "npm",
16+
"identifier": "tower-mcp",
17+
"version": "0.11.0",
18+
"transport": { "type": "stdio" },
19+
"packageArguments": [{ "type": "positional", "value": "serve" }]
20+
}
21+
]
22+
}

0 commit comments

Comments
 (0)