Skip to main content
Glama
elgentos

Magento 2 Development MCP Server

by elgentos

config-store-set

Set store-specific configuration values in Magento 2 to customize settings for individual store views or websites.

Instructions

Set store-specific Magento 2 configuration values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesConfiguration path to set
storeIdNoStore ID (optional)
valueYesValue to set

Implementation Reference

  • The handler function for the 'config-store-set' tool. It builds a magerun2 command to set store-specific configuration and executes it, returning success or error response.
    async ({ path, value, storeId }) => {
      let command = `magerun2 config:store:set "${path}" "${value}"`;
    
      if (storeId) {
        command += ` --store-id="${storeId}"`;
      }
    
      const result = await executeMagerun2Command(command);
    
      if (!result.success) {
        return {
          content: [{
            type: "text",
            text: result.error
          }],
          isError: true
        };
      }
    
      return {
        content: [{
          type: "text",
          text: `Store configuration set successfully:\n\n${result.data}`
        }]
      };
    }
  • Input schema using Zod for validating the tool's parameters: path (string), value (string), storeId (optional string).
    inputSchema: {
      path: z.string()
        .describe("Configuration path to set"),
      value: z.string()
        .describe("Value to set"),
      storeId: z.string()
        .optional()
        .describe("Store ID (optional)")
    }
  • src/index.ts:889-930 (registration)
    Registration of the 'config-store-set' tool with server.registerTool, including name, metadata (title, description), input schema, and inline handler function.
    server.registerTool(
      "config-store-set",
      {
        title: "Config Store Set",
        description: "Set store-specific Magento 2 configuration values",
        inputSchema: {
          path: z.string()
            .describe("Configuration path to set"),
          value: z.string()
            .describe("Value to set"),
          storeId: z.string()
            .optional()
            .describe("Store ID (optional)")
        }
      },
      async ({ path, value, storeId }) => {
        let command = `magerun2 config:store:set "${path}" "${value}"`;
    
        if (storeId) {
          command += ` --store-id="${storeId}"`;
        }
    
        const result = await executeMagerun2Command(command);
    
        if (!result.success) {
          return {
            content: [{
              type: "text",
              text: result.error
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: `Store configuration set successfully:\n\n${result.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/elgentos/magento2-dev-mcp'

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