Skip to content

Codex CLI now supports project-local config (.codex/config.toml) — CodexTarget.supportsLocation('local') is stale #1531

Description

@shortFisherman

Summary

src/installer/targets/codex.ts still claims Codex CLI has no project-local config concept, but OpenAI Codex has since added a first-class project config layer (.codex/config.toml in the repo root). This makes the global only label stale and prevents per-project installs for Codex users.

Evidence

The supportsLocation('local') => false logic traces back to this comment in codex.ts:

"Codex CLI as of 2026-05 has no project-local config concept — everything lives under ~/.codex/."

That is no longer accurate:

  1. Official layering modelcodex-rs/config/src/loader/README.md in openai/codex documents the config layer stack, where Project config (.codex/config.toml) is layer 4, above the user config layer (~/.codex/config.toml, layer 6). Layers merge recursively top-over-bottom.

  2. mcp_servers is read from the merged effective configcodex-rs/core/src/mcp.rs builds McpConfig via runtime_config(&Config) where Config is the merged layer stack output, and configured_mcp_servers / effective_mcp_servers consume that catalog. So a [mcp_servers.codegraph] table in a project's .codex/config.toml is honored, project-scoped.

  3. Verified on Codex CLI 0.147.0 (2026-08): an MCP server declared in <project>/.codex/config.toml shows up in codex mcp list inside that project and nowhere else.

Suggested change

  • CodexTarget.supportsLocation('local') → return true (optionally version-gated: only for Codex builds that ship the project layer, with a graceful fallback to global for older ones).
  • local install should write [mcp_servers.codegraph] to <project>/.codex/config.toml and the marker-fenced CodeGraph section to the project-root AGENTS.md (mirroring the opencode target's local behavior — Codex already reads project-root AGENTS.md).
  • uninstall --location=local should roll those back, and detect(loc) should check <project>/.codex/config.toml for an existing [mcp_servers.codegraph] table.

Why it matters

CodeGraph's whole install story is "wire up only the agents you use, per project when possible". Codex is currently the one agent that forces a global install, which leaks the MCP server into every Codex session on the machine — exactly what the local location exists to avoid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions