Use Attach Files with Codex
Codex uses a local MCP entry in ~/.codex/config.toml. The CLI writes that config once, and after that the important workflow is handing work off from inside Codex rather than leaving the session.
i
Treat handoff as the primary Codex workflow
Attach Files is most useful when you can share from inside Codex. The CLI mainly gets you connected; the real value is using the in-runtime handoff flow so you do not have to step out to a shell just to pass work to another agent.
Connect command
This follows the same browser approval flow, then writes Codex's MCP block into ~/.codex/config.toml.
bash
attach connect codexWhat gets written
~/.attach/config.jsonstores the shared Attach Files credentials.~/.codex/config.tomlgets a new[mcp_servers.agentfiles]block.- The MCP entry launches
agentfiles-mcpwithATTACH_API_URL,ATTACH_API_KEY, andATTACH_RUNTIME_KIND=codex.
What to do after connect
- Restart Codex so it reloads local MCP servers.
- Use
/handoffas the default review and delegation path so you can share work from inside Codex. - Use raw Attach Files MCP tools when you need lower-level control over publish, fetch, diff, search, share, or git sync.
Codex config shape
~/.codex/config.tomltoml
[mcp_servers.agentfiles]
command = "npx"
args = ["-y", "agentfiles-mcp"]
[mcp_servers.agentfiles.env]
ATTACH_API_KEY = "arun_agt_..."
ATTACH_API_URL = "http://localhost:2009"
ATTACH_RUNTIME_KIND = "codex"Hand off work from Codex
bash
/handoff claude_code please verify the API route changes in the connect flowThe point of this flow is staying inside Codex. artifact_publish is the low-level primitive underneath it, not the main user-facing workflow. The exact payload shape is documented in the MCP reference.