Repository navigation
Description
What version of Codex CLI is running?
0.136.0
What subscription do you have?
Plus
Which model were you using?
gpt-5.5
What platform is your computer?
Windows 11
What issue are you seeing?
After logging in to an OAuth streamable HTTP MCP server with:
codex mcp login
Codex logs in and stores OAuth credentials successfully. The identity provider is Keycloak, and the login creates a Keycloak regular SSO session and also stores a refresh token with offline_access.
In Codex CLI 0.136.0, once the regular SSO OAuth access token expires, running:
/mcp
causes Codex to show no available tools for that MCP server. The FastMCP server shows HTTP 401.
This used to work in 0.135.0.
What steps can reproduce the bug?
-
Configure a streamable HTTP MCP server using OAuth.
-
Use Keycloak as the OAuth provider.
-
Ensure the OAuth login grants offline_access and returns a refresh token.
-
Run:
codex mcp login
-
Start Codex CLI 0.136.0.
-
Confirm /mcp initially lists the MCP tools.
-
Wait until the access token expires, without letting the refresh token expire.
-
Run /mcp again.
-
Observe that Codex lists no tools for the MCP server.
-
Check the MCP server logs.
What is the expected behavior?
If Codex has a valid OAuth refresh token for an MCP server, it should refresh the expired token before MCP initialization or tool listing, then continue using tools without requiring new login.
Additional information
This appears to be a regression related to rmcp bump between 0.135.0 and 0.136.0.
- 0.135.0 used rmcp 0.15.0.
- 0.136.0 uses rmcp 1.7.0.
The likely cause is how RMCP handles OAuth token expiry.
- In rmcp 0.15.0,
AuthorizationManager::get_access_token()refreshed if refresh_token().is_some()and the token was expired. - In rmcp 1.7.0, refresh depends on both
expires_inand RMCPtoken_received_at.
Activity
Savlar commentedon Jun 5, 2026
I'm closing this since it appears to be fixed by #26482, specifically the squash commit
4de7a2b9d8(fix(rmcp): refresh expired OAuth tokens before startup).The root cause seems to be the
rmcp 1.7.0behavior change where missing expiry is treated as unknown, so Codex-loaded expired OAuth credentials could be used as-is during MCPstartup. #26482 changes Codex to mark known-expired persisted MCP OAuth tokens with
expires_in = 0, which causes RMCP to refresh before the first initialize request.That matches this issue’s symptom: after the access token expires,
/mcpcreates/initializes an MCP client, sends the stale bearer, gets401, and shows no tools.