Skip to content

feat(publisher): store token files in unified .mcpregistry/ directory#1148

Open
JosephDoUrden wants to merge 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:feat/unified-token-directory
Open

feat(publisher): store token files in unified .mcpregistry/ directory#1148
JosephDoUrden wants to merge 1 commit intomodelcontextprotocol:mainfrom
JosephDoUrden:feat/unified-token-directory

Conversation

@JosephDoUrden
Copy link
Copy Markdown

Summary

Move GitHub and registry token files from flat .mcpregistry_* paths in the project root into a .mcpregistry/ directory with an auto-generated .gitignore, so users no longer need to manually update their .gitignore.

Closes #663

Changes

  • cmd/publisher/auth/github-at.go:
    • Token files now stored under .mcpregistry/ directory (github_token, registry_token)
    • Added ensureTokenDir() — creates .mcpregistry/ with a .gitignore containing *
    • Added migrateOldTokenFiles() — automatically moves old flat files to the new directory on first read/write
    • Updated all file path references to use the new directory structure
  • cmd/publisher/commands/logout.go:
    • Logout now cleans up both .mcpregistry/ directory and legacy flat files

Backward compatibility

Existing users with old .mcpregistry_github_token / .mcpregistry_registry_token files will have them automatically migrated to .mcpregistry/github_token / .mcpregistry/registry_token on next token read or write. No manual action required.

Test plan

  • go build ./cmd/publisher/... compiles without errors
  • go test ./cmd/publisher/commands/... passes all existing tests
  • Manual: mcp-publisher login github creates .mcpregistry/github_token and .mcpregistry/.gitignore
  • Manual: old flat token files are migrated on next operation
  • Manual: mcp-publisher logout removes .mcpregistry/ directory and any legacy files

AI Disclosure

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

Move GitHub and registry token files from flat .mcpregistry_* paths in
the project root into a .mcpregistry/ directory with an auto-generated
.gitignore containing *, so users no longer need to manually update
their .gitignore.

Old token files are automatically migrated to the new location on first
read or write. The logout command cleans up both old and new paths.

Closes modelcontextprotocol#663
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.

.mcpregistry_* token files should be stored in a unified folder ignored from git

1 participant