Skip to content

Conversation

@gpeal
Copy link
Contributor

@gpeal gpeal commented Nov 4, 2025

Motivation and Context

Codex has gotten internal and external reports of MCP servers frequently logging out (openai/codex#6164).

I tracked it down to the fact that auth.rs was using an in-memory expires-at which is only set on initial token exchange. Instead, this PR switches it to use the expires-at set in the credentials that are passed in.

How Has This Been Tested?

Validated with the notion mcp that it had an expired token, did not refresh the token before and does now.

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Nov 4, 2025
auth.rs was using an in-memory expires-at which is only set on initial token exchange.
Instead, this PR switches it to use the expires-at set in the credentials that are passed in.
@gpeal gpeal force-pushed the gpeal/refresh-token-fix branch from c02f1b5 to be2bc3e Compare November 4, 2025 21:09
@alexhancock alexhancock merged commit dcbeb9b into modelcontextprotocol:main Nov 4, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Nov 3, 2025
gpeal added a commit to openai/codex that referenced this pull request Nov 5, 2025
@enriquemorenotent
Copy link

The problem persists in 0.54

@alexhancock
Copy link
Contributor

@enriquemorenotent Do you mean 0.8.4 and above?

cc @gpeal

Holovkat pushed a commit to Holovkat/codex-pro that referenced this pull request Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants