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 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

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
MCP OAuth: opencode mcp auth doesn't refresh token in active sessions#21702
Copy link
Assignees
rekram1-node

Description

@duke8253
duke8253
opened on Apr 9, 2026
Issue body actions

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

  1. Connect to an OAuth-enabled MCP server (Streamable HTTP transport)
  2. Wait for the token to expire or be invalidated server-side
  3. Run opencode mcp auth <server> — completes successfully
  4. MCP calls still fail with auth errors
  5. 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

  1. duke8253
    added
    bugSomething isn't working
    on Apr 9, 2026
  2. github-actions commented on Apr 9, 2026

    @github-actions
    github-actionsBot
    on Apr 9, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • Remote MCP OAuth: browser never opens for re-authentication after session loss #16893: Remote MCP OAuth re-authentication after session loss (browser never opens)
    • Reauthentication with Jira MCP via Oauth doesn't work #5953: Reauthentication with MCP OAuth doesn't work
    • Opencode not handling expired refresh_tokens #13998: Not handling expired refresh tokens (closed)

    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.

  3. duke8253 commented on Apr 9, 2026

    @duke8253
    duke8253
    on Apr 9, 2026
    Author
    More actions

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

    • Remote MCP OAuth: browser never opens for re-authentication after session loss #16893: Remote MCP OAuth re-authentication after session loss (browser never opens)
    • Reauthentication with Jira MCP via Oauth doesn't work #5953: Reauthentication with MCP OAuth doesn't work
    • Opencode not handling expired refresh_tokens #13998: Not handling expired refresh tokens (closed)

    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.

    Reacted by Ashish Singh
  4. aks24k commented on Apr 22, 2026

    @aks24k
    aks24k
    on Apr 22, 2026
    More actions

    Having same problem for JIRA mcp.

    Reacted by unicoder-oss
  5. thdxr
    assigned
    rekram1-node
    on May 3, 2026
  6. thdxr
    removed
    bugSomething isn't working
    on May 3, 2026
  7. GreenStage
    added a commit that references this issue on May 12, 2026

    fix: serialize mcp-auth.json mutations with EffectFlock to prevent co…

    This issue will close once commit 9f552c1 is merged into the 'dev' branch.
    9f552c1
  8. github-actions commented on Jul 3, 2026

    @github-actions
    github-actionsBot
    on Jul 3, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  9. github-actions
    closed this as not plannedon Jul 3, 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.