Remote MCP server says "Needs authentication" or 401 after it used to work
The error
Why it happens
Hosted MCP servers (Linear, Atlassian, Notion, Vercel, Sentry and others) sign you in with OAuth and keep a token on your computer. Tokens expire, get revoked, or stop matching when the provider changes its endpoint or client registration. Atlassian, for example, notes that some clients need cached client IDs cleared after its move to the v2 endpoint. The fix is to throw away the old sign-in and sign in again.
How to fix it
- Sign in again from your app
Claude Code:/mcp, pick the server, then Clear authentication and authenticate again. Cursor: click Needs login in Customize. Codex:codex mcp login NAME. Gemini CLI:/mcp auth NAME. Devin Desktop: Authenticate on the server.codex mcp login linear # Gemini CLI, inside the app: /mcp auth linear - If you use mcp-remote, clear its saved credentials
mcp-remotestores tokens in~/.mcp-auth. Deleting it forces a fresh sign-in the next time your app starts the server.rm -rf ~/.mcp-auth - Check the URL is current
Providers move endpoints. Atlassian recommendshttps://mcp.atlassian.com/v2/mcp; Linear's ishttps://mcp.linear.app/mcp. Old/sseURLs are being retired (details). - Claude Code: update first
Claude Code 2.1.323 (November 12, 2026) fixed MCP tool calls failing with the sign-in server's error (such asTOKEN_EXPIRED) instead of asking you to sign in again. Claude Code 2.1.325 (November 13, 2026) fixed a server staying on "needs authentication" after a token refresh was refused only for a moment. Claude Code 2.1.327 (November 17, 2026) fixed remote servers staying disconnected after a longer outage such as a VPN drop: most remote servers reached over https are now retried in the background for about a day. Claude Code 2.1.329 (November 19, 2026) fixedclaude mcp loginand/mcpsaying a service doesn't accept sign-ins from Claude Code when the service had retired its client registration (HTTP 410 Gone), and fixed a server signing in again after you cleared its authentication while a token refresh was running. Since 2.1.329, a remote server's page in/mcpalso shows a Server message row with the error the server sent when it refused the connection. Runclaude --versionand update before clearing your sign-in.claude update - Codex: update to 0.170.0 or later
Codex 0.170.0 (November 18, 2026) fixed MCP OAuth sign-ins getting mixed up when a login, logout or cancellation happened at the same time as a token refresh. Codex 0.171.0 (November 19, 2026) fixed enterprise MCP sign-in with identity providers that issue ID tokens without refresh tokens. Update Codex, then runcodex mcp login NAMEagain if the server still says it needs sign-in.codex --version - Using an API key instead?
Some servers accept a key in a header instead of OAuth. Make sure the key hasn't expired and the header is spelled exactly as the provider shows, usuallyAuthorization: Bearer YOUR_KEY.
Related servers
Linear
Linear's official hosted MCP server for finding, creating and updating Linear issues, projects, comments and documents. It uses Streamable HTTP at htt
Atlassian (Jira & Confluence)
Atlassian's official hosted MCP server for Jira, Confluence, Jira Service Management, Bitbucket, Compass and Loom. Atlassian recommends the v2 endpoin
Notion
Official Notion MCP Server
Vercel
Vercel's official hosted MCP server (OAuth) for searching Vercel docs, managing projects and deployments, reading deployment logs and querying Web Ana
Sources
- https://code.claude.com/docs/en/mcp
- https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md
- https://cursor.com/docs/mcp
- https://learn.chatgpt.com/docs/extend/mcp?surface=cli
- https://github.com/openai/codex/releases/tag/rust-v0.170.0
- https://github.com/openai/codex/releases/tag/rust-v0.171.0
- https://geminicli.com/docs/tools/mcp-server/
- https://github.com/punkpeye/mcp-remote
- https://github.com/atlassian/atlassian-mcp-server
- kiro-cli v3: expired MCP OAuth token is never refreshed; server stays "failed" with misleading SSE error: Non-200 status code (405) until secrets.json is edited by hand (GitHub issue, 4 comments)
- Copilot harness: MCP server with oauth.clientId in user mcp.json still triggers Dynamic Client Registration and a client ID prompt (1.143.1) (GitHub issue, 3 comments)