# Browser automation in Codex: the config.toml setup

> Give OpenAI Codex a browser MCP server that remembers websites: the config.toml block and how to check it works.

Canonical: https://dejo.run/docs/codex

> For AI agents: the index of this site is https://dejo.run/llms.txt, and every page is also served as markdown (add .md to its address, or send Accept: text/markdown).

**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](https://dejo.run/blog/codex-browser).

## 1. Install Dejo

```bash
pip install dejo-mcp
playwright install chromium
```

## 2. Add it to Codex

Either run:

```bash
codex mcp add dejo -- dejo-mcp
```

Or add this to `~/.codex/config.toml` yourself:

```toml
[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

```bash
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:

```toml
[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:

```toml
[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](https://dejo.run/docs/sign-in).


## FAQ

## 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.

## Related

- [Dejo MCP server setup: install in a minute](https://dejo.run/docs)
- [Browser automation in Claude Code: add a browser MCP](https://dejo.run/docs/claude-code)
- [Cursor browser automation with a browser MCP](https://dejo.run/docs/cursor)
- [Keep your AI agent signed in to websites](https://dejo.run/docs/sign-in)
- [When a website changes: how Dejo replays safely](https://dejo.run/docs/when-the-site-changes)
- [Dejo MCP tools reference](https://dejo.run/docs/tools)
- [Troubleshooting Dejo](https://dejo.run/docs/troubleshooting)
