Before integrating the MCP Server with OpenAI Codex, review the Security considerations and Privacy and regulatory sections. The MCP allows external AI systems to access analytics data from your Matomo instance. You must ensure that appropriate authentication, data access controls, and privacy safeguards are in place before allowing an AI tool to query your analytics data.

Before you start

  1. The MCP Server is included with Matomo Cloud. For Matomo On-Premise, you will need to first install and activate the MCP Server plugin.
  2. In both Matomo environments, the MCP will need to be manually enabled in Matomo before use. Refer to the guide on configuring the MCP Server.
  3. Ensure you have access to a Mistral AI account.
  4. Generate an API auth token in Matomo. Keep this on hand as you will need it during the setup process to authenticate the connector in Mistral AI.

Add the Matomo MCP custom connector in Mistral AI

  1. In Mistral AI, open Work.
  2. Expand the Context menu and select Connectors.
  3. Click Add Connector.
    add connector in mistral

  4. Select the Custom MCP Connector tab.
    add mcp details

  5. Enter a unique name in the Connector Title.
  6. Copy the MCP Server URL found in Matomo Administration admin gear icon > Export > MCP Server. When the MCP is enabled, the endpoint for MCP is displayed.

  7. In Mistral AI, paste the MCP Server URL in the Connector Server field.
    add endpoint in mistral

  8. You can optionally add a Description with a brief summary of the connector’s purpose.

  9. Mistral AI will identify the server’s authentication method automatically.
  10. For the API Token Authentication method, use the defaults: Authorization (Header name) and Bearer (Header type).
  11. Click the arrow next to Header value to expand the options.
    add api token in mistral
  12. Enter the API auth token generated in Matomo (keep the auth token on hand as this will be required when starting the chat).
  13. Choose the appropriate Visibility option.
  14. Click Create.

Use the Matomo MCP connector in Mistral AI chat

When the Matomo MCP connector is successfully setup, it will appear on the My Connectors dashboard. The tick indicates the token and connection have been verified and ready to use.

  1. Click on the Matomo MCP connector.
    select mcp in mistral

  2. In the Bearer token field, enter the Matomo auth token generated earlier.
    add bearer token in mistral

  3. Click Connect.
  4. Click New Chat to start querying your Matomo data with the MCP.
  5. You can also use the main chat prompt. Click the + plus icon and select Connectors > Matomo MCP.
    start mistral chat

Get started with example prompts that help you analyse data through the Matomo MCP.

Troubleshooting MCP connections in Mistral AI

If you open the MCP Server URL in a browser and see a message similar to the following, the MCP endpoint is reachable and working correctly:

{"jsonrpc":"2.0","id":"","error":{"code":-32600,"message":"Authentication required."}}

This response indicates that the MCP server is online and waiting for a valid authentication request.

If you get connection failed errors, check the following:

  • The MCP Server is enabled in Matomo’s MCP Server settings.
  • The MCP Server URL is copied exactly as shown in the Matomo settings.
  • The Matomo user associated with the API token has access to the site you want to analyse.
  • The API token was generated from the same Matomo instance and it is a valid, active token.
  • The user does not exceed any configured Maximum allowed MCP privilege level restrictions.
  • Do not use Basic authentication for the API Token method.
  • Delete and recreate the connector.
  • Generate a new API token and test again.

Test with a dedicated MCP user

For troubleshooting and security, create a dedicated Matomo user account for MCP access. The user needs site permissions and generates a new token for the MCP connector. This isolates permission and authentication issues while limiting access to analytics data.

Previous FAQ: Integrate the Matomo MCP Server with Claude Code