Remote MCP servers that use OAuth normally want you to open the /mcp panel inside a session. On a headless box reached over SSH, there’s no browser to open. The shell command handles that case.
claude mcp login sentry
sentry is just the example name from the docs. Use the name of a server you’ve already configured. The command runs that server’s OAuth flow straight from your shell, so you don’t need an interactive session first. To clear the stored credentials later, run claude mcp logout <name>.
When no local browser is available, such as over SSH or on Linux without a display server, the command prints the authorization URL instead of trying to open one. Open the URL on your own machine, then paste the full redirect URL from the browser’s address bar back at the prompt. Add --no-browser to force the URL prompt even when a browser is detected:
claude mcp login sentry --no-browser
The caveat is the paste step. The command needs an interactive terminal for it, so connect with ssh -t or the prompt has nowhere to read from. It works for HTTP and SSE servers and for claude.ai connector servers, although connectors follow their own steps for authorizing again from the shell.
If a server insists on a pre-registered redirect URI, the docs also describe --callback-port to pin the port. Claude Code picks a random free port by default.
I’d use this for any server on a remote machine. The browser-less flow is a small thing until you need it.
Further reading: Claude Code docs: authenticate from the command line