Repository navigation
fix(registry/types): accept any value for non-ToolHive publisher-provided keys - #374
Merged
Merged
Conversation
…ided keys
The publisher-provided schema required every key outside the
io.github.stacklok namespace to be an object. The upstream MCP Registry
server.json spec places no such constraint, and its own documented
example uses plain values ("tool": "publisher-cli", "version": "1.2.3").
Such server.json documents failed validation, and because registry
files validate as a whole, one of them made an entire file or Git source
fail to sync in toolhive-registry-server. Other keys may now hold any
JSON value; the io.github.stacklok namespace is still fully validated.
Also fix ServerExtensions.Validate, which validated a single server's
extensions against the schema root instead of the server_extensions
definition. It only rejected input because scalar fields such as
status were not objects at the root, so it rejected valid extensions
too. It now wraps the extensions in the ToolHive namespace before
validating.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rdimitrov
enabled auto-merge (squash)
October 14, 2026 10:15
JAORMX
approved these changes
Oct 14, 2026
rdimitrov
disabled auto-merge
October 14, 2026 10:30
rdimitrov
added a commit
to stacklok/toolhive-registry-server
that referenced
this pull request
Oct 14, 2026
## Summary Bumps `github.com/stacklok/toolhive-core` from v0.0.50 to v0.0.53 to pick up stacklok/toolhive-core#374. Before that fix, the `publisher-provided` schema required every key outside `io.github.stacklok` to be an object. A server.json that follows the upstream MCP Registry spec's own example failed validation: ```jsonc "_meta": { "io.modelcontextprotocol.registry/publisher-provided": { "tool": "publisher-cli", "version": "1.2.3", "buildInfo": { "commit": "abc" } } } ``` File and Git sources validate the whole registry file, so a single server like this made the **entire source** fail to sync. API sources and `POST /v1/entries` don't run that check, so the same server.json was already accepted there. ## Dependency changes The diff is large because v0.0.53 requires newer versions of many shared dependencies; Go then upgrades everything else in the module to match. The only other direct dependencies that move are small bumps: `prometheus/client_golang` v1.25.0, `aws/smithy-go` v1.28.5 and `golang.org/x/term` v0.47.0. The rest are indirect, including `golang.org/x/net` v0.61.0 and `grpc` v1.84.0. ## Testing - `go build ./...` and `go test ./...` pass. - Integration tests pass for `internal/authz`, `internal/app/...` and `internal/sync/...`. - A temporary test (not committed) confirmed that a file source containing the upstream example above now syncs and keeps the `publisher-provided` data. It was rejected before. - Grype (`--only-fixed --fail-on high`) reports no vulnerabilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
publisher-provided.schema.jsonrequired every key under_meta["io.modelcontextprotocol.registry/publisher-provided"]other thanio.github.stacklokto be an object:The upstream MCP Registry server.json spec doesn't constrain this. Its own documented example uses plain values:
That example failed our validation with
tool: Invalid type. Expected: object. In toolhive-registry-server this goes throughValidateUpstreamRegistryBytes, which validates a registry file as a whole, so one such server made an entire file or Git source fail to sync. API sources andPOST /v1/entriesdon't run this check, so the same server.json was accepted there.Changes
io.github.stacklokmay now hold any JSON value. Theio.github.stackloknamespace is still validated as before.ServerExtensions.Validate(): this validated a single server's extensions ({status, tier, ...}) against the schema root instead of theserver_extensionsdefinition. It only returned errors because scalar fields likestatusweren't objects at the root, so it rejected valid extensions as well, which the old test locked in as "non-empty struct fails schema structure". It now wraps the extensions as{"io.github.stacklok": {"server": ...}}before validating, so the real definition applies. Error paths therefore includeio.github.stacklok.server.as a prefix. No callers were found in toolhive, toolhive-registry-server, dockyard or toolhive-catalog.Tests
ValidatePublisherProvidedExtensionsBytes:io.github.stackloknamespace is still validated when it sits next to plain values;io.github.stacklokitself must still be an object.ValidateServerJSON: a server whose publisher-provided metadata has plain values validates with extension checking enabled.ServerExtensions.Validate: an empty struct fails (missingstatus), a valid struct passes, and an unknowntierfails.task testandtask license-checkpass.task lintcouldn't run locally: the installedgolangci-lintwas built with an older Go than 1.27 and fails to typecheck.go vetandgofmtare clean.🤖 Generated with Claude Code