---
title: "How to Connect OpenAI Codex to WordPress via MCP"
url: "https://wpimportexport.com/connect-codex-to-wordpress-mcp/"
description: "Connect the Codex app, CLI or IDE extension to your WordPress site with MCP Adapter and an Application Password. Tested setup and real requests."
type: post
published: 2026-11-05T19:27:42+00:00
modified: 2026-11-14T10:33:17+00:00
categories: ["AI", "Tutorials"]
tags: ["Abilities API", "AI Agents", "Codex", "Import Export by RockStarLab", "WordPress automation", "WordPress Import Export Plugin"]
docs_topics: ["Using with AI agents"]
---

# How to Connect OpenAI Codex to WordPress via MCP

The Codex app, the `codex` CLI and the Codex extension in your editor read their MCP (Model Context Protocol) servers from the same `config.toml`, so a WordPress site added once is available in all three. Codex then counts and lists content, exports pages and posts, checks import jobs or syncs content between sites, talking to the site directly over HTTP. On the WordPress side, the official [MCP Adapter](https://wordpress.org/plugins/mcp-adapter/) plugin is the server.

The free [Import Export by RockStarLab](https://wordpress.org/plugins/import-export-by-rockstarlab/) plugin writes the Codex settings for you and adds more than 100 actions for exports, imports and content sync. It was tested in the Codex app on macOS with WordPress 7.1, MCP Adapter 0.7.1 and version 2.1.18 of the plugin, with two real requests.

## Short Answer

1. Go to **Import Export by RockStarLab > Plugin Options > AI Agent Connection**, turn on **Enable Abilities API** and let the wizard activate MCP Adapter.
2. Create an Application Password in **Users > Profile**.
3. In step 4 of the wizard, choose **Codex**, paste the password, generate the command and run it in your terminal. It adds a `[mcp_servers.wordpress]` section to `~/.codex/config.toml`.
4. Restart Codex and check the server with `codex mcp list` or **/mcp**.
5. Start a new chat and send the first request, naming the `wordpress` server.

## What You Need

- **WordPress 6.9 or newer**, where the Abilities API is part of core, and an administrator account.
- **HTTPS on a live site.** WordPress only offers Application Passwords over HTTPS, except on local development sites.
- **Codex**: the Codex app, the `codex` CLI or the Codex extension in your editor, signed in. All three read the same `config.toml`, so you set up the site once.
- **Python 3.11 or newer** if you use the one-command setup, because it checks the TOML file before writing it. Without it, use the **Custom config** method below.

## Step 1: Turn On Agent Access

Go to **Import Export by RockStarLab > Plugin Options > AI Agent Connection** and turn on **Enable Abilities API**. The setup wizard appears below the switch.

![Import Export by RockStarLab AI Agent Connection settings with the Enable Abilities API switch turned on and Claude Code among the supported agents](https://wpimportexport.com/wp-content/uploads/2026/11/01-enable-abilities-api.webp)

_Turn on Enable Abilities API in Plugin Options > AI Agent Connection._

## Step 2: Activate MCP Adapter and Create a Password

Step 2 of the wizard installs and activates MCP Adapter with one click. Step 3 links to your profile, where you create an Application Password: enter a name such as “Codex”, click **Add Application Password** and copy the password. WordPress shows it only once.

![Connect your AI agent wizard: site check ready with 105 plugin actions, MCP Adapter 0.7.1 ready, and the step to create an Application Password](https://wpimportexport.com/wp-content/uploads/2026/11/02-wizard-steps.webp)

_The wizard checks the site and MCP Adapter before you create a password._

## Step 3: Add the Site to Codex

In step 4 of the wizard, choose **Codex** as the AI app and **One command** as the method, select your terminal, and paste your username and the Application Password. Click **Generate connection** and **Copy result**. The command is built in your browser; the password is not sent anywhere.

![Wizard step 4 with Codex and One command selected and the generated python3 command that adds WordPress to the Codex config.toml](https://wpimportexport.com/wp-content/uploads/2026/11/03-codex-command.webp)

_For Codex, the wizard builds a Python command that adds the site to ~/.codex/config.toml._

Close Codex, paste the command into a terminal and run it. It reads `~/.codex/config.toml` (or the folder in `CODEX_HOME`, if you set one), adds a `wordpress` server at the end, checks that the file is still valid TOML and prints `WordPress added. Restart your AI app.` Your other settings and servers stay as they are. If a server named `wordpress` already exists, the command stops and changes nothing.

With **Custom config**, the wizard shows the section to add by hand at the end of `config.toml`:

```
[mcp_servers.wordpress]
url = "https://your-site.com/wp-json/mcp/mcp-adapter-default-server"
http_headers = { Authorization = "Basic ..." }
```

The `Basic` value is your username and Application Password in Base64, which is an encoding, not encryption, so keep the file private.

## Step 4: Check the Connection

Restart Codex. In a terminal, `codex mcp list` shows the `wordpress` server with its address and the status **enabled**. The **Auth** column says “Bearer token” for any server with an `Authorization` header; the Basic header from the wizard works all the same. In the CLI or IDE extension, **/mcp** lists the server and its tools.

When Codex starts, it connects to every MCP server in the file and loads three tools from WordPress: _Discover Abilities_, _Get Ability Info_ and _Execute Ability_. The actual actions (“abilities”) come from plugins: Import Export by RockStarLab adds its export, import, job, sync and migration actions, and other plugins add their own. Codex sends every header the current MCP protocol asks for, so no extra settings were needed in our test.

## Step 5: Send the First Request

Start a new chat and send the first request from the wizard. We added “Use the MCP server named wordpress”, because our Codex had several WordPress sites connected; with only one site you can leave it out:

```
Use the MCP server named wordpress. Discover its abilities, get the input schema for rsl-ie/get-capabilities, then execute it with empty parameters {}. Summarize what Import Export by RockStarLab can do. Do not modify any content or settings.
```

Codex made three calls to the WordPress tools and answered in 28 seconds. It reported the plugin version, the number of abilities and that the Pro add-on is inactive, showed the input schema it had checked, and confirmed that all three calls were read-only:

![Codex app answer showing Import Export by RockStarLab 2.1.18 with 105 abilities, the input schema of rsl-ie/get-capabilities and read-only calls](https://wpimportexport.com/wp-content/uploads/2026/11/04-codex-first-request.webp)

_The first, read-only request in the Codex app: three tool calls in 28 seconds._

## A Real Task: Stale Pages and a CSV Inventory

The second request asked for published pages that nobody has edited since 2024, and for a CSV inventory of all published pages:

```
Use the MCP server named wordpress. Check the site for stale content: find published pages that have not been modified since January 1, 2024. For each one, show the title, address, last modified date and word count. Then export all published pages to a CSV file named content-inventory with ID, Title, Permalink, Status, Modified Date, Word Count and the Yoast meta description, and give me the browser download link. Do not change any content.
```

Codex worked for 1 minute and made 16 calls to the WordPress tools. It used the plugin’s own export, which processed all 9 published pages, and answered with a table of the five stale pages and a link to `content-inventory.csv`:

![Codex app listing five stale WordPress pages with exact word counts and a download link for content-inventory.csv](https://wpimportexport.com/wp-content/uploads/2026/11/05-codex-stale-pages-export.webp)

_Five stale pages with exact word counts and the CSV exported by the plugin: 16 tool calls in about a minute._

We compared the answer with the CSV file that the plugin created. The titles, addresses, dates and word counts (45, 1,250, 610, 90 and 380 words) all matched, because Codex read them from the plugin’s export instead of estimating them. The same inventory can be built by hand in the dashboard, as described in [WordPress Content Inventory: Export All Pages with Dates, Authors and Status](https://wpimportexport.com/wordpress-content-inventory-export/).

## More Requests to Try

- “How many posts, pages, comments and media files does the site have? Do not change anything.”
- “List the last 10 import and export jobs with their status, and show the errors of any job that failed.”
- “Export all blog posts published in 2025 to an Excel file with the title, permalink, categories and featured image URL, and give me the browser download link.”
- “Find pages whose content contains old-domain.com and list their titles and addresses.”

## Before You Let It Change Anything

Reading and exporting do not change the site. Imports, syncs and setting changes do. Make a backup first: with UpdraftPlus, click **Backup Now**, or turn on **Enable Abilities API for UpdraftPlus** on the same settings page and ask Codex to run `rsl-ie/updraftplus-backup-start` and check it with `rsl-ie/updraftplus-backup-status`. Both ways are described in [How to Create a WordPress Website Backup and Restore It](https://wpimportexport.com/how-to-create-a-wordpress-website-backup-and-restore-it/).

Check the permission mode before a task that writes. In **Full access** mode, the Codex app can run commands and edit files without asking for approval. With the default permissions it works inside its workspace and asks when it needs more access. Every WordPress action goes through the same _Execute Ability_ tool, so if you connect several sites, name the one to use in every request, and try new kinds of tasks on a staging site first.

## Troubleshooting

All connection errors with their exact messages and fixes are collected in [WordPress MCP Adapter Errors: Fix 401, 404 and Application Password Problems](https://wpimportexport.com/wordpress-mcp-adapter-errors/).

### “The model requires a newer version of Codex”

An older `codex` CLI cannot use the newest models and stops before it reaches WordPress. Update the CLI, or use the Codex app, which ships its own up-to-date CLI.

### HTTP 401 for one of the servers

Codex starts every server in `config.toml`, so a 401 in the log can come from another site with an old password. Check which address it belongs to. For your WordPress site, create a new Application Password and update the `Authorization` value. On Apache, add `SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1` to `.htaccess` if the header does not reach WordPress.

### “Codex One command requires Python 3.11 or newer”

Your `python3` is older. Use **Custom config** and paste the section into `config.toml` by hand.

### “WordPress already exists. Use Custom config.”

The command never overwrites an existing `[mcp_servers.wordpress]` section. Edit that section in `config.toml`, or add the site under another name such as `[mcp_servers.wordpress-shop]`.

### “Invalid config. Use Custom config.”

Your `config.toml` could not be read as TOML, or its `mcp_servers` entry has an unexpected format. Fix the file or add the section by hand.

### Codex connects but finds no rsl-ie abilities

**Enable Abilities API** is off, or the account has no administrator rights. Turn the switch on and use an administrator’s Application Password.

## FAQ

### Does this work with other MCP clients?

Yes. The same wizard generates settings for Claude Code, GitHub Copilot in VS Code, Cursor and Gemini CLI. Step-by-step guides with tested requests are available for [Claude Code](https://wpimportexport.com/connect-claude-code-to-wordpress-mcp/), [GitHub Copilot](https://wpimportexport.com/connect-github-copilot-to-wordpress-mcp/) and [Cursor](https://wpimportexport.com/connect-cursor-to-wordpress-mcp/).

### Can I connect several sites?

Yes. Add one section per site, for example `[mcp_servers.wordpress-shop]` and `[mcp_servers.wordpress-blog]`, each with its own address and Application Password, and name the server in your request.

### Do I need the Pro version?

No. The connection and the free actions for posts, pages, comments, media, URL lists, jobs, content sync and migration work with the free plugin. The Pro add-on adds actions for WooCommerce, custom post types, users and menus.

## Related Guides

- [Letting an AI Agent Edit WordPress Content Safely: Permissions, Staging, Rollback](https://wpimportexport.com/ai-agent-edit-wordpress-content-safely/)
- [WordPress MCP Adapter errors: fix 401, 404 and Application Password problems](https://wpimportexport.com/wordpress-mcp-adapter-errors/)
- [How to connect Claude Code to WordPress via MCP](https://wpimportexport.com/connect-claude-code-to-wordpress-mcp/)
- [How to connect GitHub Copilot to WordPress via MCP](https://wpimportexport.com/connect-github-copilot-to-wordpress-mcp/)
- [How to connect Cursor to WordPress via MCP](https://wpimportexport.com/connect-cursor-to-wordpress-mcp/)
- [How to use the WordPress Abilities API with AI agents](https://wpimportexport.com/how-to-use-the-wordpress-abilities-api-with-ai-agents-exports-imports-content-sync-and-backups/)

Import Export by RockStarLab is free on [WordPress.org](https://wordpress.org/plugins/import-export-by-rockstarlab/).
