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

# Connect Codex

> Add Social Monitor Hub as an MCP server in Codex CLI.

Checked against codex-cli 0.167.0 on 2026-11-20. Run `codex mcp add --help` if flags differ in your version.

## Steps

1. Put the key in your shell profile so it survives restarts (an `export` typed inside an agent's tool shell is lost when that shell exits, and the client then gets 401):

   ```bash theme={null}
   echo 'export SOCIAL_MONITOR_KEY=smk_xxxxxxxx_xxxxxxxx' >> ~/.zshrc   # or ~/.bashrc
   ```

   Open a **new** terminal and start `codex` from there.

2. Add the server. Codex reads the token from the env var named by `--bearer-token-env-var`, so the key is not stored in the config:

   ```bash theme={null}
   codex mcp add social-monitor \
     --url https://monitor.solobiz.academy/api/mcp \
     --bearer-token-env-var SOCIAL_MONITOR_KEY
   ```

3. Restart Codex, then verify with `codex mcp list` or `/mcp` in the TUI.

4. Ask the agent to call `list_channels` and report the channels.

## Equivalent config.toml

`~/.codex/config.toml` (or `.codex/config.toml` in a trusted project):

```toml theme={null}
[mcp_servers.social-monitor]
url = "https://monitor.solobiz.academy/api/mcp"
bearer_token_env_var = "SOCIAL_MONITOR_KEY"
```

## Troubleshooting

| Symptom | Fix |
| - | - |
| 401 | Key wrong or revoked, or `SOCIAL_MONITOR_KEY` not set in the shell that launched Codex |
| Server not listed | Restart Codex after `codex mcp add` |
| Flag not recognised | Use the config.toml block |


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