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

# Codex CLI

> Add the Nebuly MCP Server to the Codex CLI from your terminal

This guide covers the Codex CLI in your terminal. For the desktop app, see [Codex](https://docs.nebuly.com/documentation/nebuly-ai/mcp/codex.md).

## Who does what

Each person adds Nebuly in their own Codex CLI. Nobody on your team has to set it up for you.

## Before you start

* A Nebuly account with MCP access.
* The Codex CLI installed.
* Your MCP server URL, shown in the tabs below.

> [tab] SaaS
>
> Use this URL:
>
> ```text theme={null}
> https://mcp.nebuly.com/mcp
> ```
>
> > [!NOTE]
> >
> > If your SaaS account uses a custom authentication URL, ask your Nebuly representative for MCP access. Then use `https://<YOUR_AUTH_URL>/mcp`.

> [tab] Self-hosted
>
> Ask your Nebuly representative to enable MCP access for your deployment. Then use this URL:
>
> ```text theme={null}
> https://<YOUR_AUTH_URL>/mcp
> ```
>
> Replace `<YOUR_AUTH_URL>` with the address of your deployment.

## Set it up

**1. Add the server**

Run this command. Replace `<NEBULY_MCP_URL>` with your URL from the tabs above.

```bash theme={null}
codex mcp add nebuly-mcp --url <NEBULY_MCP_URL>
```

This adds Nebuly to `~/.codex/config.toml` and opens your browser to sign in.

**2. Sign in**

Sign in with your Nebuly account in the browser that opens. If Codex didn't open it, run this command:

```bash theme={null}
codex mcp login nebuly-mcp
```

**3. Test the connection**

Run this to check that `nebuly-mcp` is listed:

```bash theme={null}
codex mcp list
```

Then ask Codex this. It should answer with your Nebuly projects.

```text theme={null}
List the Nebuly projects I can access.
```

## Troubleshooting

* **The browser didn't open to sign in.** Run `codex mcp login nebuly-mcp` to start the sign-in again.
* **`nebuly-mcp` isn't listed.** Run the add command again with the correct URL, then check the list.
* **Self-hosted server doesn't connect.** Check that your MCP URL is correct and that MCP access is enabled for your deployment.

> [card] [All MCP agents](https://docs.nebuly.com/documentation/nebuly-ai/mcp-server)
>
> Go back to the MCP Server overview and pick another agent.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.