[BUG] MCP server with SSE/HTTP transport fails with OAuth discovery error — no way to disable OAuth

Resolved 💬 10 comments Opened Mar 13, 2026 by azatsh Closed May 15, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When adding an MCP server using SSE or HTTP transport via claude mcp add --transport sse|http, Claude Code automatically attempts OAuth discovery by hitting /.well-known/oauth-authorization-server on the server's origin. If the MCP server doesn't implement OAuth (and many don't), the endpoint returns a non-JSON response (e.g., HTML 404 page or empty body), causing a JSON parse failure. There is no flag or configuration option to skip OAuth discovery.

The same MCP server works correctly in Cursor, which does not force OAuth discovery.

What Should Happen?

Claude Code should gracefully handle non-JSON or missing responses from OAuth discovery endpoints without failing the connection.
Ideally, provide a flag to opt out of OAuth entirely, e.g.:
claude mcp add --transport http --no-auth my-server http://localhost:64342/sse

If OAuth discovery fails, Claude Code should fall back to connecting without authentication instead of erroring out.

Error Messages/Logs

HTTP 404: Invalid OAuth error response: SyntaxError: JSON Parse error: Unexpected EOF. Raw body:

Steps to Reproduce

Run any MCP server that uses SSE or HTTP transport but does not implement OAuth (no /.well-known/oauth-authorization-server endpoint).
Add it to Claude Code:
claude mcp add --transport http my-server http://localhost:64342/sse

Claude Code attempts to connect and hits http://localhost:64342/.well-known/oauth-authorization-server.
The server returns a 404 with a non-JSON body (or empty body).
Connection fails with the JSON parse error above.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.74

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗