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

# OpenAI Codex

> Connect Codex to a Mirage workspace through SSH, MCP, a FUSE mount or exec-server forward.

## Install

```bash uv theme={null}
uv tool install 'mirage-ai[ssh]'
```

```bash npm theme={null}
npm install -g @struktoai/mirage-cli
```

Install [Codex](https://github.com/openai/codex) separately.

## Workspace

```yaml workspace.yaml theme={null}
mounts:
  /:
    vfs: ram
    mode: write
```

```bash theme={null}
mirage workspace create workspace.yaml --id demo
```

## SSH

Turn on the daemon's [SSH server](https://docs.mirage.strukto.ai/home/access/ssh.md#set-up), then:

```toml ~/.codex/environments.toml theme={null}
default = "mirage"
include_local = false

[[environments]]
id = "mirage"
program = "ssh"
args = ["-T", "-p", "2222", "demo@127.0.0.1", "-s", "codex-exec"]
```

```bash theme={null}
codex -C /
```

## MCP

```bash mirage mcp theme={null}
codex mcp add mirage -- mirage mcp -w demo
```

```bash Plugin theme={null}
codex plugin marketplace add strukto-ai/mirage
codex plugin add mirage@mirage
```

The plugin serves its own workspace from `.mirage/workspace.yaml`, not `demo`.

## FUSE

Install a [FUSE driver](https://docs.mirage.strukto.ai/home/setup/fuse.md), and with uv, `'mirage-ai[fuse]'`.

```yaml workspace.yaml theme={null}
mounts:
  /:
    vfs: ram
    mode: write
    backend: fuse
    mountpoint: /tmp/mirage-demo
```

```bash theme={null}
mirage workspace create workspace.yaml --id demo-fuse
cd /tmp/mirage-demo && codex
```

## Exec-server forward

For a remote harness such as the OpenAI Agents API ([Python](https://docs.mirage.strukto.ai/python/agents/openai-agents-api.md), [TypeScript](https://docs.mirage.strukto.ai/typescript/agents/openai-agents-api.md)):

```bash theme={null}
npm install -g @openai/codex@alpha
mirage codex-exec demo --listen 127.0.0.1:8790
```

```bash theme={null}
CODEX_API_KEY="$OPENAI_EXECUTOR_API_KEY" codex exec-server forward \
  --connect ws://127.0.0.1:8790 \
  --remote "$REMOTE_URL" \
  --environment-id "$ENVIRONMENT_ID"
```

`mirage codex-exec` accepts any local connection with the CLI's token, so keep it on loopback.


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