openai / openai/codex

[Windows][MCP OAuth] Fresh startup requires reauthentication despite valid file-stored credentials

Open
#42,978 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auth bug CLI mcp windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of Codex CLI is running?

0.153.4

What subscription do you have?

ChatGPT Plus

Which model were you using?

gpt-5.6-sol high

What platform is your computer?

Windows x64

What terminal emulator and version are you using (if applicable)?

Windows Terminal

Codex doctor report

What issue are you seeing?

codex mcp login mfc_ca succeeds and OAuth credentials are correctly stored in %USERPROFILE%\.codex\.credentials.json.

I verified without exposing token values that the stored credential has:

  • the correct MCP server URL
  • issuer
  • access token
  • refresh token
  • an expiration time in the future
  • read-only Money Forward scopes

However, every fresh Codex CLI startup reports:

The mfc_ca MCP server requires OAuth reauthentication.
MCP startup incomplete (failed: mfc_ca)

The issue also reproduces with Codex 0.154.0-alpha.3 and with features.mcp_2026_07_28=true.

What steps can reproduce the bug?
  1. Configure a remote Streamable HTTP MCP server using OAuth.
  2. Set mcp_oauth_credentials_store = "file".
  3. Run codex mcp logout mfc_ca.
  4. Run codex mcp login mfc_ca.
  5. Complete OAuth successfully in the browser.
  6. Confirm that the OAuth credential is stored and still unexpired.
  7. Start a fresh Codex CLI session.
  8. Codex immediately asks for OAuth reauthentication again.
What is the expected behavior?

No response

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the flow with codex mcp logout mfc_ca, codex mcp login mfc_ca, and a fresh startup, then inspect the credentials in %USERPROFILE%\.codex\.credentials.json. Verify how the fresh session handles the unexpired file-stored OAuth credential on Windows; done means it starts the MCP server without requesting reauthentication.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authentication, cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.