Added /validate endpoint and modified mcp-publish so that all validation happens there#896
Merged
rdimitrov merged 2 commits intomodelcontextprotocol:mainfrom Feb 4, 2026
Conversation
rdimitrov
approved these changes
Feb 4, 2026
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.
Motivation and Context
Per discussion with @rdimitrov - all validation now happens in a new
/validateendpoint. For details, see below.Breaking Changes
None. Validation on /publish only validates schema version and semantic checks (manual checks) as before. We can add schema validation by changing a flag in the called to
ValidateJSONSchemawhen we're ready.Types of changes
Checklist
Additional context
API Changes
1. New
/validateEndpointA new public endpoint was added for validating
server.jsonfiles without publishing them.Details:
/v0/validateand/v0.1/validatePOSTServerJSON200 OKwithValidationResultcontaining:valid(boolean)issues(array of validation issues with type, path, message, severity, reference)Implementation:
internal/api/handlers/v0/validate.goValidationAlloption:200 OK- validity is indicated inresult.Validfield/v0and/v0.1prefixes2.
/publishEndpoint Validation Flow ChangesThe publish endpoint now validates earlier in the request flow and provides clearer error responses.
Before: Validation was mixed into
ValidatePublishRequest()(which also handled publisher extensions and registry ownership).After:
ServerJSONstructure first usingValidateServerJSON()(schema version + semantic validation)422 Unprocessable Entitywith message: "Failed to publish server, invalid schema: call /validate for details"ValidatePublishRequest()internally for schema validationKey Changes:
CreateServer()call422on schema/semantic validation failures/validateendpoint for detailsValidatePublishRequest()no longer performs schema validation (added note in comments)3.
/editEndpoint Validation Flow ChangesSimilar validation changes were applied to the edit endpoint.
Changes:
ValidateServerJSON()call before server update422with same error message format on validation failure/publishendpoint behavior4. Validator Functions Refactoring
Updated validator functions to reflect that schema validation is now done separately.
Changes to
ValidatePublishRequest():ValidateServerJSON()callChanges to
ValidateUpdateRequest():CLI Changes
1.
validateCommand: Now Uses API EndpointBefore: Performed local validation using
validators.ValidateServerJSON().After: Calls the
/v0/validateendpoint on the registry.Details:
server.jsonand sends it to the registry APIImplementation:
validateViaAPI()function that POSTs to/v0/validateValidationResultresponse from serverprintValidationIssues()for formatting2.
publishCommand: Validation Only on 422 ErrorsBefore: Performed upfront local schema validation before publishing.
After: Attempts publish first, then validates only if server returns 422.
Details:
/v0/validateendpoint to get detailed validation errorsvalidatecommandImplementation Changes:
runValidationAndPrintIssues()callpublishToRegistry()to return HTTP status code alongside response/errorvalidateViaAPI()3. Shared Validation Error Formatting
Before:
runValidationAndPrintIssues()function handled both validation and printing together.After: Refactored to separate printing logic.
Details:
printValidationIssues()function - just prints validation issues (no validation logic)runValidationAndPrintIssues()function (no longer used)validateandpublishcommands useprintValidationIssues()for consistent outputBehavior:
Summary
Both CLI commands now use the
/validateAPI endpoint for validation instead of local validation. Thepublishcommand validates only after receiving a 422 error response, and both commands share the same error formatting viaprintValidationIssues().Benefits