Skip to main content
Glama
dqhieu
by dqhieu

get-total-users

Retrieve the total user count of Compresto’s file compression app using real-time data from Compresto MCP for accurate usage insights and analysis.

Instructions

Get total users of Compresto

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:47-76 (registration)
    Registers the MCP tool 'get-total-users'. The inline async handler fetches landing page data from the Supabase API endpoint and returns the totalUsers value as a text content block, or an error if fetch fails.
    server.tool(
      "get-total-users",
      "Get total users of Compresto",
      {},
      async () => {
        const url = `${API_BASE}/v1/getLandingPageData`;
        const response = await makeSupabaseRequest<LandingPageDataResponse>(url);
        
        if (!response) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to fetch user data"
              }
            ],
            isError: true
          };
        }
        
        return {
          content: [
            {
              type: "text",
              text: response.data.totalUsers.toString()
            }
          ]
        };
      },
    );
  • Helper function that makes authenticated HTTP requests to the Supabase API using fetch, with error handling and JSON parsing. Used by the get-total-users handler.
    async function makeSupabaseRequest<T>(url: string): Promise<T | null> {
      const headers = {
        "User-Agent": USER_AGENT,
        Accept: "application/json",
      };
    
      try {
        const response = await fetch(url, { headers });
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        return (await response.json()) as T;
      } catch (error) {
        console.error("Error making Supabase request:", error);
        return null;
      }
    }
  • TypeScript interface defining the structure of the landing page data response from the API, including totalUsers field used by the tool.
    interface LandingPageDataResponse {
      data: {
        totalUsers: number;
        totalCompressedVideos: number;
        totalReducedSize: number;
        monthlyUsers: number;
      }
    }
Install Server

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/dqhieu/compresto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server