Skip to main content
Glama
run-as-root

Warden Magento MCP Server

by run-as-root

warden_init_project

Initialize a new Magento 2 development environment with Warden by setting up PHP, MySQL, Node.js, Redis, and other required services for local development.

Instructions

Initialize a new Warden project with Magento 2 environment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath where the project should be initialized
project_nameYesName for the Warden environment
environment_typeNoEnvironment type (default: magento2)magento2
php_versionNoPHP version (default: 8.3)8.3
mysql_distributionNoMySQL distribution (default: mariadb)mariadb
mysql_versionNoMySQL version (default: 10.6)10.6
node_versionNoNode.js version (default: 20)20
composer_versionNoComposer version (default: 2)2
opensearch_versionNoOpenSearch version (default: 2.12)2.12
redis_versionNoRedis version (default: 7.2)7.2
enable_redisNoEnable Redis (default: true)
enable_opensearchNoEnable OpenSearch (default: true)
enable_varnishNoEnable Varnish (default: true)
enable_rabbitmqNoEnable RabbitMQ (default: true)
enable_xdebugNoEnable Xdebug (default: true)

Implementation Reference

  • The function that executes the 'warden_init_project' tool logic. It creates the project directory, runs 'warden env init' command, updates the .env file with provided configuration parameters like versions and enabled services, and returns structured success or error response.
    async initProject(args) {
      try {
        const {
          project_path,
          project_name,
          environment_type = "magento2",
          php_version = "8.3",
          mysql_distribution = "mariadb",
          mysql_version = "10.6",
          node_version = "20",
          composer_version = "2",
          opensearch_version = "2.12",
          redis_version = "7.2",
          enable_redis = true,
          enable_opensearch = true,
          enable_varnish = true,
          enable_rabbitmq = true,
          enable_xdebug = true,
        } = args;
    
        const absoluteProjectPath = resolve(project_path);
    
        // Create project directory if it doesn't exist
        execSync(`mkdir -p "${absoluteProjectPath}"`);
    
        // Change to project directory and initialize warden environment
        const result = await this.executeCommand(
          "warden",
          ["env", "init", project_name, environment_type],
          absoluteProjectPath,
        );
    
        if (result.code !== 0) {
          throw new Error(`Warden init failed: ${result.stderr}`);
        }
    
        // Read the generated .env file and update it with custom parameters
        const envFilePath = join(absoluteProjectPath, ".env");
    
        if (existsSync(envFilePath)) {
          let envContent = readFileSync(envFilePath, "utf8");
    
          // Update environment variables
          const updates = {
            PHP_VERSION: php_version,
            MYSQL_DISTRIBUTION: mysql_distribution,
            MYSQL_DISTRIBUTION_VERSION: mysql_version,
            NODE_VERSION: node_version,
            COMPOSER_VERSION: composer_version,
            OPENSEARCH_VERSION: opensearch_version,
            REDIS_VERSION: redis_version,
            WARDEN_REDIS: enable_redis ? "1" : "0",
            WARDEN_OPENSEARCH: enable_opensearch ? "1" : "0",
            WARDEN_VARNISH: enable_varnish ? "1" : "0",
            WARDEN_RABBITMQ: enable_rabbitmq ? "1" : "0",
            PHP_XDEBUG_3: enable_xdebug ? "1" : "0",
          };
    
          // Update each environment variable
          for (const [key, value] of Object.entries(updates)) {
            const regex = new RegExp(`^${key}=.*$`, "m");
            if (envContent.match(regex)) {
              envContent = envContent.replace(regex, `${key}=${value}`);
            } else {
              envContent += `\n${key}=${value}`;
            }
          }
    
          writeFileSync(envFilePath, envContent);
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Warden project initialized successfully!\n\nProject Path: ${absoluteProjectPath}\nProject Name: ${project_name}\nEnvironment Type: ${environment_type}\n\nConfiguration:\n- PHP Version: ${php_version}\n- MySQL: ${mysql_distribution} ${mysql_version}\n- Node.js: ${node_version}\n- Composer: ${composer_version}\n- OpenSearch: ${opensearch_version} (${enable_opensearch ? "enabled" : "disabled"})\n- Redis: ${redis_version} (${enable_redis ? "enabled" : "disabled"})\n- Varnish: ${enable_varnish ? "enabled" : "disabled"}\n- RabbitMQ: ${enable_rabbitmq ? "enabled" : "disabled"}\n- Xdebug: ${enable_xdebug ? "enabled" : "disabled"}\n\nNext steps:\n1. Navigate to: ${absoluteProjectPath}\n2. Run: warden env up\n3. Your environment will be available at: https://${project_name}.test\n\nOutput:\n${result.stdout}`,
            },
          ],
          isError: false,
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Failed to initialize Warden project:\n\nProject Path: ${args.project_path}\nProject Name: ${args.project_name}\nError: ${error.message}\n\nOutput:\n${error.stdout || "(no output)"}\n\nErrors:\n${error.stderr || "(no errors)"}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the 'warden_init_project' tool, specifying parameters like project_path, project_name, versions for PHP/MySQL/Node/etc., and booleans to enable services like Redis, OpenSearch, Varnish.
    inputSchema: {
      type: "object",
      properties: {
        project_path: {
          type: "string",
          description: "Path where the project should be initialized",
        },
        project_name: {
          type: "string",
          description: "Name for the Warden environment",
        },
        environment_type: {
          type: "string",
          description: "Environment type (default: magento2)",
          default: "magento2",
        },
        php_version: {
          type: "string",
          description: "PHP version (default: 8.3)",
          default: "8.3",
        },
        mysql_distribution: {
          type: "string",
          description: "MySQL distribution (default: mariadb)",
          default: "mariadb",
        },
        mysql_version: {
          type: "string",
          description: "MySQL version (default: 10.6)",
          default: "10.6",
        },
        node_version: {
          type: "string",
          description: "Node.js version (default: 20)",
          default: "20",
        },
        composer_version: {
          type: "string",
          description: "Composer version (default: 2)",
          default: "2",
        },
        opensearch_version: {
          type: "string",
          description: "OpenSearch version (default: 2.12)",
          default: "2.12",
        },
        redis_version: {
          type: "string",
          description: "Redis version (default: 7.2)",
          default: "7.2",
        },
        enable_redis: {
          type: "boolean",
          description: "Enable Redis (default: true)",
          default: true,
        },
        enable_opensearch: {
          type: "boolean",
          description: "Enable OpenSearch (default: true)",
          default: true,
        },
        enable_varnish: {
          type: "boolean",
          description: "Enable Varnish (default: true)",
          default: true,
        },
        enable_rabbitmq: {
          type: "boolean",
          description: "Enable RabbitMQ (default: true)",
          default: true,
        },
        enable_xdebug: {
          type: "boolean",
          description: "Enable Xdebug (default: true)",
          default: true,
        },
      },
      required: ["project_path", "project_name"],
    },
  • server.js:231-314 (registration)
    Tool registration in the ListToolsRequestSchema handler, providing name, description, and input schema for discovery.
    {
      name: "warden_init_project",
      description:
        "Initialize a new Warden project with Magento 2 environment",
      inputSchema: {
        type: "object",
        properties: {
          project_path: {
            type: "string",
            description: "Path where the project should be initialized",
          },
          project_name: {
            type: "string",
            description: "Name for the Warden environment",
          },
          environment_type: {
            type: "string",
            description: "Environment type (default: magento2)",
            default: "magento2",
          },
          php_version: {
            type: "string",
            description: "PHP version (default: 8.3)",
            default: "8.3",
          },
          mysql_distribution: {
            type: "string",
            description: "MySQL distribution (default: mariadb)",
            default: "mariadb",
          },
          mysql_version: {
            type: "string",
            description: "MySQL version (default: 10.6)",
            default: "10.6",
          },
          node_version: {
            type: "string",
            description: "Node.js version (default: 20)",
            default: "20",
          },
          composer_version: {
            type: "string",
            description: "Composer version (default: 2)",
            default: "2",
          },
          opensearch_version: {
            type: "string",
            description: "OpenSearch version (default: 2.12)",
            default: "2.12",
          },
          redis_version: {
            type: "string",
            description: "Redis version (default: 7.2)",
            default: "7.2",
          },
          enable_redis: {
            type: "boolean",
            description: "Enable Redis (default: true)",
            default: true,
          },
          enable_opensearch: {
            type: "boolean",
            description: "Enable OpenSearch (default: true)",
            default: true,
          },
          enable_varnish: {
            type: "boolean",
            description: "Enable Varnish (default: true)",
            default: true,
          },
          enable_rabbitmq: {
            type: "boolean",
            description: "Enable RabbitMQ (default: true)",
            default: true,
          },
          enable_xdebug: {
            type: "boolean",
            description: "Enable Xdebug (default: true)",
            default: true,
          },
        },
        required: ["project_path", "project_name"],
      },
    },
  • server.js:341-342 (registration)
    Handler dispatch registration in the CallToolRequestSchema switch statement, mapping the tool name to the initProject method.
    case "warden_init_project":
      return await this.initProject(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool initializes a project but doesn't describe what that entails: whether it creates files/directories, modifies system configurations, requires specific permissions, has side effects, or what happens on success/failure. For a tool with 15 parameters that likely creates infrastructure, this is a significant gap.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with every word contributing to understanding what the tool does.

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 (15 parameters, no annotations, no output schema), the description is insufficient. It doesn't explain what 'initializing' entails operationally, what gets created or modified, potential side effects, or expected outcomes. For a tool that likely sets up development environments with multiple services, more context about the behavioral impact 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%, so the schema already documents all 15 parameters thoroughly with descriptions and defaults. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3 for adequate coverage through structured data alone.

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 action ('Initialize') and resource ('new Warden project with Magento 2 environment'), providing a specific purpose. However, it doesn't explicitly differentiate from sibling tools like 'warden_start_project' or 'warden_list_environments', which might cause confusion about when to use this initialization tool versus starting an existing project.

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., whether Warden must be installed), when-not-to-use scenarios (e.g., for existing projects), or how it relates to sibling tools like 'warden_start_project' for starting initialized projects.

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/run-as-root/warden-mcp-server'

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