Codex integration
On this page
Give Codex web-reading and live-browser tools through Unfenced's remote MCP server. Codex stores the name of your credential variable in its configuration and reads the value when connecting.
Before you start
Install Codex and sign in to Unfenced to create your agent’s API key. Set UNFENCED_TOKEN in the environment that launches Codex. Use your Unfenced key, not your OpenAI API key.
Set UNFENCED_TOKEN in your terminal
Read your Unfenced key privately, then start your client from this same terminal. These variables last for the current terminal session. An app opened from the desktop may not inherit them.
Bash or Zsh
read -r -s UNFENCED_TOKEN
export UNFENCED_TOKENPowerShell 7.1 or later
$env:UNFENCED_TOKEN = Read-Host -MaskInput "Unfenced API key"Register Unfenced
Run this in a terminal with Codex installed:
codex mcp add unfenced --url https://unfenced.ai/api/mcp --bearer-token-env-var UNFENCED_TOKENCheck the saved server with codex mcp list. Start a new Codex session and use /mcp in the CLI to inspect active servers.
The equivalent entry in ~/.codex/config.toml is:
[mcp_servers.unfenced]
url = "https://unfenced.ai/api/mcp"
bearer_token_env_var = "UNFENCED_TOKEN"Choose the command or the config-file method; you do not need both. A desktop app launched outside your terminal may have a different environment, so make the variable available to the process that connects.
Try your first fetch
Ask Codex:
Use Unfenced fetch_page to read https://example.com.
Report the page title, a short summary, and the source URL.Confirm an Unfenced tool call appears. The source should describe Example Domain. Approve the tool call if your Codex policy requires it.
If it does not connect
- Server absent: run
codex mcp listand check the configuration scope you edited. - Unauthorized: check the key and the environment of the running Codex process.
- Server configured but tools absent: start a new session and inspect
/mcp. - Website fetch failed: use the Unfenced failure reference to distinguish a login requirement from a transient error.
What to try next
Use multi-URL research to check external documentation, or read an authenticated website. See official Codex MCP documentation for configuration and approval options.
Configuration reviewed: 2026-10-04. Check the connection in your client before relying on it.