Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/publish-mcp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Publish server.json to Official MCP Registry

on:
push:
tags:
- "v*"
- "mcp-v*"
release:
types: [published]
pull_request:
branches: [main]
paths:
- "server.json"
- ".github/workflows/publish-mcp.yml"
workflow_dispatch:

permissions: read-all

jobs:
publish-mcp-registry:
name: Publish to modelcontextprotocol/registry
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/mcp-v')
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
MCP_PUBLISHER_VERSION: v1.8.21
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "22"

- name: Install Cosign
uses: sigstore/cosign-installer@881c63bd87e38389154debd8331404ce7ca8a3ab # v4.1.4

- name: Download and verify mcp-publisher CLI via Sigstore
run: |
set -euo pipefail
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
arch="$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')"
archive="mcp-publisher_${os}_${arch}.tar.gz"
base_url="https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}"

curl -sSfL --output "$archive" "$base_url/$archive"
curl -sSfL --output "$archive.sigstore.json" "$base_url/$archive.sigstore.json"

cosign verify-blob \
--bundle "$archive.sigstore.json" \
--certificate-identity "https://github.com/modelcontextprotocol/registry/.github/workflows/release.yml@refs/tags/${MCP_PUBLISHER_VERSION}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
"$archive"

tar -xzf "$archive" mcp-publisher

- name: Sync server.json package versions against live registries
run: |
set -euo pipefail
cp server.json server.json.bak
node -e '
const fs = require("node:fs");
const manifest = JSON.parse(fs.readFileSync("server.json", "utf8"));
(async () => {
const kept = [];
for (const pkg of manifest.packages || []) {
if (pkg.registryType === "npm") {
const res = await fetch(`https://registry.npmjs.org/${pkg.identifier}/${pkg.version}`);
if (res.ok) {
kept.push(pkg);
continue;
}
const tagRes = await fetch(`https://registry.npmjs.org/-/package/${pkg.identifier}/dist-tags`);
if (tagRes.ok) {
const tags = await tagRes.json();
if (tags.latest) {
console.log(`::warning::npm package ${pkg.identifier}@${pkg.version} not found — using live dist-tag ${tags.latest} for this MCP Registry publish.`);
kept.push({ ...pkg, version: tags.latest });
continue;
}
}
console.log(`::warning::npm package ${pkg.identifier} not found — omitting from this MCP Registry publish.`);
continue;
}
if (pkg.registryType === "pypi") {
const res = await fetch(`https://pypi.org/pypi/${pkg.identifier}/${pkg.version}/json`);
if (!res.ok) {
console.log(`::warning::PyPI package ${pkg.identifier}@${pkg.version} not found (${res.status}) — omitting from this MCP Registry publish.`);
continue;
}
}
kept.push(pkg);
}
manifest.packages = kept;
fs.writeFileSync("server.json", `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
})().catch((err) => { console.error(err); process.exit(1); });
'

- name: Authenticate with MCP Registry (GitHub OIDC)
run: ./mcp-publisher login github-oidc

- name: Publish server.json to MCP Registry
run: |
set -euo pipefail
trap 'if [ -f server.json.bak ]; then mv server.json.bak server.json; fi' EXIT
./mcp-publisher publish
Loading