Skip to main content
Glama
thichcode

Matomo MCP Server

by thichcode

matomo_get_users

Retrieve all user accounts from Matomo Analytics to manage access permissions and user administration.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that retrieves the list of Matomo users by calling the 'UsersManager.getUsers' API endpoint via the private makeRequest method.
    async getUsers(): Promise<MatomoUser[]> { const response = await this.makeRequest('UsersManager.getUsers'); return Array.isArray(response) ? response : []; }
  • MCP server wrapper handler that validates the Matomo service connection and delegates to MatomoApiService.getUsers(), formatting the response as MCP content.
    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)}`, }, ], }; }
  • Tool registration schema defining the 'matomo_get_users' tool with empty input schema (no parameters required).
    { name: 'matomo_get_users', description: 'Lấy danh sách tất cả users trong Matomo', inputSchema: { type: 'object', properties: {}, }, },
  • src/index.ts:265-267 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching to handleGetUsers().
    case 'matomo_get_users': return await this.handleGetUsers();
  • Helper method used by getUsers to make authenticated HTTP requests to the Matomo API.
    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; } }

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