Integrate the MCP Server with Claude Code
You can now connect Claude Code using either the Claude CLI command or by manually editing the Claude configuration file. The default Claude configuration file is located at: ~/.claude.json
Before you start
Ensure the Matomo MCP server is enabled. For Matomo On-Premise, install and activate the MCP plugin before use.
Claude CLI
If using the Claude CLI command, run the following command to add the Matomo MCP server. Replace $YOUR_API_TOKEN with the Matomo API token you generated.
claude mcp add --scope user --transport http analytics 'YOUR MCP URL' --header 'Authorization: Bearer $YOUR_API_TOKEN'
Claude configuration file
Alternatively, you can edit the configuration file manually.
Open ~/.claude.json and add the following configuration. Replace YOUR_MCP_URL with your Matomo MCP endpoint and $YOUR_API_TOKEN with your Matomo API token or the access token obtained using OAuth 2.0.
{
"mcpServers": {
"analytics": {
"type": "http",
"url": "YOUR_MCP_URL",
"headers": {
"Authorization": "Bearer $YOUR_API_TOKEN"
}
}
}
}
Save the file after making the changes and restart the Claude CLI so the new MCP server configuration is loaded.