Skip to content

Conversation

@majiayu000
Copy link
Contributor

Summary

  • Added proper flag parsing using Go's flag package
  • mcp-publisher publish --file path/to/server.json now works correctly
  • Maintains backward compatibility with positional arguments
  • Improved error messages to show actual file path when custom file not found

Test

# Before: Error: server.json not found
mcp-publisher publish --file .registry/server.json

# After: reads .registry/server.json correctly

Fixes #767

Added proper flag parsing using the flag package so that
'mcp-publisher publish --file path/to/server.json' works correctly.

Also improved error messages to show the actual file path when
a custom file is specified but not found.

Fixes modelcontextprotocol#767

Signed-off-by: majiayu000 <1835304752@qq.com>
@rdimitrov
Copy link
Member

Hey, @majiayu000, unfortunately there's already another PR filed for addressing the same issue prior this one. I'll close this one as the proposed implementation is quite similar to it and it's fair to credit the other one being first.

Feel free to comment there in case you find something it missed although I think we'll probably try to address this by using cobra 👍

Thanks in advance! 🙏

@rdimitrov rdimitrov closed this Jan 3, 2026
@majiayu000
Copy link
Contributor Author

Thanks for the review!

@majiayu000 majiayu000 deleted the fix/publish-file-flag branch January 4, 2026 02:19
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.

publish subcommand's --file flag not working

2 participants