Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

matomo_connect

Connect to a Matomo Analytics instance using base URL and authentication token to access analytics data and manage sites, users, and reports through the MCP interface.

Instructions

Kết nối đến Matomo instance với URL và token xác thực

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
baseUrlYesURL của Matomo instance (ví dụ: https://analytics.example.com)
tokenAuthYesToken xác thực Matomo API

Implementation Reference

  • The handler function for matomo_connect tool. It creates a MatomoConfig from input arguments, instantiates MatomoApiService, tests the connection by fetching sites, and returns a success message.
    private async handleConnect(args: { baseUrl: string; tokenAuth: string }) { const config: MatomoConfig = { baseUrl: args.baseUrl, tokenAuth: args.tokenAuth, }; this.matomoService = new MatomoApiService(config); // Test connection await this.matomoService.getSites(); return { content: [ { type: 'text', text: `Đã kết nối thành công đến Matomo tại ${args.baseUrl}`, }, ], }; }
  • Input schema definition for the matomo_connect tool, specifying the required baseUrl and tokenAuth parameters with descriptions.
    inputSchema: { type: 'object', properties: { baseUrl: { type: 'string', description: 'URL của Matomo instance (ví dụ: https://analytics.example.com)', }, tokenAuth: { type: 'string', description: 'Token xác thực Matomo API', }, }, required: ['baseUrl', 'tokenAuth'], },
  • src/index.ts:39-56 (registration)
    Registration of the matomo_connect tool in the ListToolsRequestSchema handler, defining name, description, and input schema.
    { name: 'matomo_connect', description: 'Kết nối đến Matomo instance với URL và token xác thực', inputSchema: { type: 'object', properties: { baseUrl: { type: 'string', description: 'URL của Matomo instance (ví dụ: https://analytics.example.com)', }, tokenAuth: { type: 'string', description: 'Token xác thực Matomo API', }, }, required: ['baseUrl', 'tokenAuth'], }, },
  • TypeScript interface MatomoConfig used in the matomo_connect handler for typing the connection configuration.
    export interface MatomoConfig { baseUrl: string; tokenAuth: string; siteId?: number; }
  • Constructor of MatomoApiService helper class, which sets up the axios HTTP client using the MatomoConfig provided by matomo_connect.
    constructor(config: MatomoConfig) { this.config = config; this.client = axios.create({ baseURL: config.baseUrl, timeout: 30000, }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thichcode/matomo_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server