Skip to main content
Glama
smithery-ai

Shopify Update MCP Server

by smithery-ai

get-shop

Retrieve Shopify store details including configuration, settings, and business information to manage store operations.

Instructions

Get shop details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get-shop' tool. It instantiates a ShopifyClient, calls loadShop with the access token and shop domain, stringifies the shop data, and returns it in the expected MCP format. Handles errors using handleError.
    server.tool("get-shop", "Get shop details", {}, async () => {
      const client = new ShopifyClient();
      try {
        const shop = await client.loadShop(SHOPIFY_ACCESS_TOKEN, MYSHOPIFY_DOMAIN);
        return {
          content: [{ type: "text", text: JSON.stringify(shop, null, 2) }],
        };
      } catch (error) {
        return handleError("Failed to retrieve shop details", error);
      }
    });
  • src/index.ts:541-551 (registration)
    Registers the 'get-shop' tool on the MCP server with description 'Get shop details' and empty input schema.
    server.tool("get-shop", "Get shop details", {}, async () => {
      const client = new ShopifyClient();
      try {
        const shop = await client.loadShop(SHOPIFY_ACCESS_TOKEN, MYSHOPIFY_DOMAIN);
        return {
          content: [{ type: "text", text: JSON.stringify(shop, null, 2) }],
        };
      } catch (error) {
        return handleError("Failed to retrieve shop details", error);
      }
    });
  • Core implementation of shop data retrieval via HTTP GET request to Shopify's /admin/api/{version}/shop.json endpoint using shopifyHTTPRequest method.
    async loadShop(
      accessToken: string,
      shop: string
    ): Promise<LoadStorefrontsResponse> {
      const res = await this.shopifyHTTPRequest<LoadStorefrontsResponse>({
        method: "GET",
        url: `https://${shop}/admin/api/${this.SHOPIFY_API_VERSION}/shop.json`,
        accessToken,
      });
    
      return res.data;
    }
  • Utility function used by the get-shop handler to format and return error responses in MCP format.
    function handleError(
      defaultMessage: string,
      error: unknown
    ): {
      content: { type: "text"; text: string }[];
      isError: boolean;
    } {
      let errorMessage = defaultMessage;
      if (error instanceof CustomError) {
        errorMessage = `${defaultMessage}: ${error.message}`;
      }
      return {
        content: [{ type: "text", text: errorMessage }],
        isError: true,
      };
    }

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/smithery-ai/shopify-mcp-server-main-1'

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