Set up OpenAI Codex
Connect OpenAI Codex to one website with sign-in or a Website API Key, and use the recommended settings for timeouts, large tools, approvals, and long results.
OpenAI Codex can connect to your website through the same MCP server that Claude and ChatGPT use. This guide covers the connection itself and a few Codex settings that make larger Hiveality jobs run smoothly. For an overview of every supported assistant, see AI Tool Connections (MCP).
Before you start
- Install Codex and sign in to it.
- Copy your connection URL from Website Settings → Integrations → AI
Tools. It is your website or app domain with
/api/mcpat the end, for examplehttps://your-site.hiveality.com/api/mcp. - Decide how Codex should sign in:
- Sign-in (OAuth): you approve access in your browser, and Codex keeps the session renewed. Best for working with Codex yourself.
- Website API Key: a key you create and keep in an environment variable. Best for scripts, scheduled jobs, or machines without a browser.
Both methods reach the same tools and are scoped to one website.
Where Codex keeps its settings
Codex reads MCP servers from ~/.codex/config.toml, or from
.codex/config.toml inside a trusted project. Each server is its own
[mcp_servers.name] section. The examples below use the name
hiveality.
Option 1: sign in
Add the server to config.toml:
[mcp_servers.hiveality]
url = "https://your-site.hiveality.com/api/mcp"
Then sign in from your terminal:
codex mcp login hiveality
Your browser opens the Hiveality approval page. Sign in, choose the website, and approve access. Codex stores the session and renews it automatically.
If you are on a machine without a browser, run
codex mcp login hiveality --no-browser. Codex prints a link. Open
it on any device, approve access, then paste the full address you are sent back
to into the terminal.
Option 2: Website API Key
-
Create a key from Reveal Website API Key. It starts with
hvws. Treat it like a password. -
Add the server to
config.tomland tell Codex which environment variable holds the key. Never paste the key itself into the file.[mcp_servers.hiveality] url = "https://your-site.hiveality.com/api/mcp" bearer_token_env_var = "HIVEALITY_API_KEY" -
Set the variable, then start Codex:
export HIVEALITY_API_KEY="hv_ws_your_key_here" codexOn Windows PowerShell, use
$env:HIVEALITY_API_KEY="hv_ws_your_key_here"instead ofexport.
Recommended settings
Codex's defaults suit small tools. Some Hiveality tools do more work in one
call (building pages, importing content, rendering creatives), so add these
lines to the same [mcp_servers.hiveality] section:
[mcp_servers.hiveality]
url = "https://your-site.hiveality.com/api/mcp"
# bearer_token_env_var = "HIVEALITY_API_KEY" # only for the API key method
startup_timeout_sec = 30
tool_timeout_sec = 120
tool_input_schema_max_bytes = 16000
default_tools_approval_mode = "writes"
What each line does:
| Setting | Codex default | Why we recommend the change |
|---|---|---|
startup_timeout_sec = 30 | 10 seconds | Hiveality sends a large tool list when Codex connects. A little more time avoids a failed start on a slow connection. |
tool_timeout_sec = 120 | 60 seconds | A few build and import tools can take longer than a minute. Hiveality allows up to two minutes per call. Longer jobs return a job you can check on, so you never need more than 120. |
tool_input_schema_max_bytes = 16000 | 5,000 bytes | Codex shortens the instructions of very large tools. About 18 Hiveality tools, such as page copy edits, email building, and quiz building, are larger than the default, so this keeps them whole. |
default_tools_approval_mode = "writes" | not set | Codex asks before any tool that changes your website, and runs read-only tools (lists, outlines, reports) without asking. |
Long page outlines
Codex shortens long tool results. Page and blog post outlines can be long on big pages, so give those two tools a larger budget:
[mcp_servers.hiveality.tools.get_page_outline]
output_token_limit = 30000
[mcp_servers.hiveality.tools.get_blog_post_outline]
output_token_limit = 30000
If an outline still looks cut off, ask Codex for one section of the page at a time.
Optional: limit the tools Codex sees
If you only use Codex for some jobs, such as blog work, you can list just the tools you want. Codex then reads a shorter tool list, which keeps more room for your conversation:
[mcp_servers.hiveality]
url = "https://your-site.hiveality.com/api/mcp"
enabled_tools = ["list_blog_posts", "get_blog_post", "create_blog_post", "update_blog_post", "search_docs"]
Use disabled_tools instead to hide only a few tools. Remove the
line to go back to the full set.
Long-running jobs
Codex waits for each tool call to finish. Hiveality runs its longest jobs in the background instead, so they never hit the timeout:
- broken-link scans
- blog imports from another platform
- contact imports and bulk contact updates
- video imports and uploads
When you start one of these, Codex gets a job back right away. Ask Codex to check on it ("check the blog import status") and it reads the progress. You can keep working in the meantime.
Check that it works
Start Codex and ask:
Which Hiveality website are you connected to?
Codex should name your website. If it cannot see any Hiveality tools:
- Run
codex mcp listand confirmhivealityis listed. - For sign-in, run
codex mcp login hivealityagain. - For an API key, check that the environment variable is set in the same terminal where you started Codex, and that the key has not been revoked.
- Start a new Codex session after changing
config.toml. Codex reads the tool list when a session starts, so it also picks up new Hiveality tools this way.
Security
- Only approve access for websites you mean to connect. Each connection reaches one website.
- Keep your Website API Key in an environment variable or a secrets manager.
Never commit
config.tomlwith a key in it, and revoke the key in Website Settings → Integrations if it is ever exposed. - Keep
default_tools_approval_mode = "writes"so you review every change before it reaches your website, and review drafts before you publish.
Related Help Docs
Was this helpful?