#16011·LibreChat

[Bug]: Request to Minimize OAuth Re-Authentication Frequency for MCP Servers

Author: inv-EldhoCreated Sep 16, 2026Updated Sep 16, 2026
Labels🐛 bug

What happened?

Current Broken Flow: ─────────────────────────────────────────────────────────────

  1. User connects MCP server
  2. OAuth flow triggered → User authenticates in browser
  3. Access token received ✅
  4. MCP tools work successfully ✅
  5. [Time passes... access token expires, e.g. after 1 hour]
  6. LibreChat detects expired token → Connection DROPS ❌
  7. MCP server disconnects automatically ❌
  8. User must manually reconnect MCP
  9. Full OAuth flow triggered AGAIN → User must re-authenticate ❌
  10. Repeat every ~1 hour (or whatever provider token TTL is)

This is a significant UX problem — users must re-authenticate repeatedly even though OAuth 2.0

Current vs Required State

# Issue Current State Required State
1 Refresh token storage Not persisted — dropped after OAuth flow completes Persist to MongoDB per userId + serverName
2 Access token storage Held in memory only — lost on server restart Persist to MongoDB — survive restarts
3 Token refresh logic Not implemented — no call to /token endpoint Call /token with grant_type=refresh_token silently
4 Proactive refresh Not implemented — token used until it breaks Refresh proactively 5 min before expiry (configurable buffer)
5 Connection on expiry Drops MCP connection — forces full re-authentication Silent refresh → reconnect transparently, user unaffected

Could you please advice me an solution ?

Version Information

873330b0cd245f67b345c3aaf6bbd3cefc3de230

Steps to Reproduce

  1. Connect to an MCP server with OAuth enabled. After successful authentication, the connection works normally for approximately 1–2 hours.
  2. When the same MCP server is accessed again after this period, the connection is lost, and the OAuth authentication flow is triggered again.
  3. This requires the user to re-initialize OAuth authentication each time the connection expires.

What browsers are you seeing the problem on?

No response

Relevant log output

bash
_

Screenshots

Image

Code of Conduct

  • I agree to follow this project's Code of Conduct