---
title: Codex - MCP
description: Add the Contentsquare MCP server to Codex CLI and query your experience data from your terminal.
source_url:
  html: https://docs.contentsquare.com/en/mcp/codex/
  md: https://docs.contentsquare.com/en/mcp/codex/index.md
---

> ## Documentation index
> Fetch the complete documentation index at: https://docs.contentsquare.com/llms.txt
> Use this file to discover all available pages before exploring further.

Connect Codex CLI to Contentsquare to query your experience data from your terminal.

## Before you start

* You have a Contentsquare user account that can access the projects you want to query.
* You have installed Codex CLI and signed in to your OpenAI account. To install it, run `npm install -g @openai/codex`. This guide was tested with Codex CLI 0.163.0. If sign-in fails on an older release, update Codex CLI first.
* You have a browser on the same machine. The sign-in redirects to a local address that Codex opens for a few seconds.

## Add the Contentsquare MCP server

1. Run the following command. It adds the server to your `~/.codex/config.toml` file.

   ```shell
   codex mcp add contentsquare --url https://api.contentsquare.com/mcp
   ```

2. Alternatively, add the following configuration to `~/.codex/config.toml`:

   **\~/.codex/config.toml**

   ```toml
   [mcp_servers.contentsquare]
   url = "https://api.contentsquare.com/mcp"
   ```

3. Run the following command to sign in. Codex opens your browser.

   ```shell
   codex mcp login contentsquare
   ```

4. In the popup, grant Codex access to Contentsquare. Sign in if asked and select the account you want to connect.

5. Choose to grant access to your **entire account** or **select specific projects**, then click **Allow**.

6. When the browser says you can return to the terminal, you're connected.

## Check the connection

Run the following command:

```shell
codex mcp list
```

The `contentsquare` row shows **enabled**, with **OAuth** under **Auth**. In a Codex session, you can also type `/mcp` to see the server and its tools.

Start `codex` and ask a question such as "List all the projects" or "Compare visits and returning visits for my web project". The first tool call can ask for approval. Approve it once, or choose the option that remembers your choice for that tool.

## Troubleshoot the connection

| Problem | Solution |
| - | - |
| Sign-in fails right away with an "authorization endpoint origin does not match" error | Update Codex CLI to the latest release and run `codex mcp login contentsquare` again. If it still fails, contact Contentsquare support with the output of `codex --version` and the full error. |
| The browser doesn't open | Copy the URL that Codex prints in the terminal into a browser on the same machine. |
| The status shows **enabled** but **Auth** isn't **OAuth**, or tools return a 401 error | Your sign-in expired or wasn't completed. Run `codex mcp login contentsquare` again. |
| The consent page loads, but approving gives an error | Check that your Contentsquare user can open the same projects in the web app, then try again. |
| Codex works, but a project is missing | The server only returns projects your Contentsquare user can access. Ask a Customer Admin to grant you access. |

## Remove the Contentsquare MCP server

Run the following commands:

```shell
codex mcp logout contentsquare
codex mcp remove contentsquare
```

## Next steps

Once connected, ask your AI client a question such as "Which projects do you have access to?" to check the connection. See the [MCP overview](https://docs.contentsquare.com/en/mcp/) for the other supported clients.


```json
{"@context":"https://schema.org","@type":"TechArticle","headline":"Codex","description":"Add the Contentsquare MCP server to Codex CLI and query your experience data from your terminal.","url":"https://docs.contentsquare.com/en/mcp/codex/","inLanguage":"en","dateModified":"2026-11-17T16:01:23+01:00","publisher":{"@type":"Organization","name":"Contentsquare","url":"https://www.contentsquare.com/"},"isPartOf":{"@type":"WebSite","@id":"https://docs.contentsquare.com/#website","name":"Contentsquare Technical Documentation","url":"https://docs.contentsquare.com/"}}
```