Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

destroy_deployment

Remove a Velociraptor deployment permanently to clean up resources. This irreversible action deletes all associated data and requires confirmation.

Instructions

Destroy a Velociraptor deployment and clean up resources.

WARNING: This action is irreversible. All data will be lost.

Args: deployment_id: The deployment identifier to destroy confirm: Must be True to confirm destruction

Returns: Destruction status and cleanup details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
confirmNo

Implementation Reference

  • The destroy_deployment tool handler in src/megaraptor_mcp/tools/deployment.py which performs the cleanup of deployments.
    async def destroy_deployment(
        deployment_id: str,
        confirm: bool = False,
    ) -> list[TextContent]:
        """Destroy a Velociraptor deployment and clean up resources.
    
        WARNING: This action is irreversible. All data will be lost.
    
        Args:
            deployment_id: The deployment identifier to destroy
            confirm: Must be True to confirm destruction
    
        Returns:
            Destruction status and cleanup details.
        """
        if not confirm:
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Destruction not confirmed",
                    "message": "Set confirm=True to destroy the deployment",
                    "warning": "This action is irreversible. All data will be lost.",
                }, indent=2)
            )]
    
        try:
            # Validate deployment_id
            deployment_id = validate_deployment_id(deployment_id)
    
            from ..deployment.deployers import DockerDeployer, BinaryDeployer
            from ..deployment.security import CertificateManager, CredentialStore
    
            # Try Docker first
            deployer = DockerDeployer()
            info = await deployer.get_status(deployment_id)
    
            if info:
                result = await deployer.destroy(deployment_id, force=True)
    
                # Clean up certificates and credentials
                cert_manager = CertificateManager()
                cert_manager.delete_bundle(deployment_id)
    
                cred_store = CredentialStore()
                cred_store.clear_deployment(deployment_id)
    
                return [TextContent(
                    type="text",
                    text=json.dumps(result.to_dict(), indent=2)
                )]
    
            # Try binary deployer
            deployer = BinaryDeployer()
            result = await deployer.destroy(deployment_id, force=True)
    
            return [TextContent(
                type="text",
                text=json.dumps(result.to_dict(), indent=2)
            )]
    
        except ValueError as e:
            # Validation errors
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": str(e),
                    "hint": "Provide a valid deployment ID starting with 'vr-'"
                }, indent=2)
            )]
    
        except ImportError as e:
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": f"Missing dependency: {str(e)}",
                    "hint": "Install required packages with: pip install megaraptor-mcp[deployment]"
                }, indent=2)
            )]
    
        except Exception:
            # Generic errors - don't expose internals
            return [TextContent(
                type="text",
                text=json.dumps({
                    "error": "Failed to destroy deployment",
                    "hint": "Check deployment ID and ensure deployment exists"
                }, indent=2)
            )]

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/wagonbomb/megaraptor-mcp'

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