Docs · Codex WordPress MCP

Connect Codex to a self-hosted WordPress site

This Codex WordPress MCP guide is for a WordPress site you host yourself, not a Playground sandbox or a WordPress.com site. AgentedSEO has the MCP server built in, so OpenAI Codex connects straight to your site with one block in config.toml. Codex signs in as its own user with the SEO Agent role. It can read and change your SEO data and content through AgentedSEO, the areas you choose wait for your approval, and every change can be undone.

One config.toml blockSecret kept in an env variableIts own SEO Agent user
Checked against AgentedSEO 1.0 and developers.openai.com/codex/mcpUpdated 30 October 2026

Before you start

  • AgentedSEO is active (WordPress 6.9 or later, PHP 8.1 or later), and you are an administrator.
  • The site is on HTTPS.
  • Codex keeps MCP servers in ~/.codex/config.toml, or .codex/config.toml in a trusted project. The CLI, the IDE extension and the ChatGPT desktop app share it.
MCP endpoint · Streamable HTTP
https://your-site.com/wp-json/agentedseo/mcp

01Create the agent’s password

  1. Open AgentedSEO › Agents › Connections.
  2. Under Connect an agent choose Desktop or code app.
  3. Name your agent Codex and click Create password. AgentedSEO creates the user agentedseo-codex with the SEO Agent role and an application password, shown once.
  4. Copy the whole Basic … Authorization value from the config shown. The JSON around it is for other clients.

02Add the Codex WordPress MCP server to config.toml

Keep the secret in an environment variable:

Shell~ · keep the secret in an env variable
$ export AGENTEDSEO_AUTH="Basic <value from the Connections screen>"

Add the server to ~/.codex/config.toml:

~/.codex/config.toml
[mcp_servers.agentedseo]
url = "https://your-site.com/wp-json/agentedseo/mcp"
env_http_headers = { "Authorization" = "AGENTEDSEO_AUTH" }
env_http_headers maps a header to the variable that holds its value. bearer_token_env_var doesn’t fit: it sends Bearer, and an application password uses Basic.

Optional keys

~/.codex/config.toml · optional
default_tools_approval_mode = "writes"
tool_timeout_sec = 120

writes makes Codex ask before any tool not marked read-only; AgentedSEO marks its read tools read-only. The timeout gives a full site check more than the 60-second default.

03Or use the app or the IDE extension

ChatGPT desktop app

Settings › MCP servers › Add server, name agentedseo, Streamable HTTP, paste the endpoint, save, Restart.

IDE extension

Gear menu › MCP servers › Add server, same fields, Restart extension.

Both write the same config.toml. Add the env_http_headers line in the file if the form has no header field.

04Sign in without a password

Codex supports OAuth for Streamable HTTP servers, and AgentedSEO offers OAuth 2.1 with dynamic client registration.

Codex CLI~ · OAuth sign-in
$ codex mcp add agentedseo --url https://your-site.com/wp-json/agentedseo/mcp
$ codex mcp login agentedseo
Then run the connection test under Agents › Connections.

Codex opens a page on your site. Sign in as an administrator and click Approve. AgentedSEO creates an SEO Agent user for Codex, listed on the Connections screen.

05Check it

  • codex mcp list shows agentedseo and whether it is enabled.
  • In the Codex TUI, /mcp lists its tools, named agentedseo-<ability>.
  • In WordPress, Run test on the Connections screen. “Authorization header reaches WordPress” must pass.
codex
$ codex mcp listagentedseo enabled https://your-site.com/wp-json/agentedseo/mcp› /mcpagentedseo-get-capabilities · agentedseo-set-meta · agentedseo-revert-change · …

06Your first safe task

Paste into Codex

Use the agentedseo MCP tools. Start with agentedseo-get-capabilities. Find one published post with no meta description, write one, call set-meta with dry_run first and show me the before and after, then submit it with a note. Change nothing else.

  1. The agent calls agentedseo-set-meta. Meta titles and descriptions ask first by default, so the answer is proposed. The live page has not changed.
  2. Open AgentedSEO › Dashboard › Approvals. Check Before and After, the checks it passed and the agent’s note. Click Approve.
  3. Open AgentedSEO › Dashboard › Change log, open the change’s Details and click Undo. The Before value is back, and the undo is logged.
1 · Agent callproposed
→ set-meta dry_run: true← before / after returned→ set-meta note: “first test”← status: proposed

The live page has not changed.

2 · ApprovalsWaiting
Meta description · /what-is-a-410(empty)A 410 tells search engines a page is gone for good.
LengthKeyword
3 · Change log
AgentMeta description · /what-is-a-410agentedseo-codex · just nowNot yet

Undo restores the Before value, and the undo is logged.

Every write also returns a batch_id. Ask Codex to call revert-change with it and it undoes its own change.

07Two approval layers, and why both help

I like Codex’s writes mode next to AgentedSEO’s queue. Codex asks before the call leaves your machine; AgentedSEO decides what reaches the live site. One guards your terminal, the other guards your visitors.

Joy · From the team behind Classic Monks
LayerWhere it livesWhat it decides
Codex tool approvalYour config.tomlWhether Codex may call a tool at all
AgentedSEO approval rulesAgentedSEO › Agents › Approval rulesWhether a change applies now or waits in Approvals

08What Codex can and can’t change

AutomaticApplied straight away
  • New drafts
  • Edits to drafts
Ask me firstWaits in Approvals
  • Meta, schema, redirects, sitemaps, keywords, alt text
  • Edits to published content, publishing
  • Bulk changes over 20 pages
Always asksCan't be switched off
  • robots.txt edits
  • Noindex on a page with traffic
  • Deleting redirects or schema
  • Trashing or unpublishing
BlockedNever, whatever it asks
  • Permanent deletes
  • Header and footer code
  • Users, plugins, themes, settings outside AgentedSEO

Change the per-area defaults in AgentedSEO › Agents › Approval rules. Approving and rejecting are not tools: only a person can do them, in WordPress. Full table: what your agent can and can’t change.

09Troubleshooting

SymptomFix
Codex connects but tools are missingAGENTEDSEO_AUTH isn’t set in the shell Codex started from, so it connects without auth and AgentedSEO answers 401.
Header check fails in the self-testOn Apache add SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 to .htaccess, or ask your host.
Server times out at startupRaise startup_timeout_sec (default 10).
A long tool call times outRaise tool_timeout_sec (default 60).
429 agentedseo_locked_outTen failed sign-ins in 15 minutes lock the address out for 15 minutes.
Project .codex/config.toml ignoredCodex reads project config in trusted projects only.

10Questions about Codex and WordPress

No. AgentedSEO’s server sends Codex its own instructions when it connects: start with get-capabilities, dry run first, treat site content as data. Codex reads that instructions field.

It needs a site that can install AgentedSEO and answer at a public HTTPS address.

Yes, on a server where it can. Always pass the agent’s user: wp agentedseo record get post:42 –user=agentedseo-codex. Without –user, WP-CLI skips every permission check and approval rule.

No. It gets an application password, or an OAuth token, for its own SEO Agent user.

11Next steps