Skip to content

Unauthenticated streamable HTTP MCP servers are reported as SSE errors instead of missing auth #16247

Closed

Description

@jonahsnider

Description

If you connect to a streamable HTTP MCP server that doesn't support SSE, running /status in the TUI will show you that OpenCode encountered an error when connecting. This is kinda true, but it should then try using streamable HTTP, which would then get a 401 and prompt the user to authenticate.

Plugins

N/A

OpenCode version

1.2.18

Steps to reproduce

  1. Add an MCP server that supports streamable HTTP, but not SSE (ex. the Sanity MCP)
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "sanity": {
          "type": "remote",
          "url": "https://mcp.sanity.io",
          "oauth": {}
        }
      }
    }
  2. Run opencode and then /status
  3. Observe that the sanity MCP server says "SSE error: Non-200 status code (405)", instead of saying the server needs to be authenticated via OAuth

Screenshot and/or share link

Screenshot of /status in OpenCode TUI

Operating System

macOS 26.3

Terminal

Ghostty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 6, 2026
  2. github-actions commented on Mar 6, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct from the above, feel free to clarify the differences.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. bcdady commented on Jun 10, 2026

    @bcdady

    Additional symptom: the same transport mismatch surfaces during opencode mcp auth <server> for the GitLab MCP server. After completing the browser OAuth flow successfully, the CLI reports:

    ■  Authentication failed
    │
    ■  SSE error: Non-200 status code (404)
    

    The token is actually stored correctly — re-running mcp auth gitlab immediately shows it as already authenticated. The 404 comes from OpenCode attempting an SSE connection to verify post-auth state against a server that only supports Streamable HTTP. The auth itself succeeds; the failure message is a false negative from the transport fallback gap.

  5. rekram1-node commented on Jun 24, 2026

    @rekram1-node
    Contributor

    Closing because the reported transport-order bug is fixed in current dev. Remote MCP connection now tries Streamable HTTP before legacy SSE, and a recognized OAuth/authentication error stops fallback rather than being replaced by an SSE 404/405. If a current server still masks a Streamable HTTP auth response, please open a focused reproduction with current-version logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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