---
title: "Codex"
description: "Add the Unitpost MCP server to OpenAI Codex CLI."
url: https://www.unitpost.com/guides/mcp/codex
section: MCP
updated: 2026-07-24
---
# Codex

## Connection settings

- **Server URL**: https://mcp.unitpost.com/mcp
- **Transport**: Streamable HTTP
- **Auth header**: Authorization: Bearer pk_live_YOUR_KEY (production key from www.unitpost.com)
- **Tools**: one per API operation (emails_send, campaigns_send, …)

## Codex

> Add the Unitpost MCP server to OpenAI Codex CLI.

Paste a short TOML block into `~/.codex/config.toml`, restart Codex, done.

### 1. Create a production API key

Open https://www.unitpost.com → Settings → API keys → create a scoped key. Copy the full `pk_live_…` value (shown once). In every snippet below, replace `pk_live_YOUR_KEY` with that value.

> Must be production. Keys from unitpost.dev only work on the dev API. This MCP URL is production (`mcp.unitpost.com`) — a .dev key returns 401 Invalid API key on tool calls even if the server appears connected.

### 2. Open the Codex config

Edit `~/.codex/config.toml` (create the file if it does not exist).

### 3. Paste this TOML

Replace `pk_live_YOUR_KEY` — keep `Bearer ` inside the quotes.

```toml
[mcp_servers.unitpost]
url = "https://mcp.unitpost.com/mcp"

[mcp_servers.unitpost.http_headers]
Authorization = "Bearer pk_live_YOUR_KEY"
```

> Grant only the scopes the agent needs (e.g. `emails:send` for `emails_send`). Prefer a revocable key dedicated to the agent.

### 4. Restart and verify

Restart Codex so it reloads the config. unitpost tools should be available to the agent.

### 5. Send a test

Ask Codex to send an email from a verified domain and confirm it in Unitpost Activity.

## Related

- [GitHub Copilot](https://www.unitpost.com/guides/mcp/copilot): Use the Unitpost MCP server with VS Code agent mode / Copilot MCP.
- [Gemini CLI](https://www.unitpost.com/guides/mcp/gemini): Register Unitpost as an MCP server for the Gemini CLI.
- [Windsurf](https://www.unitpost.com/guides/mcp/windsurf): Register Unitpost as an MCP server in Windsurf (Cascade).
