Skip to content

Ship pre-bundled upstream-registry schema variant#92

Closed
rdimitrov wants to merge 1 commit intomainfrom
ship-bundled-upstream-registry-schema
Closed

Ship pre-bundled upstream-registry schema variant#92
rdimitrov wants to merge 1 commit intomainfrom
ship-bundled-upstream-registry-schema

Conversation

@rdimitrov
Copy link
Copy Markdown
Member

Summary

Adds upstream-registry.bundled.schema.json as a new release asset alongside the existing raw upstream-registry.schema.json. The bundled variant replaces the two remote $refs that point at https://static.modelcontextprotocol.io/schemas/.../server.schema.json with inline placeholder objects, so consumers rendering the schema with a JSON-Schema viewer don't have to resolve them at runtime.

Raw schema stays as the canonical source — purely additive, no existing consumers affected.

Motivation

stacklok/docs-website renders this schema using the Docusaurus JSON-Schema viewer plugin. That plugin can't resolve remote $refs at render time, so docs-website runs a post-download bundling step via @apidevtools/json-schema-ref-parser. Shipping a pre-bundled variant lets the consumer just use it directly.

Part of the docs-website automation rollup in PR #748, alongside two related PRs on toolhive (#4982 CRD tarball + #4983 re-exported core schemas). Together these let docs-website stop running any transform scripts during release-doc regeneration.

What's in this PR

  • .github/workflows/release.yml: one new step that runs jq over upstream-registry.schema.json and writes a bundled variant to build/upstream-registry.bundled.schema.json. Uses jq (already on the runner) — no new dependencies, no new Node/tooling footprint in this Go library.
  • The bundled file is added to the existing gh release upload call.

The jq filter only touches the two specific remote $refs to the MCP server schema. Other $refs (e.g., the skill schema self-reference) are left intact.

Test plan

Local smoke test:

jq '
  (.. | objects | select(.["$ref"] == "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json")) |=
    {
      type: "object",
      description: "MCP server object — see MCP server schema: https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json"
    }
' registry/types/data/upstream-registry.schema.json > /tmp/bundled.schema.json

# Confirm no MCP-server $refs remain:
jq '[.. | objects | .["$ref"]? | select(. != null and (contains("static.modelcontextprotocol.io")))] | length' /tmp/bundled.schema.json
# Should print: 0

Verified locally that:

  • .properties.data.properties.servers.items transforms to {type: object, description: "..."}
  • .properties.data.properties.groups.items.properties.servers.items transforms the same way
  • The sanity check fails loudly if the MCP server URL ever changes and the filter doesn't match

Notes

  • If MCP bumps to a new schema version (/2026-xx-xx/ in the URL), the sanity check fails with a clear "URL may have changed; update the jq filter" message. That's the intended feedback loop.
  • This PR doesn't touch the raw schema's own $ref structure — it just produces a bundled SIBLING file.

🤖 Generated with Claude Code

Adds a `upstream-registry.bundled.schema.json` release asset alongside
the raw schema. The bundled version replaces the two remote $refs to
the MCP server schema with inline placeholder objects that carry the
schema URL in their descriptions.

Motivation: JSON-Schema viewer plugins (in particular the one used by
stacklok/docs-website) cannot resolve remote $refs at render time, so
they currently run a post-download bundling step themselves. Shipping
a pre-bundled variant lets them skip that step. The raw schema stays
as the canonical source — existing consumers are unaffected.

Purely additive: one new release asset, no changes to the existing
uploads. Uses jq (already on the runner) — no new dependencies or
tooling in this repo.

Paired with the docs-website automation rollup in
stacklok/docs-website#748.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rdimitrov
Copy link
Copy Markdown
Member Author

Closing per discussion on the downstream PR — the bundling logic is docs-renderer-specific (JSON-Schema viewer can't resolve remote $refs at render time) and is better kept colocated with the renderer in stacklok/docs-website rather than added to a pure-Go library repo. Existing scripts/bundle-upstream-schema.mjs on the docs side stays.

Thanks for your time.

@rdimitrov rdimitrov closed this Apr 21, 2026
@rdimitrov rdimitrov deleted the ship-bundled-upstream-registry-schema branch April 21, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant