Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

generate_server_config

Generate Velociraptor server configuration files for digital forensics deployments, supporting YAML or JSON output formats to enable endpoint management and threat hunting workflows.

Instructions

Generate Velociraptor server configuration file.

Args: deployment_id: The deployment to generate config for output_format: Output format - 'yaml' or 'json'

Returns: Server configuration content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
output_formatNoyaml

Implementation Reference

  • The handler function `generate_server_config` implementation in `src/megaraptor_mcp/tools/deployment.py`.
    async def generate_server_config(
        deployment_id: str,
        output_format: str = "yaml",
    ) -> list[TextContent]:
        """Generate Velociraptor server configuration file.
    
        Args:
            deployment_id: The deployment to generate config for
            output_format: Output format - 'yaml' or 'json'
    
        Returns:
            Server configuration content.
        """
        try:
            from ..deployment.security import CertificateManager
            from ..deployment.deployers import DockerDeployer
    
            # Get deployment info
            deployer = DockerDeployer()
            info = await deployer.get_status(deployment_id)
    
            if not info:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": f"Deployment not found: {deployment_id}",
                        "hint": "Use list_deployments tool to see available deployments"
                    }, indent=2)
                )]
    
            # Load certificates
            cert_manager = CertificateManager()
            bundle = cert_manager.load_bundle(deployment_id)
    
            if not bundle:
                return [TextContent(
                    type="text",
                    text=json.dumps({
                        "error": "Certificate bundle not found"
                    }, indent=2)
                )]
    
            # Generate config
            import yaml
            config = {
                "version": {"name": "megaraptor-deployment"},
                "Client": {
                    "server_urls": [info.server_url.replace("/api/", "") + ":8000/"],
                    "ca_certificate": bundle.ca_cert,
                },
                "API": {
                    "bind_address": "0.0.0.0:8889",
                    "bind_scheme": "https",
                },
                "GUI": {
                    "bind_address": "0.0.0.0:8889",
                    "bind_scheme": "https",
                    "public_url": info.server_url,
                },
                "Frontend": {
                    "bind_address": "0.0.0.0:8000",
                },
                "ca_certificate": bundle.ca_cert,
            }
    
            if output_format == "json":
                output = json.dumps(config, indent=2)
            else:
                output = yaml.dump(config, default_flow_style=False)
    
            return [TextContent(
                type="text",
                text=output
            )]
    
        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": "Operation failed",
                    "hint": "Check deployment configuration and try again"
                }, 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