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

# OpenAI Codex

> Use the LightOn MCP server directly from OpenAI Codex.

## Prerequisites

* [OpenAI Codex](https://openai.com/codex) installed
* A LightOn API key from the [LightOn Console](https://console.lighton.ai)

## Configuration

Codex configures MCP servers via a TOML file. Add the following to `~/.codex/config.toml`:

```toml theme={null}
[mcp_servers.lighton]
url = "https://api.lighton.ai/mcp"
bearer_token_env_var = "LIGHTON_API_KEY"
```

<Note>
  `bearer_token_env_var` takes the **name** of an environment variable. Codex reads the value at runtime on every request. Make sure `LIGHTON_API_KEY` is set in your shell environment, you can grab your key from the [LightOn Console](https://console.lighton.ai). To scope the server to a single project instead, place the same snippet in `.codex/config.toml` at the root of your project.
</Note>

## Verification

1. Open Codex and start a session.

2. Use the `/mcp` command to list configured servers and verify that `lighton` appears in the output.

3. Test the connection with a prompt like:

   ```
   Search my LightOn workspaces for documents about [topic]
   ```

You're all set. From any Codex session you can now ask it to search or ingest documents in your LightOn workspaces directly.

## References

* [Codex docs: Model Context Protocol](https://developers.openai.com/codex/mcp)
