Integrate the Matomo MCP Server with Mistral AI
Before you start
- The MCP Server is included with Matomo Cloud. For Matomo On-Premise, you will need to first install and activate the MCP Server plugin.
- 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.
- Ensure you have access to a Mistral AI account.
- 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
- In Mistral AI, open Work.
- Expand the Context menu and select Connectors.
-
Click Add Connector.
-
Select the Custom MCP Connector tab.
- Enter a unique name in the Connector Title.
-
Copy the MCP Server URL found in Matomo Administration
> Export > MCP Server. When the MCP is enabled, the endpoint for MCP is displayed.
-
In Mistral AI, paste the MCP Server URL in the Connector Server field.
-
You can optionally add a Description with a brief summary of the connector’s purpose.
- Mistral AI will identify the server’s authentication method automatically.
- For the API Token Authentication method, use the defaults:
Authorization(Header name) andBearer(Header type). - Click the arrow next to Header value to expand the options.
- Enter the API auth token generated in Matomo (keep the auth token on hand as this will be required when starting the chat).
- Choose the appropriate Visibility option.
- 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.
-
Click on the Matomo MCP connector.
-
In the Bearer token field, enter the Matomo auth token generated earlier.
- Click Connect.
- Click New Chat to start querying your Matomo data with the MCP.
- You can also use the main chat prompt. Click the + plus icon and select Connectors > Matomo MCP.
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.