Integrate the MCP Server with OpenAI Codex
You can now connect OpenAI Codex by adding the MCP server details to your Codex configuration file. Codex stores MCP server settings in config.toml. This file is usually located at ~/.codex/config.toml, and in the IDE extension you can open it from the MCP settings menu.
Before you start
Ensure the Matomo MCP server is enabled. For Matomo On-Premise, install and activate the MCP plugin before use.
Configure Codex
Make sure you have access to Codex or your OpenAI account, your Matomo MCP endpoint URL, and a Matomo API token.
- Open Codex > Settings > Configuration.
- Click Open config.toml. If the file does not exist yet, create it.
- Codex supports both a user-level
~/.codex/config.tomlfile and a project-level.codex/config.toml file. - Add the following configuration and replace:
YOUR_MCP_URLwith your Matomo MCP endpoint, andYOUR_API_TOKENwith your Matomo API token or the access token obtained using OAuth 2.0.
- Save the file.
[mcp_servers.analytics]
url = "YOUR MCP URL"
http_headers = { "Authorization" = "Bearer $YOUR_API_TOKEN" }
Restart Codex 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, Codex should be able to access the available analytics tools through the Matomo MCP. In the Codex terminal UI, you can also use /mcp to view active MCP servers.
Using Codex CLI
The default Codex CLI configuration file is located at: ~/.codex/config.toml
- 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.