Skip to content

Remote MCP OAuth browser flow never triggered - Datadog MCP silently fails to authenticate #18130

Closed

Description

@nicholascaplan

Description

When a remote MCP server requiring OAuth 2.1 + PKCE is configured (Datadog), OpenCode registers a client ID successfully and writes it to mcp-auth.json, but never initiates the browser-based authorization flow.

The MCP toggles to "loading" then "failed" with:

  • No auth URL surfaced to the user.
  • No browser window opened.
  • No error logged.

The mcp-auth.json entry is left with a clientId but no tokens. For comparison, the Atlassian remote MCP (same type: remote config) completes OAuth successfully and logs transport=StreamableHTTP connected with a full token set.

Plugins

OpenCode version

1.2.15

Steps to reproduce

  1. Add a remote MCP server that requires OAuth to opencode.json:
    {
      "mcp": {
        "datadog": {
          "enabled": true,
          "type": "remote",
          "url": "[https://mcp.datadoghq.eu/api/unstable/mcp-server/mcp?toolsets=core,apm,software-delivery](https://mcp.datadoghq.eu/api/unstable/mcp-server/mcp?toolsets=core,apm,software-delivery)"
        }
      }
    }

Activity

  1. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

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

    If your issue is distinct (i.e., the browser flow never triggered even on the very first attempt, not just after a restart), please add a note clarifying that difference so this can be tracked separately.

  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 18, 2026
  3. Vishal2002 commented on Mar 25, 2026

    @Vishal2002

    I am working on this issue and now it initiate the browser-based authorization flow and saving the codeId and token in mcp-auth.json file as well but the screen is showing the flow is done but the terminal showing
    invalid_grant - Invalid authorization code or code verifier. idk why it is happening but /mcp showing the connected to datadog mcp. Should I raise PR?

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

    @rekram1-node
    Collaborator

    Okay so I tried reproducing and immediately hit the same issue as u, I made a pr to make our error handling better but even when it's better their error isnt rlly enough.

    I did end up figuring out it was because the mcp urls need to be very specific even if u select a different region when doing the oauth flow.

     "datadog": {
          "type": "remote",
    
          // The url I copied from the docs:
          // "url": "https://mcp.datadoghq.com/v1/mcp",
          "url": "https://mcp.us5.datadoghq.com/v1/mcp",
          "enabled": true,
        },
    

    I copied that first url from docs and kept hitting the issue, but I changed to the second one (where my account is based) and it fixed it

    Hope this helps

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