Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

matomo_get_top_pages

Retrieve the most accessed pages from a Matomo Analytics site by specifying the site ID, date, period, and result limit. Use this tool to analyze web traffic and optimize content performance.

Instructions

Lấy danh sách trang được truy cập nhiều nhất

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYesNgày cần lấy dữ liệu (YYYY-MM-DD)
limitNoSố lượng kết quả tối đa
periodNoChu kỳ (day, week, month, year)day
siteIdYesID của site

Implementation Reference

  • Core implementation of matomo_get_top_pages: calls Matomo API Actions.getPageUrls with siteId, date, period, and limit to fetch top pages.
    async getTopPages(siteId: number, date: string, period: string = 'day', limit: number = 10): Promise<any> { return await this.makeRequest('Actions.getPageUrls', { idSite: siteId, date, period, filter_limit: limit, }); }
  • Input schema for matomo_get_top_pages tool defining required siteId and date, optional period and limit.
    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', }, limit: { type: 'number', description: 'Số lượng kết quả tối đa', default: 10, }, }, required: ['siteId', 'date'], },
  • src/index.ts:287-288 (registration)
    Tool dispatch registration in the CallToolRequestSchema switch statement.
    case 'matomo_get_top_pages': return await this.handleGetTopPages(args as { siteId: number; date: string; period?: string; limit?: number });
  • MCP server wrapper handler for matomo_get_top_pages that validates connection and delegates to MatomoApiService.getTopPages, formats response.
    private async handleGetTopPages(args: { siteId: number; date: string; period?: string; limit?: number }) { 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 pages = await this.matomoService.getTopPages(args.siteId, args.date, args.period, args.limit); return { content: [ { type: 'text', text: `Top pages:\n${JSON.stringify(pages, null, 2)}`, }, ], }; }
  • src/index.ts:208-235 (registration)
    Full tool definition registration in ListToolsRequestSchema response including name, description, and schema.
    { name: 'matomo_get_top_pages', description: 'Lấy danh sách trang được truy cập nhiều nhất', 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', }, limit: { type: 'number', description: 'Số lượng kết quả tối đa', default: 10, }, }, required: ['siteId', 'date'], }, },

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