Skip to content

How to Connect OpenAI Codex CLI to WordPress

Connecting the OpenAI Codex CLI to your WordPress site brings your content into the terminal: the coding agent can read and update posts and pages, manage media, or inspect site configuration while you work. Easy MCP AI runs the MCP server inside WordPress, and Codex connects to it through the mcp-remote bridge with an API token.

In this article

Prerequisites

  • A WordPress site served over HTTPS with Easy MCP AI installed and activated (see the installation guide).
  • Pretty permalinks enabled (Settings > Permalinks set to anything other than "Plain").
  • The OpenAI Codex CLI installed and signed in.
  • Node.js on your computer, for the mcp-remote bridge. Your WordPress server needs nothing extra.
  • An Easy MCP AI API token. Create one in Easy MCP AI > API Token & OAuth and copy it when it's shown.

You'll need your site's MCP endpoint URL, which is always your domain followed by /wp-json/easy-mcp-ai/v1/mcp:

https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp

You can copy it from Easy MCP AI > Dashboard in your WordPress admin, in the Quick Start: Connect Your AI Client section.

The Easy MCP AI Dashboard Quick Start card with the MCP endpoint URL and Copy button

Option 1: Quick Install from the Terminal

Run one command, replacing the URL with your endpoint and YOUR_API_TOKEN with your token:

bash
codex mcp add wordpress -- npx -y mcp-remote https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp --header "Authorization:Bearer YOUR_API_TOKEN" --transport http-only

Option 2: Edit the Config File

Alternatively, add the server to ~/.codex/config.toml:

toml
[mcp_servers.wordpress]
command = "npx"
args = ["-y", "mcp-remote", "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "--header", "Authorization:Bearer YOUR_API_TOKEN", "--transport", "http-only"]

Save the file. Codex picks up the server on its next start.

Verify the Connection

List the configured servers:

bash
codex mcp list

The wordpress server appears in the list. Then start Codex and ask something that touches your site:

Which are the five most recent posts on my WordPress site, and which of them are still drafts?

A terminal running Codex with the WordPress MCP tools responding to a prompt

What You Can Do Once Connected

Easy MCP AI exposes your site's capabilities as MCP tools, organized by area: posts, pages, media, comments, categories and tags, menus, custom post types, blocks, revisions, users, plugins, themes, site settings, and search. Integrations such as WooCommerce and SEO data sources are included when available. In the terminal, that pairs naturally with development work:

Create a draft page called "Pricing" using the block markup from the template file in this repo.

List the active plugins on my site and flag any that are outdated compared to wordpress.org.

Pull the content of the "About" page so I can refactor it into the new layout.

Control What Codex Can Access

Everything Codex does runs through your API token, so the token is your control point: it acts as the WordPress user you assigned, and you can limit it to specific tools. For CI or shared environments, use a dedicated token limited to the tools the job needs. Site-wide guardrails (globally disabled tools, rate limits, forced drafts, audit log) apply on top. See Creating and Managing API Tokens for details.

Security

If you identify a potential security vulnerability in this plugin, please disclose it responsibly. Follow the protocols on the Themeisle Security Page.

Was this helpful?