Store the raw token in the environment
bearer_token_env_var names an environment variable. Its value is the raw WPGuard token, without a Bearer prefix. Codex adds the Authorization scheme when it connects.
Point Codex at WPGuard’s Streamable HTTP endpoint and name the environment variable that holds the raw token. Codex can then inspect registered sites and prepare supported WordPress edits for review.
Codex CLI, desktop and IDE · Shared host config · Environment-backed bearer token
Add a Streamable HTTP table to ~/.codex/config.toml, or use a trusted project’s .codex/config.toml. Store the token in the named environment variable before starting Codex.
[mcp_servers.wpguard]
url = "http://127.0.0.1:8642/mcp"
bearer_token_env_var = "WPGUARD_TOKEN_ADMIN"bearer_token_env_var names an environment variable. Its value is the raw WPGuard token, without a Bearer prefix. Codex adds the Authorization scheme when it connects.
The Codex CLI, desktop app, and IDE extension share MCP configuration on the same host. A project config applies only to a trusted project. Review the official Codex MCP documentation →
First confirm that Codex loaded the server. Then confirm that the server can identify and inspect the intended WordPress site.
Run codex mcp list or open /mcp. Restart the desktop app or IDE extension after changing its MCP settings. A missing environment variable leaves Codex without the bearer credential WPGuard requires.
Call site_list before any site mutation. A successful empty list proves the MCP connection and shows that registration is the next step. Follow it with wp_site_context for the selected staging site.
127.0.0.1 refers to the machine where Codex is running. A remote execution environment needs its own authenticated HTTPS route to WPGuard. Do not expose the local HTTP endpoint directly to the public internet.
Codex can prompt before write-capable MCP tools. WPGuard’s guarded writes still require their own matching packet and state checks. One approval surface does not prove that another person reviewed the change.
The useful request names the registered site, the field to inspect, the desired value, and the condition that must remain true.
Use apply=False for supported option, post-meta, and post-content changes. Review the old value, proposed value, correction result, state tag, and digest. Approve and apply the same request only when those details match.
Read the stored value after the write. Open the page in a browser for layout, responsive behavior, interaction, accessibility, and link checks. WPGuard’s stored-value verification is not a rendered-page test.
The WPGuard Codex example uses the same environment-backed bearer setting documented by OpenAI.
Load the server. List the sites. Preview one supported change.