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,
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states this is a connection tool but doesn't disclose behavioral traits: whether it establishes a session, validates credentials, returns a connection handle, has side effects like caching, or requires specific permissions. For a tool with zero annotation coverage, this leaves critical gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Vietnamese that directly states the tool's purpose. It's appropriately sized and front-loaded with zero wasted words, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (connection tool likely required for other operations), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what happens after connection (e.g., returns a session ID, enables subsequent calls) or error handling. For a foundational tool in this server, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters (baseUrl, tokenAuth) well-documented in the schema. The description adds no additional meaning beyond implying these are for authentication, which the schema already covers. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Kết nối đến Matomo instance với URL và token xác thực' (Connect to Matomo instance with URL and authentication token). It specifies the verb (connect) and resource (Matomo instance), but doesn't differentiate from siblings like matomo_get_system_info or matomo_add_site, which likely require an established connection first.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., must be called before other Matomo tools), exclusions, or contextual cues. The agent must infer usage from the tool name and sibling list alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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