# CueApril for Codex

Connect Codex to CueApril's MCP server and tell it when to test pull requests. Full guide: https://app.cueapril.com/agents/README.md

## Automatic setup

```bash
npx -y cueapril@latest init --agents codex
```

Or use `uvx cueapril init --agents codex` with Python 3.10+ and Node.js 20+ installed. This reuses `CUEAPRIL_API_KEY` or asks for one browser approval, installs the server and skill at user level, and preserves other configuration. Restart the client or reload MCP after setup. For one-prompt setup and secure key entry, see https://app.cueapril.com/agents/install.md.

## Before you start

- An organisation administrator creates an agent key in CueApril under Settings, Integrations, Agent access. CueApril shows the key only once.
- Put the key in the `CUEAPRIL_API_KEY` environment variable, for example from your secret manager. Never commit it or paste it into a prompt.

## Files in this folder and where to save them

| File | Save as |
|---|---|
| `config.toml` | Merge its tables into `~/.codex/config.toml` |
| `AGENTS-snippet.md` | Paste its section into the `AGENTS.md` at the root of your repository |
| `../cueapril-qa/SKILL.md` | `~/.codex/skills/cueapril-qa/SKILL.md`, if your Codex release reads Agent Skills |

## Add the server

Either run:

```bash
codex mcp add cueapril --url https://app.cueapril.com/mcp --bearer-token-env-var CUEAPRIL_API_KEY
```

or merge `config.toml` into `~/.codex/config.toml`:

```toml
[mcp_servers.cueapril]
url = "https://app.cueapril.com/mcp"
bearer_token_env_var = "CUEAPRIL_API_KEY"
tool_timeout_sec = 60

[mcp_servers.cueapril.tools.cueapril_start_assessment]
approval_mode = "approve"
```

- Codex stores only the variable's name, never the key.
- `tool_timeout_sec = 60` leaves room for `cueapril_wait_for_assessment`, which holds a call for up to 50 seconds.
- `codex exec` cannot answer approval prompts. The last table pre-approves `cueapril_start_assessment` only.

Check the connection with `codex mcp list`, or `/mcp` inside Codex.

## Use it

```bash
codex exec "Push this branch, then test its pull request with CueApril and fix any failures."
```

With the `AGENTS.md` section in place, Codex runs the loop after it pushes: start, wait until the assessment finishes, read the failures, fix, push again. An assessment takes 20 to 75 minutes. `incomplete` is never a pass.
