Skip to content

Claude Code HTTP transport fails: OAuth discovery endpoint returns 404 #26

@kinelhu

Description

@kinelhu

When connecting via Claude Code's HTTP MCP transport, the connection fails with:

HTTP 404: Invalid OAuth error response: SyntaxError: JSON Parse error: Unexpected identifier "Not". Raw body: Not Found

Root cause

Claude Code's HTTP MCP client performs OAuth 2.0 discovery before connecting, by hitting:

GET https://mcp.data.gouv.fr/.well-known/oauth-authorization-server

This endpoint returns a plain-text Not Found (HTTP 404). Claude Code then tries to parse that as a JSON OAuth error response, fails, and aborts the connection.

Expected behavior

The server should either:

  • Return a valid JSON response at /.well-known/oauth-authorization-server indicating no authentication is required, or
  • Return a properly-formatted JSON error (e.g. {"error": "..."}) so the client can handle it gracefully

Workaround

None currently

Environment

  • Client: Claude Code
  • Configured via: claude mcp add --transport http datagouv https://mcp.data.gouv.fr/mcp
  • The MCP endpoint itself responds correctly (verified via curl with appropriate headers)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions