How to Authenticate Remote MCP Servers in Claude Code Using /mcp or CLI Login
Remote MCP servers such as Sentry, Linear, and Notion require browser-based authentication before they can be used in Claude Code, and appear with a 'Needs authentication' status until sign-in is completed. Users can authenticate either by running the /mcp command within an active session and selecting 'Authenticate', or by using the claude mcp login command directly from the shell. Authentication tokens are stored securely and refreshed automatically, with Claude Code triggering the sign-in flow when a server returns a 401 or 403 HTTP response. On headless or SSH environments without a display server, Claude Code prints the authorization URL instead of opening a browser, requiring the user to visit it manually and paste back the redirect URL. For servers that do not support Dynamic Client Registration, users must manually register an OAuth app and supply credentials via flags such as --client-id, --client-secret, and --callback-port.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in