GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — MCP with oauth doesn't work · Issue #5444 · anomalyco/opencode

MCP with oauth doesn't work #5444

New issue
Copy link
New issue
Copy link
Closed
Closed
MCP with oauth doesn't work#5444
Copy link
Assignees
rekram1-node

Description

@klaudworks
klaudworks
opened on Dec 12, 2025
Issue body actions

Description

Configured MCP like this inside my project:

"mcp": {
  "jira": {
    "type": "remote",
    "url": "https://mcp.atlassian.com/v1/sse"
  }
},

opencode mcp auth jira shows:

opencode mcp auth jira

┌  MCP OAuth Authentication
│
▲  No OAuth-enabled MCP servers configured
│
●  Add OAuth config to a remote MCP server in opencode.json:
│
●
│    "mcp": {
│      "my-server": {
│        "type": "remote",
│        "url": "https://example.com/mcp",
│        "oauth": {
│          "scope": "tools:read"
│        }
│      }
│    }
│
└  Done
Image

I thought it may also help to try to invoke the tools and then the Oauth process will start but the agent doesn't know the tools.

OpenCode version

1.0.150

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 26.1

Terminal

iTerm 2

Reacted by Chindriș Mihai - Alexandru
Reacted by Ivan Gavrilov

Activity

  1. klaudworks
    added
    bugSomething isn't working
    on Dec 12, 2025
  2. github-actions
    added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 12, 2025
  3. github-actions commented on Dec 12, 2025

    @github-actions
    github-actionsBot
    on Dec 12, 2025 – with GitHub Actions
    Contributor
    More actions

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

    • [FEATURE]: Allow to enable MCP on a per-agent basis #5373: [FEATURE]: Allow to enable MCP on a per-agent basis (related MCP configuration challenges)
    • [FEATURE]: Support MCP servers that require POST-based or non-standard SSE handshake #5371: [FEATURE]: Support MCP servers that require POST-based or non-standard SSE handshake (related MCP server compatibility)
    • Remote MCPs with auth header broke in latest update #5328: Remote MCPs with auth header broke in latest update (related to MCP authentication in recent versions)
    • {env:...} variable substitution inconsistently fails for specific MCP server URLs #5299: {env:...} variable substitution inconsistently fails for specific MCP server URLs (related to MCP configuration and environment variables)

    Feel free to ignore if none of these address your specific case.

  4. rekram1-node
    removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 12, 2025
  5. rekram1-node
    self-assigned this
    on Dec 12, 2025
  6. shamil2
    added a commit that references this issue on Dec 14, 2025

    fix: MCP OAuth auth commands now recognize remote servers as OAuth-en…

    This issue will close once commit 805af91 is merged into the 'dev' branch.
    805af91
  7. jmhill commented on Dec 19, 2025

    @jmhill
    jmhill
    on Dec 19, 2025
    More actions

    I got the same issue (opencode mcp auth atlassian failed with the same message about No Oauth-enabled MCP servers configured), but when I set up opencode.json to use the local proxy instead, I was able to use Atlassian MCP. Not a solution, but hopefully a workaround that could help.

    {
    	"$schema": "https://opencode.ai/config.json",
    	"mcp": {
    		"atlassian": {
    			"type": "local",
    			"command": ["npx", "-y", "mcp-remote", "https://mcp.atlassian.com/v1/sse"]
    		}
    	}
    }
    
    Reacted by Chindriș Mihai - Alexandru, Marcelo Avancini and Ivan Gavrilov
  8. daraghscopey commented on Dec 19, 2025

    @daraghscopey
    daraghscopey
    on Dec 19, 2025
    More actions

    I got a similar issue in trying to connect the linear remote mcp server.

    I had to add this "oauth": {} to the config, and then when I ran opencode mcp auth linear it properly kicked off the auth flow.

    {
        "$schema": "https://opencode.ai/config.json",
        "mcp": {
            "linear": {
                "type": "remote",
                "url": "https://mcp.linear.app/mcp",
                "enabled": true,
               "oauth": {}
            }
        }
    }
    Reacted by Nico Duldhardt, Jeon Suyeol, Chindriș Mihai - Alexandru, AceLan Kao, Tim Dittler, Aleksandr Kirillov, ravshan-oxagile, Ted Mahsun, Andreas Ellwanger, Ivan Gavrilov and 1 more
    Reacted by Ivan Gavrilov
  9. klaudworks commented on Dec 19, 2025

    @klaudworks
    klaudworks
    on Dec 19, 2025
    Author
    More actions

    thank you. adding "oauth": {} actually fixed it.

  10. tedmahsun commented on Feb 1, 2026

    @tedmahsun
    tedmahsun
    on Feb 1, 2026
    More actions

    For me what worked was changing the http://127.0.0.1 url (on the page that failed) to http://localhost. :/

    Reacted by Matt Jackson, Farkas, Marco Matteo Buzzulini and Gizmo
    Reacted by mw00120 and eomidilets
  11. seannetlife commented on Feb 11, 2026

    @seannetlife
    seannetlife
    on Feb 11, 2026
    More actions

    fyi. sometimes i have to explicitly logout and log back in to reauthenticate

    opencode mcp logout atlassian
    opencode mcp auth atlassian
    
  12. snarkipus commented on Mar 8, 2026

    @snarkipus
    snarkipus
    on Mar 8, 2026
    More actions

    For me what worked was changing the http://127.0.0.1 url (on the page that failed) to http://localhost. :/

    This worked for me as well for linear ... I assumed it was a WSL'ism.

    Reacted by Gurvan and Nikhil Gupta
  13. sghng commented on Mar 11, 2026

    @sghng
    sghng
    on Mar 11, 2026
    More actions

    For me what worked was changing the http://127.0.0.1 url (on the page that failed) to http://localhost. :/

    This doesn't work for me. Here's what I did on Firefox:

    1. When the OAuth web page is stuck at "waiting for 127.0.0.1", open developer panel.
    2. Go to network, find the GET request, double click.
    3. It loads the request into URL bar. The URL looks something like http://127.0.0.1:19876/mcp/oauth/callback?code=xxx&state=xxx
    4. Changing 127.0.0.1 to localhost, and hit enter

    This didn't work.

    Reacted by David
  14. chendeshen commented on Mar 28, 2026

    @chendeshen
    chendeshen
    on Mar 28, 2026
    More actions

    solved my issue

  15. gurvancampion commented on Apr 23, 2026

    @gurvancampion
    gurvancampion
    on Apr 23, 2026
    More actions

    For me what worked was changing the http://127.0.0.1 url (on the page that failed) to http://localhost. :/

    This worked for me as well for linear ... I assumed it was a WSL'ism.

    This worked for me in my WSL environment setup

    Reacted by Gizmo
  16. thdxr
    removed
    bugSomething isn't working
    on May 3, 2026
  17. windseason commented on May 29, 2026

    @windseason
    windseason
    on May 29, 2026
    More actions

    this doesn't work for me.

    Bug Report: Linear MCP Authentication Fails Despite Valid Credentials

    Environment

    • OpenCode Version: 1.0.150 (matching GitHub issue MCP with oauth doesn't work #5444)
    • Platform: macOS (Darwin)
    • Date: 2026-05-29

    Problem Summary

    The linear MCP server shows as "connected" in opencode mcp list, but all tool invocations fail with invalid_token — even immediately after successful OAuth authentication.

    Configuration Used

    {
      "mcp": {
        "linear": {
          "type": "remote",
          "url": "https://mcp.linear.app/mcp",
          "enabled": true,
          "oauth": {}
        }
      }
    }

    Steps to Reproduce

    1. Configure Linear MCP in ~/.config/opencode/opencode.json with "oauth": {}
    2. Run opencode mcp auth linear and complete OAuth flow successfully
    3. Restart OpenCode to pick up config changes
    4. Verify connection: opencode mcp list shows ✓ linear connected
    5. Attempt to invoke any Linear MCP tool (e.g., linear_get_issue)

    Expected Behavior

    MCP tool should execute successfully using the authenticated OAuth token.

    Actual Behavior

    Failed to connect to MCP server "linear".
    URL: https://mcp.linear.app/mcp
    Reason: Streamable HTTP error: Error POSTing to endpoint: 
    {"error":"invalid_token","error_description":"Missing or invalid access token"}
    

    Debug Output (opencode mcp debug linear)

    ●  Auth status: ✓ authenticated
    ●    Access token: 22dadc00-c1d4-4da0-b...
    ●    Expires: 2026-05-30T05:46:06.390Z 
    ●    Refresh token: present
    ●    Client ID: J9BKiZgklNri5DVI
    ◇  HTTP response: 401 Unauthorized
    ●  WWW-Authenticate: Bearer realm="OAuth", resource_metadata="https://mcp.linear.app/.well-known/oauth-protected-resource/mcp", error="invalid_token", error_description="Missing or invalid access token"
    ▲  Server returned 401 Unauthorized
    

    Key Observations

    • Token IS obtained: debug shows valid access token and refresh token present
    • Auth flow succeeds: opencode mcp auth linear confirms "already has valid credentials"
    • Connection check passes: mcp list shows ✓ linear connected
    • HTTP test fails: The debug HTTP probe gets 401 Unauthorized from Linear's server
    • Native tools work fine: linear_get_issue (non-MCP) successfully fetches issue ACENOTE-1443
    • Tool execution fails: Only the actual tool invocation hits the auth error

    Root Cause Analysis

    The OAuth token acquisition works correctly (token is present, not expired, refresh token available), but OpenCode's MCP client is not properly attaching the token to HTTP requests when invoking tools. The 401 Unauthorized + WWW-Authenticate: Bearer response from Linear's server indicates the Authorization header is either:

    1. Missing entirely from tool invocation requests
    2. Malformed (wrong prefix, encoding, or format)
    3. Not being sent through the Streamable HTTP transport layer
  18. rekram1-node commented on Jun 24, 2026

    @rekram1-node
    rekram1-node
    on Jun 24, 2026
    Member
    More actions

    Closing because the original report is fixed: remote MCP OAuth is now enabled by default unless oauth: false, so an explicit oauth: {} block is no longer required. This thread has since accumulated unrelated callback, WSL, and Linear token symptoms. Please open a focused current-version issue for any remaining provider-specific failure; note that mcp debug intentionally performs an unauthenticated probe, so its 401 alone does not show that tool requests omit the OAuth token.

  19. rekram1-node
    closed this as completedon Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.