> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-in-ai/mcp/connect-to-an-mcp-server/local-mcp-setup/openai-codex.md).

# OpenAI Codex Setup

Host setup for OpenAI Codex

[OpenAI Codex](https://openai.com/blog/openai-codex) is OpenAI's terminal-first workspace that pairs a shell, editor, and conversational developer agent. With Model Context Protocol (MCP) support, you can connect Codex directly to Umbraco's tools and data so the assistant can work inside your projects.

{% hint style="info" %}
The examples below use the Developer MCP package (`@umbraco-cms/mcp-dev`). Replace the package name if you are using a different Umbraco MCP server.
{% endhint %}

{% hint style="warning" %}
**Match the package version to your Umbraco site.** The examples on this page use `@latest`, which installs the newest release of the MCP Server. This may be a later major version than the one your site runs.

If your site is on the current Long-Term Support (LTS) release, Umbraco 17, use the `@lts-17` tag instead, for example `@umbraco-cms/mcp-dev@lts-17`. A version mismatch causes the first tool request to fail.

See [Version Compatibility](https://docs.umbraco.com/umbraco-in-ai/mcp/mcp-servers/cms-developer-mcp.md#version-compatibility) for the full list of tags.
{% endhint %}

## Getting started

Option A: Install via npm:

```bash
npm install -g @openai/codex
```

Option B: Install via Homebrew:

```bash
brew install codex
```

### Configure using the Codex CLI

1. Add the Umbraco MCP server with the Codex CLI:

```bash
codex mcp add umbraco-mcp -- npx -y @umbraco-cms/mcp-dev@latest
```

2. Define configuration values directly. If you prefer to keep secrets in your shell session, pass them as environment variables during registration:

```bash
codex mcp add umbraco-mcp \
  --env UMBRACO_CLIENT_ID="your-id" \
  --env UMBRACO_CLIENT_SECRET="your-secret" \
  --env UMBRACO_BASE_URL="https://localhost:12345" \
  --env NODE_TLS_REJECT_UNAUTHORIZED="0" \
  --env UMBRACO_INCLUDE_TOOL_COLLECTIONS="document,media,document-type,data-type,template" \
  -- npx -y @umbraco-cms/mcp-dev@latest
```

{% hint style="warning" %}
`NODE_TLS_REJECT_UNAUTHORIZED` set to `0` lets the MCP server accept the self-signed certificate of a local Umbraco. Only use it when `UMBRACO_BASE_URL` is `localhost`, `127.0.0.1` or `[::1]`. With any other base URL, the server refuses to start, so remove the setting for a remote site. See [TLS Certificates](https://docs.umbraco.com/umbraco-in-ai/mcp/connect-to-an-mcp-server/local-mcp-setup/tls-certificates.md) for the reasons, and how to keep verification on with `NODE_EXTRA_CA_CERTS`.
{% endhint %}

{% hint style="info" %}
`UMBRACO_INCLUDE_TOOL_COLLECTIONS` restricts the MCP Server to only the tool collections listed here. Nearly every Umbraco Management API operation is available as a tool, so add any additional collections your task requires. See [Available Tools](https://docs.umbraco.com/umbraco-in-ai/mcp/mcp-servers/cms-developer-mcp/available-tools.md) for the full list of collections.
{% endhint %}

Replace the following values with your local connection details:

* `UMBRACO_CLIENT_ID`
* `UMBRACO_CLIENT_SECRET`
* `UMBRACO_BASE_URL`
* `UMBRACO_INCLUDE_TOOL_COLLECTIONS`

This command stores the MCP server as `umbraco-mcp` in your Codex configuration file (typically `~/.codex/config.toml`).

3. Use the command below to see which MCP servers Codex is currently loading:

```cs
codex mcp list
```

## Managing tools and tool collections

When you need to change the tool set:

* Update your `.env` file with the tool collections you want (for example, `document,media`).
* Run the `codex mcp list` command to confirm that the server is healthy.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbraco.com/umbraco-in-ai/mcp/connect-to-an-mcp-server/local-mcp-setup/openai-codex.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
