Skip to content

fix(publisher): preserve original JSON field casing (fixes #1110)#1275

Open
tamish-max wants to merge 1 commit intomodelcontextprotocol:mainfrom
tamish-max:fix/publisher-preserve-json-casing
Open

fix(publisher): preserve original JSON field casing (fixes #1110)#1275
tamish-max wants to merge 1 commit intomodelcontextprotocol:mainfrom
tamish-max:fix/publisher-preserve-json-casing

Conversation

@tamish-max
Copy link
Copy Markdown

Fixes #1110

Problem

publishToRegistry() and validateViaAPI() unmarshal server.json then re-marshal through Go structs. This made field naming dependent on struct tags — when tags were snake_case, the API received snake_case and returned 422.

Fix

  • Send original JSON bytes directly (after validation via Unmarshal)
  • Added regression tests verifying camelCase field names in wire format

The struct tags were already fixed in PR #488, but this change makes the fix structural — even if tags drift, the original file content is preserved.

Fixes modelcontextprotocol#1110 — The publisher would unmarshal and re-marshal server.json through Go structs, which silently renamed fields to match struct tags. Now sends the original JSON bytes directly (after validation), making field name preservation structural rather than dependent on tag correctness.

Adds regression tests verifying camelCase field names in API requests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

mcp-publisher v1.0.0 converts camelCase package fields to snake_case, causing 422 validation errors

1 participant