Connect Codex to UI Rules

Connect Codex through OAuth with a URL scoped to your organization, brand, project, or whole account.
PreviousNext

Choose what to connect

In UI Rules, click Connect in the top bar and choose Codex. Select an organization, brand, or project, or turn on Whole account. Turn on Read-only if this tool should not make changes.

Copy the URL or configuration shown for your selection. It includes your chosen scope, so keep the full URL, including anything after ?. See connection scopes for how the choices work.

Save the connection

For a configuration kept with your codebase, add this to .codex/config.toml. Replace YOUR_UI_RULES_MCP_URL with the full URL from Connect and preserve any existing settings:

[mcp_servers.uirules]
url = "YOUR_UI_RULES_MCP_URL"

Start Codex once in that folder and trust the project so it can load the configuration. Then run this in a terminal in the same folder:

codex mcp login uirules

For a connection available across your local projects instead, add it to your user configuration with:

codex mcp add uirules --url "YOUR_UI_RULES_MCP_URL"
codex mcp login uirules

Sign in to UI Rules in the browser and approve. Run /mcp inside Codex to confirm uirules is listed.

Project and user configuration determine where Codex loads the server. The URL still controls which UI Rules organizations, brands, and projects it can use.

Start working

Tell your agent which brand and project to use. For example:

Use the Acme brand and Website project in UI Rules. Read its guidelines and design tokens before building the page.

Use your own brand and project names. With an organization or brand connection, you can ask the agent to work on another brand or project within that scope without switching connections.

If you connected before the October 31 update, remove the old UI Rules connection and add it again using these steps. API keys no longer work for MCP connections. See Troubleshooting if sign-in or tool calls fail.

See OpenAI's MCP configuration guide for configuration and OAuth options.

Bring your brand to every AI tool

Set your rules once and use them in every AI tool you work in.