Claude Code MCP says Needs authentication. Finish browser OAuth
`! Needs authentication` means the MCP server is up and needs browser OAuth or a token. Open `/mcp` or `claude mcp login`. It is not Failed to connect. Short answer: 5 steps. 1) Read Needs authentication as an auth gate, not a dead server; 2) Authenticate from /mcp or claude mcp login; 3) If the browser doesn’t open or the redirect fails, finish the callback manually; 4) Separate OAuth from a bad Authorization header; 5) Re-check status, then use the tools.
Last updated: · This page is the decision checklist; the tools list for “Fix Claude Code MCP Needs authentication (OAuth)” is a separate URL.
How do I finish browser OAuth when Claude Code MCP says Needs authentication?
Read Needs authentication as an auth gate, not a dead server
`claude mcp list` or `/mcp` shows `! Needs authentication` when the host responded but Claude Code still needs a browser OAuth sign-in or a static token via `--header`. `✘ Failed to connect` / `Connection error` mean the process or URL never came up—those need a different fix. Quickstart: https://code.claude.com/docs/en/mcp-quickstart
Authenticate from /mcp or claude mcp login
In an interactive session run `/mcp`, select the server, and choose Authenticate (or Re-authenticate if a refresh failed). From Claude Code v2.1.186 you can also run `claude mcp login <name>` in your shell without opening the panel. Complete the provider’s browser sign-in; Claude Code stores and refreshes tokens. Docs: https://code.claude.com/docs/en/mcp
If the browser doesn’t open or the redirect fails, finish the callback manually
Copy the URL shown in the terminal and open it yourself. If the browser redirect fails with a connection error after you approve access, paste the full callback URL from the address bar into the URL prompt in Claude Code. For servers that require a pre-registered redirect URI, add the server with `--callback-port` so the callback matches `http://localhost:PORT/callback`.
Separate OAuth from a bad Authorization header
If you set `headers.Authorization` (or a headers helper) and the server rejects that header with 401/403, Claude Code reports a failed connection instead of offering OAuth—fix or remove the header, then authenticate. Token-only hosts (for example GitHub’s MCP) take `--header "Authorization: Bearer …"` at `claude mcp add` time and do not use the browser flow.
Re-check status, then use the tools
After a successful sign-in, `/mcp` or `claude mcp list` should show Connected. If a mid-session tool call returns 401 and Re-authenticate appears, run it once before retrying. Non-interactive `claude -p` / Agent SDK runs cannot complete OAuth for you—authorize in an interactive session first, then rerun the headless job.
Which tools are best to fix Claude Code MCP Needs authentication (OAuth)?
Authenticate with remote MCP servers
OAuth 2.0 flow, token refresh, callback URL paste, and --callback-port.
Connect to MCP servers (quickstart)
Status meanings including Needs authentication and the Sentry OAuth walkthrough.
Connect Claude Code to tools via MCP
claude mcp add / login details and remote server auth options.
Claude Code troubleshooting
When to run /mcp and claude doctor for connection and auth issues.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Fix Claude Code MCP Needs authentication (OAuth)” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.