Docs/Codex
Coding agents

Codex

Add the Sai MCP server to OpenAI Codex.

View as Markdown

Codex reads MCP servers from ~/.codex/config.toml. The same npx command that Claude Code uses works here.

Install

bash
codex mcp add sai --env SAI_API_KEY=sapi_... -- npx -y @simular-ai/sai-mcp

Or edit the config by hand:

toml
[mcp_servers.sai]
command = "npx"
args = ["-y", "@simular-ai/sai-mcp"]
# sai_task_wait holds for up to 110 s; Codex's default tool timeout is 60 s.
tool_timeout_sec = 120

[mcp_servers.sai.env]
SAI_API_KEY = "sapi_..."

Restart Codex after editing the file.

Verify

bash
codex mcp list

Then ask:

Use Sai to open the Downloads folder on my computer and list the five newest files.

Tools and loop

The tool set and the start, wait, approve loop are the same as in Claude Code. Codex calls sai_task_wait repeatedly until status is idle.

Gotchas

  • Codex has no equivalent of Claude Code channels, so there is no push mode. Polling through sai_task_wait is the only path.
  • Keep the key out of the repository. ~/.codex/config.toml is per user; a project-level .codex/config.toml is committed by default in many repositories.
  • Codex applies its own timeout to tool calls, 60 seconds by default. sai_task_wait can hold for up to 110 seconds, so set tool_timeout_sec = 120 as above. A wait that returns early can be called again with the returned cursor.
  • The Codex app shows the task view in the conversation but keeps it offline, so the screen can't stream there. Open the watch_url link instead; see Watch Sai work.
  • sai_task_wait retries a gateway 502, 503 or 504 on its own before reporting an error.