Skip to content

fix(publisher): omit repository when URL cannot be detected#1149

Open
JosephDoUrden wants to merge 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:fix/empty-repository-uri
Open

fix(publisher): omit repository when URL cannot be detected#1149
JosephDoUrden wants to merge 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:fix/empty-repository-uri

Conversation

@JosephDoUrden
Copy link
Copy Markdown

Summary

When detectRepoURL() cannot determine the repository (no git remote, no package.json repository field), return an empty string instead of a placeholder URL (https://github.com/YOUR_USERNAME/YOUR_REPO). This causes createServerJSON() to omit the repository field entirely, preventing schema validation failures on publish.

Fixes #613

Problem

mcp-publisher init generated a repository object with a placeholder URL that fails the uri format validation on publish. 88 published servers in the official registry had this issue.

Change

  • cmd/publisher/commands/init.go: detectRepoURL() returns "" instead of placeholder when no repo is found
  • The existing guard in createServerJSON() (if repoURL != "" && repoSource != "") already handles this correctly — it omits the repository when URL is empty

Test plan

  • go build ./cmd/publisher/... compiles
  • go test ./cmd/publisher/commands/... passes
  • Manual: mcp-publisher init in a directory without git remote or package.json repo — verify no repository field in generated server.json
  • Manual: mcp-publisher init in a git repo — verify repository is populated correctly

AI Disclosure

AI assistance (Claude) was used for issue research. The implementation was written and reviewed by the author.

Return an empty string from detectRepoURL() when no repository can be
determined, instead of a placeholder URL. This causes createServerJSON()
to omit the repository field entirely, avoiding schema validation
failures from empty or placeholder URI values on publish.

Fixes modelcontextprotocol#613
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.

Empty registry uri fails schema (caused by mcp-publisher)

1 participant