`codex doctor` suggests setting MCP env vars when an MCP server is just unreachable

Closed Beginner friendly
#58,509 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cli, rust

Research direction

The misleading hint is set once for any non-OK mcp status in codex-rs/cli/src/doctor.rs around lines 1673-1689. Read that block and how missing_env and the reachability results feed into it. Make the hint depend on which problem actually occurred, then reproduce with the steps in the issue and check that an unreachable server no longer mentions env vars.

Written by the indexing model from the issue text.

Description

bug CLI connectivity mcp
What version of Codex CLI is running?

codex-cli 0.166.0 (also reproduces on 0.164.0)

What subscription do you have?

Pro

Which model were you using?

None, no model call involved.

What platform is your computer?

macOS 26.6, arm64

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

No response

Codex doctor report
[!!] mcp          MCP configuration has optional issues - Set the missing MCP env vars or disable the affected server.
    configured servers       1
    disabled servers         0
    streamable_http servers  1
    optional reachability    dead: http://127.0.0.1:1/mcp (HEAD connect failed; GET connect failed)
What issue are you seeing?

When a streamable HTTP MCP server can't be reached, the mcp check tells you to set missing env vars. No env var is missing. The server is just down.

The remediation is set once for any non-OK status, but that status can come from unreachable servers alone, with missing_env empty:

https://github.com/openai/codex/blob/67f0994b532b8740f14b5b738af7b7b2a915b1d6/codex-rs/cli/src/doctor.rs#L1673-L1689

What steps can reproduce the bug?
export CODEX_HOME=$(mktemp -d)
codex mcp add dead --url http://127.0.0.1:1/mcp
codex doctor --no-color --ascii
What is the expected behavior?

The hint should match the cause. Something like "Check that the server URL is reachable, or disable the server" for unreachable servers, and the env var hint only when env vars are actually missing.

Additional information

No response

Dominant language
Rust
Stars
131k
Forks
20.7k
Avg merge
1m
Merged PRs (30d)
997

Getting set up

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.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.