Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

matomo_get_visits_summary

Retrieve total visits, actions, and engagement metrics for a specific Matomo site during a defined period to analyze traffic patterns and performance.

Instructions

Lấy tổng quan lượt truy cập của site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteIdYesID của site
dateYesNgày cần lấy dữ liệu (YYYY-MM-DD)
periodNoChu kỳ (day, week, month, year)day

Implementation Reference

  • Core handler function that executes the tool logic by calling the Matomo API 'VisitsSummary.get' endpoint with the provided siteId, date, and period parameters.
    async getVisitsSummary(siteId: number, date: string, period: string = 'day'): Promise<any> { return await this.makeRequest('VisitsSummary.get', { idSite: siteId, date, period, }); }
  • MCP server wrapper handler that checks connection, calls the service method, and formats the response as MCP content.
    private async handleGetVisitsSummary(args: { siteId: number; date: string; period?: string }) { if (!this.matomoService) { throw new Error('Chưa kết nối đến Matomo. Vui lòng sử dụng matomo_connect trước.'); } const summary = await this.matomoService.getVisitsSummary(args.siteId, args.date, args.period); return { content: [ { type: 'text', text: `Tổng quan lượt truy cập:\n${JSON.stringify(summary, null, 2)}`, }, ], }; }
  • Input schema and tool metadata definition used for tool registration and validation.
    { name: 'matomo_get_visits_summary', description: 'Lấy tổng quan lượt truy cập của site', inputSchema: { type: 'object', properties: { siteId: { type: 'number', description: 'ID của site', }, date: { type: 'string', description: 'Ngày cần lấy dữ liệu (YYYY-MM-DD)', }, period: { type: 'string', description: 'Chu kỳ (day, week, month, year)', default: 'day', }, }, required: ['siteId', 'date'], }, },
  • src/index.ts:284-285 (registration)
    Tool dispatch registration in the CallToolRequestSchema switch statement.
    case 'matomo_get_visits_summary': return await this.handleGetVisitsSummary(args as { siteId: number; date: string; period?: string });

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