GeezerVison is showing github.com — MCP OAuth: opencode mcp auth doesn't refresh token in active sessions · Issue #21702 · anomalyco/opencode
MCP OAuth: opencode mcp auth doesn't refresh token in active sessions #21702
Description
Description
After re-authenticating an OAuth MCP server with opencode mcp auth , the new token is written to disk but the running MCP connection still uses the stale one.
opencode mcp debug confirms: shows authenticated with a valid token and future expiry, but the HTTP connection test returns 401 Unauthorized. The only workaround is restarting opencode entirely.
Expected: opencode mcp auth should refresh the active MCP connection with the new token, or there should be an opencode mcp reconnect command to re-establish the connection.
Plugins
none
OpenCode version
1.4.1
Steps to reproduce
- Connect to an OAuth-enabled MCP server (Streamable HTTP transport)
- Wait for the token to expire or be invalidated server-side
- Run
opencode mcp auth <server> — completes successfully
- MCP calls still fail with auth errors
opencode mcp debug <server> shows valid token but 401 on test
Screenshot and/or share link
No response
Operating System
macos 26.4
Terminal
iTerm2
Reacted by Roshan Rathod and Valentin Delaye
Activity
github-actions commented on Apr 9, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is specifically about the running session not picking up a newly written token (stale in-memory connection), it may be distinct from these — but please review to confirm.
duke8253 commented on Apr 9, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is specifically about the running session not picking up a newly written token (stale in-memory connection), it may be distinct from these — but please review to confirm.
It's not a duplicate of any of them.
In my case, the authentication succeeds without any problems, meaning it opens a browser and all checks are fine. But after the authentication, opencode still can't fetch anything through the mcp server, and I had to close the process to do a full restart of opencode.
aks24k commented on Apr 22, 2026
Having same problem for JIRA mcp.
added a commit that references this issue
on May 12, 2026This issue will close once commit 9f552c1 is merged into the 'dev' branch.9f552c1 github-actions commented on Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
Metadata
Metadata
Development
No branches or pull requestsIssue actions