Early preview: connect AI assistants and MCP clients to Matomo with secure access to sites, reports, goals, segments, and dimensions.
McpServer is an early preview plugin that adds a secure Model Context Protocol (MCP) endpoint to Matomo so AI assistants and MCP-compatible clients can work with analytics context directly from your Matomo instance.
It provides read-oriented tools for sites, reports, processed report data, goals, segments, and dimensions using the same Matomo authentication and access rules you already use in Matomo.
token_auth that already has access to the data you want to expose.For the recommended end-user setup flow, use the in-product connect guide at Administration -> Platform -> MCP Server.
The FAQ includes additional technical documentation for endpoint details, configuration, MCP enablement behavior, supported capabilities, and troubleshooting.
Use the API endpoint:
index.php?module=API&method=McpServer.mcp&format=mcp
format=mcp is required.API.getBulkRequest) with 400.401 with WWW-Authenticate: Bearer realm="mcp".Configure options in config/config.ini.php:
[McpServer]
session_ttl = 3600
log_tool_calls = 0
log_tool_call_level = DEBUG
log_tool_call_parameters_full = 0
session_ttl: Session TTL in seconds. Default is 3600 if missing or invalid.log_tool_calls: Enables tool-call logging when set to 1. Default is disabled when missing or set to 0.log_tool_call_level: Tool-call logging level when log_tool_calls = 1. Accepted values: ERROR, WARN/WARNING, INFO, DEBUG, VERBOSE (case-insensitive). Missing or invalid values default to DEBUG. VERBOSE is logged via debug-level logger calls.log_tool_call_parameters_full: Logs full tool-call parameter values when set to 1. Default is redacted parameter logging when set to 0 (may expose sensitive input data when enabled).MCP access is disabled by default and must be enabled in Administration -> System -> Plugin Settings -> McpServer.
When disabled, requests to index.php?module=API&method=McpServer.mcp&format=mcp behave as follows:
401 Unauthorized with WWW-Authenticate: Bearer realm="mcp".id receive 403 Forbidden with a JSON-RPC error response instructing the user to contact their Matomo administrator.id (for example notifications, invalid JSON, or batch payloads) receive 403 Forbidden with an empty body.The plugin is focused on read-oriented analytics workflows. The exact tool surface may expand over time, but the initial release includes tools around:
401 Unauthorized: verify the Bearer token is present, active, and belongs to a user with access to the requested site data.403 Forbidden: if MCP is disabled, enable MCP in Administration -> System -> Plugin Settings -> McpServer. If MCP is already enabled, verify the authenticated Matomo user has access to the requested site or report data.400 Bad Request: verify the client is using the exact MCP endpoint and is not proxying requests through API.getBulkRequest.