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

# Codex (OpenAI)

> Connect StackOne MCP to the OpenAI Codex CLI.

## Overview

[Codex](https://developers.openai.com/codex/cli/) is OpenAI's command-line coding agent. It connects to MCP servers defined in its config file.

## Setup

StackOne's MCP endpoint is a remote, Streamable HTTP server:

```
https://api.stackone.com/mcp
```

<Steps>
  <Step title="Get your MCP URL">
    In the StackOne dashboard, open a connector, click **Use in Agent**, select a linked account, and copy the generated token URL.
  </Step>

  <Step title="Add the server to Codex">
    Add StackOne to `~/.codex/config.toml`. Codex reaches remote servers through the [`mcp-remote`](https://github.com/geelen/mcp-remote) package:

    ```toml theme={null}
    [mcp_servers.stackone]
    command = "npx"
    args = ["-y", "mcp-remote@latest", "https://api.stackone.com/mcp?token={session_token}"]
    ```

    Or use the CLI: `codex mcp add stackone -- npx -y mcp-remote@latest "https://api.stackone.com/mcp?token={session_token}"`.
  </Step>

  <Step title="Verify">
    Run `codex` and ask:

    ```text theme={null}
    What StackOne tools are available?
    ```
  </Step>
</Steps>

For API-key auth instead of a token URL, see [Authentication & Security](/embed/call-actions/mcp#calling-actions). Confirm the latest config format in [Codex's MCP docs](https://developers.openai.com/codex/cli/).

## Handling large tool catalogs

If the connector exposes many actions, add the `tool-mode=search_execute` query parameter to the MCP URL in your config. The client then registers just two tools — search + execute — and the agent discovers actions at runtime, so the context footprint stays flat however large the catalog:

```
https://api.stackone.com/mcp?tool-mode=search_execute
```

For a token URL, append it as an extra parameter: `https://api.stackone.com/mcp?token=<session_token>&tool-mode=search_execute`.

See [Tool Discovery](/features/tool-discovery) for how search works, its accuracy, and the other modes.

## Optimize and secure

With your agent connected, use StackOne's platform features to optimize performance and secure every call.

<CardGroup cols={3}>
  <Card title="Search & Execute" icon="magnifying-glass" href="/optimize/search-and-execute">
    Reduce context and save tokens.
  </Card>

  <Card title="Data Sync" icon="arrows-rotate" href="/optimize/data-sync">
    Reduce latency and enable semantic search.
  </Card>

  <Card title="Defender" icon="shield-halved" href="/secure/defender">
    Block prompt injections before they reach your agent.
  </Card>
</CardGroup>
