Browser automation in Codex
The short answer: add Dejo to ~/.codex/config.toml as an MCP server, and Codex can open sites, click, fill in forms and read results. The first time Codex does a task on a site, it explores and Dejo learns the route. After that, the same task is one tool call.
You need Python 3.11 or newer and Codex. The Codex CLI and IDE extension have no built-in browser; here is what works where.
1. Install Dejo
pip install dejo-mcp
playwright install chromium
2. Add it to Codex
Either run:
codex mcp add dejo -- dejo-mcp
Or add this to ~/.codex/config.toml yourself:
[mcp_servers.dejo]
command = "dejo-mcp"
The Codex CLI, the IDE extension and the ChatGPT desktop app share this file, so Dejo shows up in all three.
3. Check it is connected
codex mcp list
You should see dejo. Inside Codex, /mcp lists the servers that are running. If Dejo is missing or fails to start, run dejo doctor.
4. Ask for something
Start a new Codex session and ask in your own words:
Go to github.com/microsoft/playwright and tell me how many open issues it has.
The first time, Codex learns the site: dejo_run shows the page, and Codex sends the steps in its next call. Ask again in a new session and dejo_run answers in one call.
Timeouts
Codex gives a server 10 seconds to start and 60 seconds per tool call, unless you change it. Most Dejo calls finish well inside that. If a slow site needs longer, raise it for Dejo only:
[mcp_servers.dejo]
command = "dejo-mcp"
tool_timeout_sec = 180
Settings
Dejo's settings are environment variables. In config.toml they go in an env table:
[mcp_servers.dejo]
command = "dejo-mcp"
[mcp_servers.dejo.env]
DEJO_PROFILE = "/home/you/.dejo/profile-b"
Sites that need a sign-in: see Signing in.
FAQ
Does this work in the Codex IDE extension too?
Yes. The Codex CLI, the IDE extension and the ChatGPT desktop app share the same config.toml, so adding Dejo once makes it available in all of them.
Does the Codex CLI have a browser of its own?
No. OpenAI's docs say Browser isn't available in Codex CLI or the Codex IDE extension; it is in the ChatGPT desktop app. A browser MCP server such as Dejo gives the CLI and IDE one. More in the Codex browser post on this site.
Can Codex use a browser MCP server?
Yes. Add a browser MCP server such as Dejo or Playwright MCP to ~/.codex/config.toml and Codex can open pages, click, fill in forms and read results through it. With Dejo, a task Codex has done once is one tool call after that.
Do I need an OpenAI key for Dejo?
No. Dejo never calls a model. Codex does the thinking; Dejo is the browser and the memory.