`codex mcp get --json` omits the configured `required` flag

Aperta Adatta ai principianti
#56,057 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@akhil9tiet ci sta già lavorando.

Dal 22/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

Inizia da codex-rs/cli/src/mcp_cmd.rs, dove run_get crea l’oggetto JSON, e controlla come legge la configurazione del server MCP. Aggiungi all’output il valore configurato di required e coprilo con un test di integrazione che carichi required = true e verifichi il JSON. Il lavoro è terminato quando codex mcp get docs --json include "required": true.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

codex-cli 0.163.0

What subscription do you have?

Not relevant. This is a local configuration command.

Which model were you using?

Not relevant. The command does not start a model turn.

What platform is your computer?

Linux x86_64

What terminal emulator and version are you using?

zsh 5.9. The terminal does not matter here because the command is non-interactive.

Codex doctor report

Not included because this reproduction uses an isolated CODEX_HOME and does not depend on machine state.

What issue are you seeing?

codex mcp get docs --json omits required when the server is configured with required = true. The command exits successfully and prints the other server settings, so users and scripts cannot determine from this output whether the server is required.

The CLI reference says this command prints the raw config entry: https://learn.chatgpt.com/docs/cli/reference

What steps can reproduce the bug?

Run this with Codex CLI 0.163.0:

test_home="$(mktemp -d)" && printf '%s\n' '[mcp_servers.docs]' 'command = "printf"' 'required = true' > "$test_home/config.toml" && CODEX_HOME="$test_home" codex mcp get docs --json

The output is:

{
  "name": "docs",
  "enabled": true,
  "disabled_reason": null,
  "transport": {
    "type": "stdio",
    "command": "printf",
    "args": [],
    "env": null,
    "env_vars": [],
    "cwd": null
  },
  "enabled_tools": null,
  "disabled_tools": null,
  "startup_timeout_sec": null,
  "tool_timeout_sec": null
}

required is absent.

What is the expected behavior?

The JSON should include the configured value:

"required": true
Additional information

McpServerConfig retains this value in codex-rs/config/src/mcp_types.rs:244-248:

https://github.com/openai/codex/blob/2a77e82f09212c9e1bbf02656afca5d8172c5f9e/codex-rs/config/src/mcp_types.rs#L244-L248

run_get manually builds the JSON object in codex-rs/cli/src/mcp_cmd.rs:999-1012 and does not copy server.required:

https://github.com/openai/codex/blob/2a77e82f09212c9e1bbf02656afca5d8172c5f9e/codex-rs/cli/src/mcp_cmd.rs#L999-L1012

The smallest fix is to add "required": server.required to that object and cover it with an integration test that loads required = true and checks the JSON output.

Lingua principale
Rust
Stelle
131k
Fork
20.7k
Merge medio
1m
PR unite (30g)
997

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openai/codex

Tutte le issue di openai/codex

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.