Skip to main content
Glama

create_aptos_project

Initialize a new Aptos blockchain project with specified name and type using Aptos CLI commands.

Instructions

Create a new Aptos project using the Aptos CLI.

Args:
    project_name: Name of the project
    project_type: Type of project (fullstack, contract, client)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYes
project_typeNofullstack

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the create_aptos_project tool. It validates the project_type, constructs an Aptos CLI command to initialize a new project, executes it via subprocess, and returns success or error messages.
    @mcp.tool()
    async def create_aptos_project(project_name: str, project_type: str = "fullstack") -> str:
        """
        Create a new Aptos project using the Aptos CLI.
        
        Args:
            project_name: Name of the project
            project_type: Type of project (fullstack, contract, client)
        """
        supported_types = ["fullstack", "contract", "client"]
        if project_type not in supported_types:
            return f"Unsupported project type. Choose from: {', '.join(supported_types)}"
        
        # Command to generate project
        cmd = ["npx", "@aptos-labs/aptos-cli@latest", "init", project_name, "--type", project_type]
        
        try:
            result = subprocess.run(cmd, capture_output=True, text=True, check=True)
            return f"Successfully created {project_type} project '{project_name}'.\n\n{result.stdout}"
        except subprocess.CalledProcessError as e:
            return f"Error creating project: {e.stderr}"
        except Exception as e:
            return f"Error: {str(e)}"
  • The @mcp.tool() decorator registers the create_aptos_project function as an MCP tool.
    @mcp.tool()
  • Docstring providing tool description and parameter documentation, serving as input schema.
    """
    Create a new Aptos project using the Aptos CLI.
    
    Args:
        project_name: Name of the project
        project_type: Type of project (fullstack, contract, client)
    """

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/Tlazypanda/aptos-mcp-server'

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