# Codex

Codex can connect to Memside through MCP. The connection allows Codex to load
selected Memories, project checkpoints, Operating Rules, and other saved
context before it plans, edits, or reviews code.

Start with the CLI setup when the installed Codex version provides the `mcp`
command. Use the MCP server screen when working in a Codex surface that exposes
configuration through the interface.

## Before starting

1. Sign in to Memside.
2. Open **Settings > Developer & API**.
3. Create an API key and copy it when shown.
4. Confirm that the installed Codex version supports MCP servers.

## Option 1: Add Memside with the Codex CLI

1. Open a terminal.
2. Add the Memside remote server:

```bash
codex mcp add memside --url https://api.memside.com/mcp/
```

3. List the configured servers:

```bash
codex mcp list
```

4. If Codex requests authentication details, use this bearer header:

```text
Authorization: Bearer mem_sk_example_key
```

5. Restart Codex if the new tools do not appear.

## Option 2: Use the MCP server screen

1. Open **Settings** in Codex.
2. Open **MCP Servers**.
3. Select **Add Server**.
4. Enter `memside` as the server name.
5. If the form supports a remote URL, enter:

```text
https://api.memside.com/mcp/
```

6. Add the bearer authorization header using the Memside API key.
7. Save the server and restart Codex.

If the form accepts only a launch command, use:

- **Command:** `npx`
- **Arguments:** `-y`, `mcp-remote`, `https://api.memside.com/mcp/`,
  `--header`, `Authorization: Bearer mem_sk_example_key`
- **Environment variables:** leave empty unless required by the installed build
- **Environment variable passthrough:** leave empty
- **Working directory on Windows:** `%USERPROFILE%\.codex`

## Configuration file location

Some Codex versions store MCP configuration in:

- Windows: `%USERPROFILE%\.codex\config.toml`
- macOS or Linux: `~/.codex/config.toml`

Use the MCP configuration format supported by the installed Codex release. The CLI or the MCP
server screen is preferred because it writes the correct format for that
version.

## Confirm the connection

Run `codex mcp list` or open the MCP server settings. Confirm that `memside` is
enabled and its tools are available.

Then start with a read-only request:

```text
Use Memside to find the active checkpoint and summarize the current task.
```

## Troubleshooting

- Restart Codex after adding or changing the server.
- Confirm that `codex mcp list` includes `memside`.
- Check that the server URL ends with `/mcp/`.
- Recreate the Memside API key if authentication fails.
- Use the MCP setup path available in the installed Codex surface when the CLI
  command is unavailable.

## Next steps

- [Connection overview](/connect/mcp-and-api/)
- [API keys](/developers/api-keys/)
- [Troubleshooting](/help/troubleshooting/)
