Skip to main content

Overview

Connect Affonso to the Codex CLI, IDE extension, or ChatGPT desktop app to manage your affiliate program without leaving your coding workflow. Affonso uses the Streamable HTTP transport and supports OAuth 2.1 and API-key authentication.
OAuth is recommended. It keeps your Affonso API key out of your Codex configuration.

Connect with OAuth

Step 1: Add the server

Run the following command in your terminal:

Step 2: Sign in to Affonso

Start the OAuth flow:
Your browser opens automatically. Sign in to Affonso, choose your team if prompted, and approve the requested permissions.

Step 3: Verify the connection

Start Codex and enter /mcp to see the active server. You can now ask Codex to use Affonso, for example:

Connect with an API Key

Use an API key when OAuth is not available in your environment.
1

Create an environment variable

Get an API key from the Affonso dashboard, then expose it in the shell where you run Codex:
2

Add the server

Codex reads the token from the environment each time it connects, so the API key is not written into ~/.codex/config.toml.

Manual Configuration

If you prefer to edit the configuration file, add this to ~/.codex/config.toml:
Then authenticate with:
For API-key authentication, use this configuration instead:

Troubleshooting

Run codex mcp login affonso in an interactive terminal. If Codex prints an authorization URL instead of opening a browser, open that URL manually and complete the sign-in flow.
Run codex mcp list to confirm the configuration. Then restart Codex and use /mcp to check its status.
Confirm that AFFONSO_API_KEY is available in the same shell that starts Codex and that the key is active in the Affonso dashboard.

Next Steps

Explore Tools

See all available MCP tools

Example Queries

Try Affonso prompts in Codex