.. _2026-03-17-mcp-oauth-token-refresh-fix_release: ================================================================================= 2026-03-17 - MCP OAuth Token Refresh Fix ================================================================================= Release ================== AgileData.io - Stay Logged In: MCP OAuth Token Refresh Resolved **What was happening:** AI agents connecting to AgileData via the MCP server were losing their authentication after approximately 10 minutes. OAuth tokens were failing to refresh correctly, causing `400 Bad Request` errors on the `/mcp` endpoint. Users would need to re-authenticate their AI tools—like Claude Desktop—to resume their session. This was caused by a bug in the FastMCP library affecting how OAuth token context variables were propagated in the server after initial authentication. Token refresh logic was also miscalculating TTL values, leading to premature token expiry. **What was fixed:** * Upgraded FastMCP to 2.14.5, which includes fixes for OAuth token refresh * Token context variables now propagate correctly after server restarts * TTL calculations for OAuth token storage corrected * ContextVar propagation fixed for ASGI-mounted servers **What this means for you:** * AI agent connections to AgileData stay authenticated beyond the initial 10-minute window * No more unexpected disconnections when using Claude Desktop or other MCP-compatible AI tools * Longer, uninterrupted AI-assisted workflows without re-authentication prompts Last Refreshed =========================== *Doc Refreshed: 2026-03-17*