From 0b0108f2f630b95d3a39617b5f5b7e6b538d9752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Tue, 17 Nov 2026 21:47:09 +0000 Subject: [PATCH] ci: watch the MCP registry hourly for HeyGen listings server.json never held (#8107) * test(ci): flag registry listings under HeyGen names that server.json never held * ci: watch the MCP registry hourly for HeyGen listings server.json never held * test(ci): the registry watch covers heygen.com's subdomain namespaces * fix(ci): the registry watch covers heygen.com subdomains and opens an issue when it fails --- .github/workflows/mcp-registry-watch.yml | 47 ++++++++++++++++ package.json | 2 +- scripts/mcp-registry-watch.mjs | 72 ++++++++++++++++++++++++ scripts/mcp-registry-watch.test.mjs | 40 +++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mcp-registry-watch.yml create mode 100644 scripts/mcp-registry-watch.mjs create mode 100644 scripts/mcp-registry-watch.test.mjs diff --git a/.github/workflows/mcp-registry-watch.yml b/.github/workflows/mcp-registry-watch.yml new file mode 100644 index 0000000000..6634515448 --- /dev/null +++ b/.github/workflows/mcp-registry-watch.yml @@ -0,0 +1,47 @@ +name: MCP registry watch + +# Hourly: a red run means the MCP registry lists a HeyGen-named server or version server.json never held. The +# registry's GitHub login lets a job in any heygen-com repo publish io.github.heygen-com/*. + +permissions: + contents: read + +on: + schedule: + - cron: "41 * * * *" + workflow_dispatch: + +jobs: + watch: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Compare the registry with server.json's history + run: node scripts/mcp-registry-watch.mjs + + # One open issue per incident, so the alert reaches the repo's watchers, not only the cron's last editor. It links + # the run and never quotes registry names, which their publishers choose. + alert: + needs: watch + if: failure() + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + issues: write + steps: + - name: Open or update the alert issue + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + title="MCP registry lists a HeyGen server this repo never published" + open="$(gh issue list --state open --search "in:title \"$title\"" --json number,title | + jq -r --arg t "$title" '.[] | select(.title == $t) | .number' | head -n1)" + body="The hourly MCP registry watch failed: $RUN_URL. Its log names the listings server.json never held." + if [ -n "$open" ]; then gh issue comment "$open" --body "$body"; else gh issue create --title "$title" --body "$body"; fi diff --git a/package.json b/package.json index ab8705ba45..cf2b43df6e 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "player:perf": "bun run --filter @hyperframes/player perf", "format:check": "oxfmt --check .", "knip": "knip", - "test:scripts": "node --import tsx --test scripts/animejs-v4-guidance.test.mjs scripts/check-tracked-artifacts.test.mjs scripts/check-committed-keys.test.mjs scripts/check-symlinks.test.mjs scripts/upload-docs-images.test.mjs scripts/check-registry-set-delta.test.mjs scripts/check-no-main-deletions.test.mjs scripts/check-pr-captures.test.mjs scripts/check-comment-citations.test.mjs scripts/comments-workflow.test.mjs scripts/comment-ratchet.test.mjs scripts/check-docs-snippet-motion.test.mjs scripts/registry-target-paths.test.mjs scripts/check-workspace-contracts.test.mjs scripts/check-media-use-copy-parity.test.mjs scripts/check-svg-sanitize-parity.test.mjs scripts/check-media-use-svg-sanitize-generated.test.mjs scripts/check-media-use-audio-carve-generated.test.mjs scripts/check-package-cycles.test.mjs scripts/check-cli-process-ownership.test.mjs scripts/check-cli-lazy-deps.test.mjs scripts/file-url-paths.test.mjs scripts/check-studio-copy-dashes.test.mjs scripts/check-large-files.test.mjs scripts/check-registry-innerhtml.test.mjs scripts/package-subpaths.test.mjs scripts/validate-release-channel.test.mjs scripts/clawhub-sync.test.mjs scripts/clawhub-unlist-retired.test.mjs scripts/publish-workflow.test.mjs scripts/release-lambda-assets.test.mjs scripts/publish-main-only-workflows.test.mjs scripts/pr-edit-concurrency.test.mjs scripts/merge-queue-workflows.test.mjs scripts/ci-cache-workflows.test.mjs scripts/install-workspace-dependencies.test.mjs scripts/check-edit-accuracy-filter.test.mjs scripts/edit-accuracy-retry.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts scripts/claude-plugin-compression.test.ts scripts/catalog-payload-assets.test.ts scripts/host-registry-assets.test.ts scripts/catalog-preview-temp.test.ts scripts/backfill-block-previews.test.ts scripts/catalog-hosted-files.test.ts scripts/player-cdn-pin.test.ts scripts/registry-cdn-pins.test.ts scripts/studio-runtime-smoke.test.mjs scripts/verify-packed-manifests.test.mjs scripts/rewrite-relative-import-extensions.test.mjs scripts/lint-skills.test.mjs scripts/check-core-skills.test.mjs scripts/creator-editing-recipes.test.mjs packages/gcp-cloud-run/check-dockerfile-workspaces.test.mjs packages/core/scripts/writeGeneratedFile.test.ts scripts/catalog-publication.test.mjs scripts/ci/resolve-workflow-pr.test.mjs scripts/lefthook-order.test.mjs scripts/inline-gsap.test.mjs scripts/ci/flake-gate.test.mjs scripts/ci/motion-blur-nightly-report.test.mjs scripts/ci/base-file.test.mjs scripts/ci/release-only-diff.test.mjs scripts/check-catalog-source-pr.test.mjs scripts/generate-registry-items.test.ts scripts/catalog-drift.test.ts scripts/catalog-fetch-mirror.test.ts scripts/catalog-script-inlining.test.ts scripts/catalog-detail.test.ts scripts/generate-catalog-pages.test.ts scripts/verify-catalog-payloads.test.ts scripts/registry-theme-fallbacks.test.ts scripts/registry-skill-files.test.ts scripts/creator-editing-capabilities.test.mjs scripts/generate-catalog-previews.test.ts scripts/registry-primitive-payloads.test.ts registry/components/pan-stations/pan-stations.test.mjs registry/components/filmed-screen/filmed-screen.test.mjs registry/components/echo-smear/echo-smear.test.mjs registry/examples/path-traced-3d/source/path-traced-3d.test.mjs && vitest run scripts/catalog/ scripts/contrastRatchet.test.ts scripts/generate-catalog-payloads.test.ts", + "test:scripts": "node --import tsx --test scripts/animejs-v4-guidance.test.mjs scripts/check-tracked-artifacts.test.mjs scripts/check-committed-keys.test.mjs scripts/check-symlinks.test.mjs scripts/upload-docs-images.test.mjs scripts/check-registry-set-delta.test.mjs scripts/check-no-main-deletions.test.mjs scripts/check-pr-captures.test.mjs scripts/check-comment-citations.test.mjs scripts/comments-workflow.test.mjs scripts/comment-ratchet.test.mjs scripts/check-docs-snippet-motion.test.mjs scripts/registry-target-paths.test.mjs scripts/check-workspace-contracts.test.mjs scripts/check-media-use-copy-parity.test.mjs scripts/check-svg-sanitize-parity.test.mjs scripts/check-media-use-svg-sanitize-generated.test.mjs scripts/check-media-use-audio-carve-generated.test.mjs scripts/check-package-cycles.test.mjs scripts/check-cli-process-ownership.test.mjs scripts/check-cli-lazy-deps.test.mjs scripts/file-url-paths.test.mjs scripts/check-studio-copy-dashes.test.mjs scripts/check-large-files.test.mjs scripts/check-registry-innerhtml.test.mjs scripts/package-subpaths.test.mjs scripts/validate-release-channel.test.mjs scripts/clawhub-sync.test.mjs scripts/clawhub-unlist-retired.test.mjs scripts/publish-workflow.test.mjs scripts/release-lambda-assets.test.mjs scripts/publish-main-only-workflows.test.mjs scripts/mcp-registry-watch.test.mjs scripts/pr-edit-concurrency.test.mjs scripts/merge-queue-workflows.test.mjs scripts/ci-cache-workflows.test.mjs scripts/install-workspace-dependencies.test.mjs scripts/check-edit-accuracy-filter.test.mjs scripts/edit-accuracy-retry.test.mjs scripts/draft-changelog.test.ts scripts/set-version.test.ts scripts/release-prepare.test.ts scripts/cli-options.test.ts scripts/changelog-weekly.test.ts scripts/claude-plugin-compression.test.ts scripts/catalog-payload-assets.test.ts scripts/host-registry-assets.test.ts scripts/catalog-preview-temp.test.ts scripts/backfill-block-previews.test.ts scripts/catalog-hosted-files.test.ts scripts/player-cdn-pin.test.ts scripts/registry-cdn-pins.test.ts scripts/studio-runtime-smoke.test.mjs scripts/verify-packed-manifests.test.mjs scripts/rewrite-relative-import-extensions.test.mjs scripts/lint-skills.test.mjs scripts/check-core-skills.test.mjs scripts/creator-editing-recipes.test.mjs packages/gcp-cloud-run/check-dockerfile-workspaces.test.mjs packages/core/scripts/writeGeneratedFile.test.ts scripts/catalog-publication.test.mjs scripts/ci/resolve-workflow-pr.test.mjs scripts/lefthook-order.test.mjs scripts/inline-gsap.test.mjs scripts/ci/flake-gate.test.mjs scripts/ci/motion-blur-nightly-report.test.mjs scripts/ci/base-file.test.mjs scripts/ci/release-only-diff.test.mjs scripts/check-catalog-source-pr.test.mjs scripts/generate-registry-items.test.ts scripts/catalog-drift.test.ts scripts/catalog-fetch-mirror.test.ts scripts/catalog-script-inlining.test.ts scripts/catalog-detail.test.ts scripts/generate-catalog-pages.test.ts scripts/verify-catalog-payloads.test.ts scripts/registry-theme-fallbacks.test.ts scripts/registry-skill-files.test.ts scripts/creator-editing-capabilities.test.mjs scripts/generate-catalog-previews.test.ts scripts/registry-primitive-payloads.test.ts registry/components/pan-stations/pan-stations.test.mjs registry/components/filmed-screen/filmed-screen.test.mjs registry/components/echo-smear/echo-smear.test.mjs registry/examples/path-traced-3d/source/path-traced-3d.test.mjs && vitest run scripts/catalog/ scripts/contrastRatchet.test.ts scripts/generate-catalog-payloads.test.ts", "typecheck:scripts": "tsc --noEmit -p scripts/tsconfig.json", "test:skills": "HYPERFRAMES_MEDIA_HOME_REQUIRED=1 node --import ./packages/cli/scripts/test-home.mjs --test 'skills/**/*.test.mjs' 'packages/cli/src/media-use/**/*.test.mjs'", "generate:previews": "tsx scripts/generate-template-previews.ts", diff --git a/scripts/mcp-registry-watch.mjs b/scripts/mcp-registry-watch.mjs new file mode 100644 index 0000000000..5402c3c712 --- /dev/null +++ b/scripts/mcp-registry-watch.mjs @@ -0,0 +1,72 @@ +// Fails when the MCP registry lists a server under a HeyGen namespace at a name and version server.json never held. +import { execFileSync } from "node:child_process"; +import { pathToFileURL } from "node:url"; + +const REGISTRY = "https://registry.modelcontextprotocol.io/v0.1/servers"; +// heygen.com and every subdomain (the registry's DNS and HTTP logins grant both), and the GitHub org. +const OURS = ["com.heygen/", "com.heygen.", "io.github.heygen-com/"]; + +/** Every name@version among server.json's texts. @param {string[]} texts */ +export function publishedListings(texts) { + const published = new Set(); + for (const text of texts) { + try { + const { name, version } = JSON.parse(text); + if (name && version) published.add(`${name}@${version}`); + } catch {} + } + return published; +} + +/** @param {{ server: { name: string, version: string } }[]} servers @param {Set} published */ +export function unexpectedListings(servers, published) { + return servers + .map(({ server }) => `${server.name}@${server.version}`) + .filter((id) => OURS.some((prefix) => id.startsWith(prefix)) && !published.has(id)); +} + +function serverJsonHistory() { + const git = (...args) => + execFileSync("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }); + return git("log", "--format=%H", "--", "server.json") + .split("\n") + .filter(Boolean) + .map((sha) => { + try { + return git("show", `${sha}:server.json`); + } catch { + return ""; + } + }); +} + +async function registryListings() { + const servers = []; + let cursor = ""; + do { + const url = new URL(REGISTRY); + url.searchParams.set("search", "heygen"); + url.searchParams.set("limit", "100"); + if (cursor) url.searchParams.set("cursor", cursor); + const response = await fetch(url); + if (!response.ok) throw new Error(`${url} answered ${response.status}`); + const page = await response.json(); + servers.push(...page.servers); + cursor = page.metadata?.nextCursor ?? ""; + } while (cursor); + return servers; +} + +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + const servers = await registryListings(); + const unexpected = unexpectedListings(servers, publishedListings(serverJsonHistory())); + if (unexpected.length) { + console.error( + `::error::the MCP registry lists HeyGen servers server.json never held: ${unexpected.join(", ")}`, + ); + process.exit(1); + } + console.log( + `${servers.length} listing(s) checked; every HeyGen one is a name and version server.json held`, + ); +} diff --git a/scripts/mcp-registry-watch.test.mjs b/scripts/mcp-registry-watch.test.mjs new file mode 100644 index 0000000000..e0b5a26df4 --- /dev/null +++ b/scripts/mcp-registry-watch.test.mjs @@ -0,0 +1,40 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { publishedListings, unexpectedListings } from "./mcp-registry-watch.mjs"; + +const listing = (name, version) => ({ server: { name, version } }); + +test("a listing under a HeyGen namespace that server.json never held is unexpected", () => { + const published = new Set([ + "io.github.heygen-com/hyperframes@1.0.0", + "com.heygen/hyperframes@1.0.0", + ]); + const servers = [ + listing("io.github.heygen-com/hyperframes", "1.0.0"), + listing("com.heygen/hyperframes", "1.0.0"), + listing("io.github.heygen-com/hyperframes", "1.0.1"), + listing("io.github.heygen-com/other", "0.1.0"), + listing("com.heygen/hyperframes-x", "9.9.9"), + listing("com.heygen.docs/hyperframes", "1.0.0"), + listing("com.heygenx/hyperframes", "1.0.0"), + listing("io.github.someone/heygen-tools", "1.0.0"), + ]; + assert.deepEqual(unexpectedListings(servers, published), [ + "io.github.heygen-com/hyperframes@1.0.1", + "io.github.heygen-com/other@0.1.0", + "com.heygen/hyperframes-x@9.9.9", + "com.heygen.docs/hyperframes@1.0.0", + ]); +}); + +test("what this repo published is every name and version server.json has held", () => { + const history = [ + '{"name": "com.heygen/hyperframes", "version": "1.0.0"}', + '{"name": "io.github.heygen-com/hyperframes", "version": "1.0.0"}', + "not json", + ]; + assert.deepEqual([...publishedListings(history)].sort(), [ + "com.heygen/hyperframes@1.0.0", + "io.github.heygen-com/hyperframes@1.0.0", + ]); +});