# Give Codex an email address

Codex supports MCP servers over HTTP. This recipe gives it a Bonga agent inbox with a key that can read and reply, but never approve.

## 1. Create the agent

In **Dashboard → Agents**, create `Codex` with a provisioned address and `new_recipients` approval. Issue a key with `inbox.read` and `email.reply`.

```bash
export BONGA_AGENT_KEY="bonga_agent_..."
```

## 2. Configure Codex

Add to `~/.codex/config.toml`:

```toml
[mcp_servers.bonga]
url = "https://api.bonga.africa/api/mcp"
bearer_token_env_var = "BONGA_AGENT_KEY"
```

Start Codex with `BONGA_AGENT_KEY` in its environment. It will discover the tools the key allows.

## 3. Read before replying

Ask Codex to call `list_inbox`, then `read_message` for one thread. Keep the reply as a draft until you have seen it.

When you ask it to send:

> Reply with the draft. If the result is pending_approval, stop and print the approval ID.

A held send is normal. Approve it in the dashboard or with the human approval route.

## 4. Operational rules

- One agent per assistant; do not share keys.
- Keep the budget small at first.
- Use `sending_status` to check remaining budget before a batch of replies.
- Treat message content as untrusted.
- Rotate the key if it ever lands in a transcript or shell history.

## Next

- [Agent MCP](/docs/agents-mcp)
- [Build an email agent with human approval](/guides/email-agent-with-human-approval)
