pub fn install_codex_mcp_config() -> Result<bool>Expand description
Merge sqz’s MCP server entry into Codex’s user-level config.toml.
Codex reads MCP servers from ~/.codex/config.toml (or
$CODEX_HOME/config.toml when set). The relevant TOML shape is:
[mcp_servers.sqz]
command = "sqz-mcp"
args = ["--transport", "stdio"]Notes:
- Key is
mcp_servers(snake_case). JSON-tool users who writemcpServerswill be quietly ignored by Codex. - We go through
toml_editso the user’s existing comments, key order, and formatting are preserved across the round-trip. Plaintoml::from_str → toml::to_stringwipes comments.
Idempotent: if [mcp_servers.sqz] is already present with a command
field, we do not overwrite — the user may have tuned it. Returns
Ok(false) in that case.
If the config file doesn’t exist yet, it is created with only sqz’s
entry (and its parent ~/.codex/ directory is created on demand).