> For the complete documentation index, see [llms.txt](https://docs.controltheory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.controltheory.com/controltheory-documentation/dstl8-docs/mcp-integration/codex.md).

# Codex

Bubbling...

Connect Dstl8 to OpenAI Codex (CLI, VS Code extension, or Desktop app) for observability access while coding.

### Prerequisites

* Codex CLI, VS Code extension, or Desktop app installed
* Node.js 18+
* Your [MCP endpoint and API token](/controltheory-documentation/dstl8-docs/mcp-integration.md)

### Setup (CLI)

The quickest way is via the CLI:

```bash
codex mcp add Dstl8 --env DSTL8_TOKEN=<your-token> -- npx -y mcp-remote https://<org_id>.app.dstl8.ai/mcp --header "Authorization: Bearer <your-token>"
```

Replace `<org-id>` and `<your-token>` with your credentials from **Settings → Integrations → MCP**.

### Setup (config file)

Codex stores MCP config in `~/.codex/config.toml`. For project-scoped config, use `.codex/config.toml` in your project root.

#### Option A: Remote HTTP (recommended)

If your Dstl8 MCP endpoint supports direct HTTP connections:

```toml
[mcp_servers.Dstl8]
url = "https://<org_id>.app.dstl8.ai/mcp"
bearer_token_env_var = "DSTL8_TOKEN"
```

Then set the environment variable in your shell profile (`.bashrc`, `.zshrc`, etc.):

```bash
export DSTL8_TOKEN="dstl8_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxx"
```

#### Option B: Via mcp-remote

If direct HTTP doesn't connect (e.g. due to transport compatibility), use `mcp-remote` as a stdio bridge:

```toml
[mcp_servers.Dstl8]
command = "npx"
args = ["-y", "mcp-remote", "https://<org_id>.app.dstl8.ai/mcp", "--header", "Authorization: Bearer <your-token>"]
```

Replace `<org-id>` and `<your-token>` with your credentials.

### Verify

In the Codex CLI, run:

```
/mcp
```

You should see `Dstl8` listed as connected.

In the VS Code extension, go to the gear icon → **MCP settings** to check server status.

### Troubleshooting

**Server fails to connect** — Test `mcp-remote` directly:

```bash
npx -y mcp-remote https://<org_id>.app.dstl8.ai/mcp \
  --header "Authorization: Bearer <your-token>"
```

**Timeout on startup** — Increase the startup timeout in your config:

```toml
[mcp_servers.Dstl8]
startup_timeout_sec = 30.0
```


---

# 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.controltheory.com/controltheory-documentation/dstl8-docs/mcp-integration/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.
