Submit a toolSubmit

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.

The problem: `! 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.

How do I finish browser OAuth when Claude Code MCP says Needs authentication?

  1. 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

  2. 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

  3. 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`.

  4. 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.

  5. 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.

All tools for “Fix Claude Code MCP Needs authentication (OAuth)” →

Related fixes

See also AI tools launched today on the daily board.