Connect Harmonize MCP to Codex CLI, OpenAI's assistant that runs in your terminal.
Before you start: every user must first join their Harmonize organization. See MCP Setup Guide. You also need a ChatGPT account with Codex access, or OpenAI API credentials, and a terminal on macOS, Linux or WSL, or PowerShell on Windows. Commands are labeled by platform where they differ. Unlabeled commands work on every platform.
Install Codex and sign in
Every user, once per machine
-
Run the installer for your platform on the machine where Codex will run. If you work on a remote VM, run it in the VM terminal, not on your laptop.
macOS, Linux or WSL
Bashcurl -fsSL https://chatgpt.com/codex/install.sh | shWindows PowerShell
PowerShellpowershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex" -
Open a new terminal and confirm the install. The installer adds Codex to your PATH, and a new terminal window picks up the change.
Bashcodex --version -
If you see
command not foundor'codex' is not recognized, add the install folder to your PATH with the command for your platform, then runcodex --versionagain.macOS
Bashecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrcLinux or WSL
Bashecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrcWindows PowerShell (then open a new PowerShell window)
PowerShell$codexBin = "$env:LOCALAPPDATA\Programs\OpenAI\Codex\bin" $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$codexBin", 'User')On a Mac set to the older Bash shell, use
~/.bash_profilein place of~/.zshrc. -
Sign in to OpenAI. On a machine with a browser, run
codex login. On a remote VM, use device login, open the link it prints on your laptop, and enter the code. Device login may need to be enabled in your ChatGPT workspace security settings.Bashcodex login --device-auth -
Confirm with
codex login status. This confirms your OpenAI sign-in only; Harmonize sign-in is below.
Add Harmonize MCP and sign in
Every user, once per machine
-
Open your Codex configuration file (create it if needed) and add this entry. If a
harmonizeentry already exists, edit it instead of adding a second one. Replace<client-id>with the OAuth client ID: please refer to the Connection Guide in your onboarding email.-
macOS, Linux or WSL:
~/.codex/config.toml -
Windows:
%USERPROFILE%\.codex\config.toml
[mcp_servers.harmonize] url = "https://mcp.optimizedpayments.com/mcp" [mcp_servers.harmonize.oauth] client_id = "<client-id>" callback_port = 8787 callback_url = "http://localhost:8787/callback"Confirm Codex can read it:
codex mcp get harmonize -
-
Sign in to Harmonize. A login URL opens in your browser. Enter your Organization ID, followed by your email address and password for Harmonize. If your company uses single sign-on, you'll be sent to your company's sign-in page instead of entering a Harmonize password. You may occasionally need to sign in again.
Bashcodex mcp login harmonize -
On a remote VM, or if the browser shows ‘can’t reach this page’: run the login with
--no-browserinstead. It prints the login URL. Open it in the browser on your own computer and sign in. The browser is then sent tohttp://localhost:8787/callback, which can't be reached from your laptop. Copy the full URL from the address bar and paste it into the terminal prompt.Bashcodex mcp login harmonize --no-browser -
Confirm it's connected with
codex mcp list, then startcodexand type/mcp. The Harmonize tools should appear. If you changed the configuration during a session, start a fresh one. If sign-in said it was successful butcodex mcp liststill shows Not logged in, runcodex mcp login harmonizeagain.
Important: keep the client_id and the two callback lines exactly as shown. Sign-in needs them. If port 8787 is already in use, close the app using it and try again.
Start asking
Every user
-
Start a session in the folder you want to work in:
cd ~/your-project, thencodex. -
Type
/mcp. The Harmonize tools should be listed. -
Ask a question. Naming "harmonize" in your question tells Codex to use it rather than other sources.
-
If Codex asks for approval, check the server and tool named, then allow it. Approval behaviour depends on your Codex settings and workspace policy.
Test it: ask "Use harmonize. How did Visa authorization approval rates trend last quarter?" More examples in MCP Example Questions and Troubleshooting.
If something goes wrong
-
TOML parse error or duplicate table: edit the existing
harmonizeentry rather than adding a second one. -
"Dynamic client registration unsupported": check that
client_idis under[mcp_servers.harmonize.oauth]. -
Browser can't reach localhost after sign-in: that's normal on a remote VM. Copy the full URL from the address bar and paste it into the terminal prompt of
codex mcp login harmonize --no-browser. -
Signed in but tools won't load: exit and start a fresh Codex session, then check
/mcpagain. -
401 or expired credentials: run
codex mcp logout harmonize, thencodex mcp login harmonize. -
403 or access denied: your Harmonize account doesn't have access to that client. Signing in to OpenAI doesn't grant Harmonize access.
-
Anything else: email [email protected] with the output of
codex mcp get harmonizeand the time of the attempt.