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

# Codex

> Connect OpenAI Codex to your data in Nekt using the MCP Server with bearer token authentication.

Codex is OpenAI's AI coding agent. When connected to Nekt through the MCP Server, it can query and analyze your data directly from the CLI. The connection uses bearer token authentication via an environment variable.

<Info>Requires a **paid Nekt plan** (for MCP Server access) and the **Codex CLI** installed (`codex` command available).</Info>

## 1. Activate your MCP Server

The connection is made by activating the MCP Server in your workspace. Check [this guide](/mcp-server/setup) for instructions.

## 2. Get your endpoint and token

Go to **Integrations > MCP Server** in the Nekt platform. You'll need two values:

* **Endpoint** — the MCP server URL displayed at the top of the page
* **Token** — a bearer token created in the **MCP Tokens** section

If you don't have a token yet, create one. You can scope it to specific tables or grant full access.

<Note>
  Tokens created manually can be scoped to specific tables for fine-grained access control. Tokens grant Codex access only to the tables associated with that token.
</Note>

## 3. Connect Codex to Nekt

<Steps>
  <Step title="Set your token as an environment variable">
    Export the token in your current shell session:

    ```bash theme={null}
    export NEKT_MCP_BEARER_TOKEN="YOUR_TOKEN_HERE"
    ```

    To persist it across sessions, add it to your shell profile:

    ```bash theme={null}
    echo 'export NEKT_MCP_BEARER_TOKEN="YOUR_TOKEN_HERE"' >> ~/.zshrc
    source ~/.zshrc
    ```
  </Step>

  <Step title="Add the Nekt MCP server">
    You can register the MCP server using the CLI or by editing the configuration file directly.

    **Option A — Using the CLI:**

    ```bash theme={null}
    codex mcp add nekt --url https://mcp.nekt.com/mcp --bearer-token-env-var NEKT_MCP_BEARER_TOKEN
    ```

    **Option B — Editing the configuration file:**

    Open `~/.codex/config.toml` and add the following block:

    ```toml theme={null}
    [mcp_servers.nekt]
    url = "https://mcp.nekt.com/mcp"
    bearer_token_env_var = "NEKT_MCP_BEARER_TOKEN"
    ```
  </Step>

  <Step title="Verify the connection">
    Confirm the server was registered correctly:

    ```bash theme={null}
    codex mcp list
    codex mcp get nekt --json
    ```

    The server `nekt` should appear as enabled, with the URL `https://mcp.nekt.com/mcp` and auth mode showing bearer token via env var.

    You can also ask Codex to list the available Nekt tools to confirm the connection is working. You should see the nine tools provided by the Nekt MCP Server. You can learn more about them [here](/mcp-server/tools).
  </Step>
</Steps>

<Warning>
  The OAuth login flow (`codex mcp login nekt`) is not supported for Nekt. Use bearer token authentication as described above.
</Warning>

***

## 4. Explore your data

Once connected, ask Codex a question about your data. For example:

```
Using Nekt, give me a summary of the your_table_name table.
```

Codex will use the MCP tools to query your data and return an answer.

<Check>
  We'd love to know what you're building with Nekt! Share your projects with us through any of our communication channels.
</Check>

***

## Privacy & Security

Your data privacy is a core principle of the Nekt platform.

When you connect Codex to Nekt through the MCP Server, Codex does not receive direct database credentials or unrestricted access to your infrastructure. Instead, Codex interacts with your data exclusively through the secure tools exposed by the Nekt MCP Server, which act as a controlled gateway to the Nekt API. These tools enforce the same authentication, authorization, and permission rules used throughout the Nekt platform.

Access is scoped using tokens and user permissions, meaning Codex can only access the tables and actions explicitly allowed by the token you configured. This architecture ensures that all queries, analysis, and data interactions remain governed, auditable, and restricted to your workspace permissions.

When using Codex, your interactions are subject to OpenAI's privacy settings and policies. We recommend reviewing the [official OpenAI privacy documentation](https://openai.com/policies/privacy-policy) to understand their data handling policies and selecting the configuration that best aligns with your organization's security requirements.

***

## Need help?

Contact our support team if you encounter issues during setup.
