[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: ─────────────────────────────────────────────────────────────
- User connects MCP server
- OAuth flow triggered → User authenticates in browser
- Access token received ✅
- MCP tools work successfully ✅
- [Time passes... access token expires, e.g. after 1 hour]
- LibreChat detects expired token → Connection DROPS ❌
- MCP server disconnects automatically ❌
- User must manually reconnect MCP
- Full OAuth flow triggered AGAIN → User must re-authenticate ❌
- 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
- Connect to an MCP server with OAuth enabled. After successful authentication, the connection works normally for approximately 1–2 hours.
- When the same MCP server is accessed again after this period, the connection is lost, and the OAuth authentication flow is triggered again.
- 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
_Screenshots
Code of Conduct
- I agree to follow this project's Code of Conduct
Source: danny-avila/LibreChat