# Codex

> Add MoraWP to Codex CLI, approve its access, and verify the connection.

Codex connects to MoraWP over MCP using browser OAuth. You add the server URL,
then approve a connection to a Workspace. You do not create or paste a MoraWP
static Agent key.

This guide covers **Codex CLI**. The commands were checked against CLI
**0.154.0** and OpenAI's documentation on **October 4, 2026**. Other Codex
surfaces may place MCP setup in their settings.

## Before you begin

Connect a [WordPress website](/getting-started/connect-website) and make sure
you can access its Workspace. On your computer, check that Codex is installed:

```bash
codex --version
```

If the command is unavailable, use [OpenAI's CLI installation instructions](https://learn.chatgpt.com/docs/codex/cli).

## Add MoraWP

Open **Agents → Connect an Agent → Codex** in the
[Dashboard](https://app.morawp.com). The dialog shows the MCP endpoint and the
two setup commands.

Run the add command in your terminal:

```bash
codex mcp add morawp --url https://api.morawp.com/mcp
```

**Expected result:** Codex saves a server named `morawp`. Adding the URL alone
does not approve access to your Workspace.

If you already configured that name, check its URL before changing anything:

```bash
codex mcp get morawp
```

## Approve the connection

Start OAuth sign-in:

```bash
codex mcp login morawp
```

Use the browser page that opens to sign in to MoraWP and review the request.
Confirm the intended app and Workspace, choose the websites and Ability access,
then read and acknowledge the data-access notice.

<warning>

An enabled Integration can expose its complete available data, including private
fields and credentials. **Read only** restricts changes, not the sensitivity of
the information returned. Review the access before approving.

</warning>

Approve the request, then return to the terminal and the Dashboard setup dialog.
Complete the dialog's prompts once authorization has succeeded.

**Expected result:** the terminal reports successful authorization and the
connection appears in **Agents** in the selected Workspace.

## Verify in Codex

Check the saved server configuration:

```bash
codex mcp list
```

Then start a Codex session and use `/mcp` to inspect the active servers.
A configured entry is not proof that WordPress access works. Make a read request:

```text
Use MoraWP to list the websites this Agent can access. Do not make changes.
```

**Expected result:** Codex returns the websites allowed for this connection.
Continue with [Quickstart](/getting-started/quickstart#_3-read-one-page) to
verify an actual WordPress read.

## Troubleshooting

<table>
<thead>
  <tr>
    <th>
      Problem
    </th>
    
    <th>
      Next step
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        codex
      </code>
      
       is not found
    </td>
    
    <td>
      Install the CLI, reopen your terminal, and run <code>
        codex --version
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        morawp
      </code>
      
       is not configured
    </td>
    
    <td>
      Run the add command in the same Codex environment you use for your session.
    </td>
  </tr>
  
  <tr>
    <td>
      Authorization was cancelled or expired
    </td>
    
    <td>
      Run <code>
        codex mcp login morawp
      </code>
      
       again and complete the new browser request.
    </td>
  </tr>
  
  <tr>
    <td>
      Server is configured but requests require sign-in
    </td>
    
    <td>
      Complete OAuth login. Check that the Agent connection has not been removed in MoraWP.
    </td>
  </tr>
  
  <tr>
    <td>
      Connected, but the expected website is missing
    </td>
    
    <td>
      Check the selected Workspace and the Agent's website access in MoraWP.
    </td>
  </tr>
  
  <tr>
    <td>
      An Ability is denied
    </td>
    
    <td>
      Review the Agent's mode and the Workspace's enabled Abilities. Repeating the same call does not grant access.
    </td>
  </tr>
  
  <tr>
    <td>
      WordPress returns an error
    </td>
    
    <td>
      Use <a href="/troubleshooting/wordpress-tool-failed">
        WordPress tool failed
      </a>
      
      .
    </td>
  </tr>
</tbody>
</table>

## Remove access

Remove the connection in MoraWP when Codex should no longer reach the Workspace.
For local cleanup, OpenAI also provides:

```bash
codex mcp logout morawp
codex mcp remove morawp
```

Local logout or removal is separate from removing the MoraWP Agent connection.
Review [Agent access](/guides/agents) when managing other authorized sessions.

See [OpenAI's MCP documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
for current Codex configuration options.
