Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

get_users

Retrieve and filter user accounts from CS-Cart stores to manage customers, vendors, and administrators with pagination and status controls.

Instructions

Get list of users/customers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination
items_per_pageNoNumber of items per page
statusNoUser status filter (A=Active, D=Disabled)
user_typeNoUser type filter (A=Admin, V=Vendor, C=Customer)

Implementation Reference

  • Implements the core logic of the get_users tool: builds query parameters from input arguments (page, items_per_page, status, user_type) and performs a GET request to the CS-Cart /users API endpoint via makeRequest helper, returning the result as formatted JSON text.
    async getUsers(args) {
      const params = new URLSearchParams();
      
      if (args.page) params.append('page', args.page.toString());
      if (args.items_per_page) params.append('items_per_page', args.items_per_page.toString());
      if (args.status) params.append('status', args.status);
      if (args.user_type) params.append('user_type', args.user_type);
    
      const queryString = params.toString();
      const endpoint = `/users${queryString ? `?${queryString}` : ''}`;
      
      const result = await this.makeRequest('GET', endpoint);
      return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
    }
  • Defines the input schema for the get_users tool, specifying properties for pagination (page, items_per_page), filtering by status (A/D) and user_type (A/V/C).
    inputSchema: {
      type: 'object',
      properties: {
        page: {
          type: 'number',
          description: 'Page number for pagination',
          default: 1,
        },
        items_per_page: {
          type: 'number',
          description: 'Number of items per page',
          default: 10,
        },
        status: {
          type: 'string',
          description: 'User status filter (A=Active, D=Disabled)',
          enum: ['A', 'D'],
        },
        user_type: {
          type: 'string',
          description: 'User type filter (A=Admin, V=Vendor, C=Customer)',
          enum: ['A', 'V', 'C'],
        },
      },
    },
  • src/index.js:327-355 (registration)
    Registers the get_users tool in the ListTools response, including its name, description, and full input schema.
    {
      name: 'get_users',
      description: 'Get list of users/customers',
      inputSchema: {
        type: 'object',
        properties: {
          page: {
            type: 'number',
            description: 'Page number for pagination',
            default: 1,
          },
          items_per_page: {
            type: 'number',
            description: 'Number of items per page',
            default: 10,
          },
          status: {
            type: 'string',
            description: 'User status filter (A=Active, D=Disabled)',
            enum: ['A', 'D'],
          },
          user_type: {
            type: 'string',
            description: 'User type filter (A=Admin, V=Vendor, C=Customer)',
            enum: ['A', 'V', 'C'],
          },
        },
      },
    },
  • src/index.js:410-411 (registration)
    In the CallToolRequest handler switch statement, routes 'get_users' calls to the getUsers method.
    case 'get_users':
      return await this.getUsers(args);
  • Shared helper method used by getUsers (and other tools) to make authenticated HTTP requests to the CS-Cart API endpoints.
    async makeRequest(method, endpoint, data = null) {
      const config = {
        method,
        url: `${process.env.CSCART_API_URL}${endpoint}`,
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Basic ${Buffer.from(`${process.env.CSCART_API_EMAIL}:${process.env.CSCART_API_KEY}`).toString('base64')}`,
        },
      };
    
      if (data) {
        config.data = data;
      }
    
      const response = await axios(config);
      return response.data;
    }

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/hungryweb/cscart-mcp'

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