Skip to main content
Codex reads your MCP key from an environment variable and sends it as a bearer token. The key never appears in config.toml.

Prerequisites

  • MCP access for your organisation and the owner role.
  • An MCP key from Settings → Organization → AI client access (MCP) → Create key.
  • Codex CLI installed and signed in. Check:

Set up

1

Set the AILUNAPRO_MCP_KEY variable

For every new terminal (recommended):
Then open a new PowerShell window before the next step.
2

Add the server

This writes the following to ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml). You can also add it by hand:
~/.codex/config.toml
bearer_token_env_var holds the name of the variable, not the key itself.
3

Check the connection

ailunapro appears in the list. Then start Codex with codex and type /mcp. Expected:
Codex /mcp output listing the ailunapro server with bearer token authCodex /mcp output listing the ailunapro server with bearer token auth
4

Ask a question

Start with a test that needs no audit:
The client runs docs_search_product and quotes AiLunaPro’s product help about reports. If you see that answer, the connection works.Then ask about your own audit:
“No matching audit was found for your account” means your organisation has no completed Audit Express yet. Complete one in AiLunaPro, then ask again.
The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share config.toml. Once AiLunaPro is configured in one, it is available in the others.

Troubleshooting

The variable is not set in the environment Codex started from. Open a new terminal, check it, and start Codex again:
AiLunaPro does not use OAuth. Check that bearer_token_env_var is set for ailunapro in config.toml and that the variable contains your key.
The key is wrong or revoked. Create a new key, update the variable, open a new terminal and restart Codex.
More cases: Troubleshooting.
Last modified on November 29, 2026