Skip to content

fix: detect non-interactive shells in auth login and publish#709

Open
arjunkmrm wants to merge 1 commit intomainfrom
fix/smi-1698-cli-non-interactive-auth
Open

fix: detect non-interactive shells in auth login and publish#709
arjunkmrm wants to merge 1 commit intomainfrom
fix/smi-1698-cli-non-interactive-auth

Conversation

@arjunkmrm
Copy link
Copy Markdown
Collaborator

Summary

  • smithery auth login: Detects non-interactive shells (!process.stdin.isTTY) and exits with a clear error message instead of hanging while waiting for an OAuth browser callback that will never arrive.
  • smithery mcp publish / ensureApiKey: When no API key is found and the shell is non-interactive, exits with an actionable error ("Run smithery auth login in your terminal first") instead of hanging on an inquirer prompt. Same behavior when an existing key is invalid.
  • Also fixes the error message to reference smithery auth login (was smithery login).

Test plan

  • All 366 existing tests pass
  • Manual: run echo | smithery auth login — should print error and exit immediately
  • Manual: unset SMITHERY_API_KEY and run echo | smithery mcp publish --name test — should print auth error and exit
  • Manual: smithery auth login in a real terminal still works as before

Fixes SMI-1698

🤖 Generated with Claude Code

When `smithery auth login` is run from a non-interactive context (e.g.
Claude Code, scripts, CI), it would hang silently waiting for an OAuth
browser callback. Similarly, `smithery mcp publish` would hang trying
to prompt for an API key via inquirer.

- auth login: detect !process.stdin.isTTY and exit with a clear error
- ensureApiKey: when no API key and no TTY, error instead of prompting
- ensureApiKey: when API key is invalid and no TTY, error instead of
  re-prompting

Fixes SMI-1698

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.

1 participant