Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

matomo_get_users

Retrieve a complete list of users from Matomo Analytics using the Matomo MCP Server. Facilitates user management and access control for analytics reports.

Instructions

Lấy danh sách tất cả users trong Matomo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:103-110 (registration)
    Registration of the 'matomo_get_users' tool in the ListToolsRequestSchema handler, including its name, description, and empty input schema.
    { name: 'matomo_get_users', description: 'Lấy danh sách tất cả users trong Matomo', inputSchema: { type: 'object', properties: {}, }, },
  • The main handler function for the 'matomo_get_users' tool, which checks the connection and calls the MatomoApiService.getUsers method, then formats the response.
    private async handleGetUsers() { 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 users = await this.matomoService.getUsers(); return { content: [ { type: 'text', text: `Danh sách users:\n${JSON.stringify(users, null, 2)}`, }, ], }; }
  • Core implementation of user retrieval in MatomoApiService by calling the Matomo API method 'UsersManager.getUsers' via the makeRequest helper.
    async getUsers(): Promise<MatomoUser[]> { const response = await this.makeRequest('UsersManager.getUsers'); return Array.isArray(response) ? response : []; }
  • Helper method used by getUsers to make authenticated API requests to Matomo.
    private async makeRequest(method: string, params: Record<string, any> = {}): Promise<any> { const requestParams = { module: 'API', format: 'JSON', token_auth: this.config.tokenAuth, ...params, }; try { const response = await this.client.get('', { params: requestParams }); return response.data; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Matomo API error: ${error.response?.data?.message || error.message}`); } throw error; } }

Other Tools

Related Tools

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