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
| Name | Required | Description | Default |
|---|---|---|---|
| project_name | Yes | ||
| project_type | No | fullstack |
Implementation Reference
- aptos_mcp_server.py:180-202 (handler)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)}"
- aptos_mcp_server.py:180-180 (registration)The @mcp.tool() decorator registers the create_aptos_project function as an MCP tool.@mcp.tool()
- aptos_mcp_server.py:182-188 (schema)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) """