Integrate the Matomo MCP Server with OpenAI Desktop App and Codex CLI
Before you start
Before you begin, make sure you have the following:
- The MCP Server is included with Matomo Cloud and must be manually enabled before use.
- For Matomo On-Premise, first install and activate the MCP Server plugin and then enable the MCP in Matomo.
- You will need access to OpenAI’s ChatGPT desktop app or Codex CLI.
- Note your Matomo MCP endpoint URL found in the MCP settings.
- Generate a Matomo API token. You can also use OAuth 2.0 to create access tokens.
This guide explains how to connect the Matomo MCP Server using the ChatGPT desktop app (previously Codex) or Codex CLI.
Integrate with ChatGPT desktop app
Connect the desktop app to the Matomo MCP Server by adding the server details to its config.toml configuration file.
- Open the desktop app and go to Settings > Configuration.
- Click Open config.toml. If the file does not exist, create it and save it in the required folder.
- You can use either the user-level configuration file at
~/.codex/config.tomlor a project-level configuration file at.codex/config.toml. - Add the following configuration and replace
YOUR_MCP_URLwith your Matomo MCP endpoint, andYOUR_API_TOKENwith your Matomo API token.
[mcp_servers.analytics]
url = "YOUR MCP URL"
http_headers = { "Authorization" = "Bearer YOUR_API_TOKEN" }
The desktop app must be restarted so the new MCP configuration is loaded. After the restart, open a session and ask a question about your Matomo analytics data.
If the MCP server is configured correctly, the desktop app should be able to access the available analytics tools through the Matomo MCP.
Integrate with OpenAI Codex CLI
Codex CLI lets you work with Codex directly from your terminal. It uses the Codex configuration file to store MCP Server settings.
- Use a terminal or command-line application and start Codex CLI by running:
codex - Open the Codex configuration file at
~/.codex/config.toml. If the file does not exist, create it. - Add the following configuration and replace
YOUR_MCP_URLwith your Matomo MCP endpoint, andYOUR_API_TOKENwith your Matomo API token.
[mcp_servers.analytics]
url = "YOUR MCP URL"
http_headers = { "Authorization" = "Bearer YOUR_API_TOKEN" }
After updating the configuration file, restart the Codex CLI so the changes take effect.
To temporarily disable the MCP server without removing the configuration, add the following setting to the MCP server configuration: enabled = false.