GeezerVison is showing github.com — MCP with oauth doesn't work · Issue #5444 · anomalyco/opencode
MCP with oauth doesn't work #5444DescriptionDescription
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
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 Activitygithub-actions commented on Dec 12, 2025 This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case. added a commit that references this issue on Dec 14, 2025This issue will close once commit 805af91 is merged into the 'dev' branch.805af91 jmhill commented on Dec 19, 2025 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 daraghscopey commented on Dec 19, 2025 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 klaudworks commented on Dec 19, 2025 thank you. adding "oauth": {} actually fixed it. tedmahsun commented on Feb 1, 2026 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 seannetlife commented on Feb 11, 2026 fyi. sometimes i have to explicitly logout and log back in to reauthenticate
opencode mcp logout atlassian
opencode mcp auth atlassian
snarkipus commented on Mar 8, 2026
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 sghng commented on Mar 11, 2026
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:
- When the OAuth web page is stuck at "waiting for 127.0.0.1", open developer panel.
- Go to network, find the
GET request, double click.
- 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
- Changing
127.0.0.1 to localhost, and hit enter
This didn't work. chendeshen commented on Mar 28, 2026 gurvancampion commented on Apr 23, 2026
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 windseason commented on May 29, 2026 this doesn't work for me.
Bug Report: Linear MCP Authentication Fails Despite Valid Credentials
Environment
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
- Configure Linear MCP in
~/.config/opencode/opencode.json with "oauth": {}
- Run
opencode mcp auth linear and complete OAuth flow successfully
- Restart OpenCode to pick up config changes
- Verify connection:
opencode mcp list shows ✓ linear connected
- 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:
- Missing entirely from tool invocation requests
- Malformed (wrong prefix, encoding, or format)
- Not being sent through the Streamable HTTP transport layer
rekram1-node commented on Jun 24, 2026 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.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|