-
Notifications
You must be signed in to change notification settings - Fork 555
Description
Is your feature request related to a problem? Please describe.
If I am missing a bigger vision here, feel free to close the issue.
The server.json request body provided to the /v0/publish endpoint is minimally versioned. The shape of the JSON appears to the follow the ServerDetail model and the related model in the OpenAPI YAML.
There appears to be a coupling between the "input" (publish), "output" (get-by-ID), and DB models in the code (ServerDetail).
After the initial launch, I wonder how schema changes will be handled, whether breaking (e.g. property rename) or non-breaking (e.g. new optional property).
Suppose someone publishes a JSON to the registry at the very beginning, then we later introduce a new, required property. The existing JSON in MongoDB will not have the new property but will be returned as-is to the end user (or perhaps break on unmarshal). This could lead to variety on the schema returned to reads of the API.
If the intent is to flow the original schema (as the MCP extension author provided it) to the consumer, then I the current code will work as long as we don't introduce breaking changes.
But what about a property rename? Will a data fix-up/backfill be performed?
Describe the solution you'd like
Without trying to fix the whole schema versioning thing at once I propose a schema version be provided at publish time so the publish code/scripts can express concretely "I am giving you a server detail of version X". The server could reject or map the input if the version differs from what is expected. Or this could be included in MongoDB and used for smarter unmarshal at query/read time.
This schema version could be a root JSON property, a query parameter, or an api-version=0.1 in the Content-Type (many options).
Given this is v0 of the API I think we could allow ourselves to have breaking changes but accept a schema version as input and reject/map old schema versions that could come in to the publish endpoint.
Describe alternatives you've considered
Declare /v0/publish shape will never change (or never have breaking changes) and describe what "non-breaking changes" might look like.
Additional context
I want to describe the current server.json schema version in my NuGet + MCP authoring docs so that it's easy for authors to see that they are using an old docs/template version and to check MCP registry docs for what they need to fix up in their server.json.
In other words, I'm planning for potential schema changes :)