> ## Documentation Index
> Fetch the complete documentation index at: https://docs.controlplane.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Codex

> Connect OpenAI Codex to Control Plane to manage your infrastructure through AI-assisted development.

<Tip>
  We recommend the [Control Plane AI Plugin](/ai/plugin) for Codex. The plugin bundles the MCP server.
</Tip>

## Prerequisites

<CardGroup cols={2}>
  <Card title="OpenAI Codex" icon="https://mintcdn.com/controlplanecorporation/rFQpIcXts1y-5L7u/icons/codex.svg?fit=max&auto=format&n=rFQpIcXts1y-5L7u&q=85&s=7f6290d9a955377990c873b308593f35" width="2406" height="2406" data-path="icons/codex.svg">
    Install [Codex CLI](https://openai.com/codex)
  </Card>

  <Card title="Control Plane account" icon="user">
    Sign up at [console.cpln.io](https://console.cpln.io) if you don't have an account yet
  </Card>
</CardGroup>

<Note>
  For the latest MCP configuration options, refer to the official [OpenAI Codex documentation](https://developers.openai.com/codex).
</Note>

## Add the MCP server

<Steps>
  <Step title="Register the server">
    Use the `codex mcp add` command:

    ```bash theme={null}
    codex mcp add cpln --url https://mcp.cpln.io/mcp
    ```

    <Note>
      Connecting to the bare URL uses the default **`core`** toolset profile — a focused set that already covers the whole build-and-operate workflow (it can read and delete any resource kind generically, and reach anything else through the raw-API tool), which is the right fit for this client. Append `?toolsets=mk8s` to add BYOK Kubernetes tools, or `?toolsets=full` for everything. See [toolset profiles](/ai/mcp#toolset-profiles).
    </Note>
  </Step>

  <Step title="Sign in">
    Run the login command:

    ```bash theme={null}
    codex mcp login cpln
    ```

    Your browser opens:

    1. Sign in to Control Plane (Google, GitHub, Microsoft, or SAML).
    2. Select the orgs you want this Codex install to access.
    3. Click **Authorize**.

    Your browser shows a success page — close the tab and return to Codex.
  </Step>

  <Step title="Verify the registration">
    ```bash theme={null}
    codex mcp list
    ```

    You should see `cpln` with **enabled** status and **OAuth** auth:

    ```text theme={null}
    Name  Url                      Bearer Token Env Var  Status   Auth
    cpln  https://mcp.cpln.io/mcp  -                     enabled  OAuth
    ```
  </Step>

  <Step title="Verify live access">
    Launch Codex and ask: "list GVCs in org `<your-org>`" (using one of the orgs you authorized). You should see the GVCs in that org.
  </Step>
</Steps>

## Example conversation

<Steps>
  <Step title="Set Context">
    ```
    Use org "my-org" and gvc "my-gvc" for context.
    ```
  </Step>

  <Step title="Deploy a Workload">
    ```
    Create a publicly accessible workload called "my-api" using nginx:latest on port 80.
    ```
  </Step>

  <Step title="Get the Endpoint">
    ```
    Monitor the readiness of my-api and give me the public endpoint once it's ready.
    ```
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Browser didn't open for sign-in">
    Some terminal setups can't launch a browser. `codex mcp login cpln` prints a fallback URL — copy it into a browser on the same machine and complete sign-in there.
  </Accordion>

  <Accordion title="Need to change which orgs are authorized">
    Re-run `codex mcp login cpln`, sign in again, and adjust your org selections on the consent screen.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Usage Examples" icon="lightbulb" href="/ai/examples">
    Practical prompts for common Control Plane workflows
  </Card>

  <Card title="AI Plugin" icon="puzzle-piece" href="/ai/plugin">
    Layer skills, agents, slash commands, and guardrails on top of the MCP server
  </Card>
</CardGroup>
