Skip to main content
Glama
wagonbomb

Megaraptor MCP

by wagonbomb

generate_api_credentials

Create API client certificates to connect the Megaraptor MCP server to Velociraptor deployments for digital forensics and incident response workflows.

Instructions

Generate API client credentials for MCP connection.

Creates a new API client certificate for connecting this MCP server to a Velociraptor deployment.

Args: deployment_id: The deployment to generate credentials for client_name: Name for the API client validity_days: Certificate validity in days

Returns: API credentials in Velociraptor config file format. IMPORTANT: Save these credentials - they can only be displayed once.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deployment_idYes
client_nameNomegaraptor_api
validity_daysNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The implementation of the 'generate_api_credentials' tool which generates API client credentials for MCP connections.
    async def generate_api_credentials(
        deployment_id: str,
        client_name: str = "megaraptor_api",
        validity_days: int = 365,
    ) -> list[TextContent]:
        """Generate API client credentials for MCP connection.
    
        Creates a new API client certificate for connecting this MCP
        server to a Velociraptor deployment.
    
        Args:
            deployment_id: The deployment to generate credentials for
            client_name: Name for the API client
            validity_days: Certificate validity in days
    
        Returns:
            API credentials in Velociraptor config file format.
            IMPORTANT: Save these credentials - they can only be displayed once.
        """
        try:
            from ..deployment.security import CertificateManager, CredentialStore, StoredCredential
            from ..deployment.security.credential_store import generate_credential_id
            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 API client config (Velociraptor format)
            import yaml
            api_config = {
                "api_url": info.api_url or info.server_url,
                "ca_certificate": bundle.ca_cert,
                "client_cert": bundle.api_cert,
                "client_private_key": bundle.api_key,
            }
    
            # Store credential metadata
            cred_store = CredentialStore()
            credential = StoredCredential(
                id=generate_credential_id(),
                name=client_name,
                credential_type="api_key",
                created_at=datetime.now(timezone.utc).isoformat(),
                expires_at=(datetime.now(timezone.utc) + timedelta(days=validity_days)).isoformat(),
                deployment_id=deployment_id,
                data={"client_name": client_name},
            )
            cred_store.store(credential)
    
            # Return config in YAML format (matches Velociraptor api_client format)
            return [TextContent(
                type="text",
                text=f"""# Velociraptor API Client Configuration
    # Generated for: {client_name}
    # Deployment: {deployment_id}
    # Expires: {credential.expires_at}
    #
    # IMPORTANT: Save this configuration - it cannot be displayed again!
    # Set VELOCIRAPTOR_CONFIG_PATH to this file to use with MCP.
    
    {yaml.dump(api_config, default_flow_style=False)}"""
            )]
    
        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)
            )]
Behavior4/5

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

With no annotations provided, the description carries the full burden and successfully discloses key behavioral traits: the credentials are certificate-based, returned in 'Velociraptor config file format,' and critically, 'can only be displayed once.' Missing minor details like whether this invalidates previous credentials or required permissions, but covers the essential safety-critical behavior.

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?

Uses a clean docstring structure with distinct Args and Returns sections. Every sentence earns its place: the intro establishes purpose, the Args clarify inputs, the Returns specify output format, and the final warning prevents data loss. No redundant or filler text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a credential generation tool with 3 parameters and an output schema, the description is complete. It explains what is created (API credentials/certificate), the output format (Velociraptor config file), the critical one-time constraint, and documents all parameters. No significant gaps remain for safe and correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Completely compensates for the 0% schema description coverage by documenting all three parameters in the Args section: deployment_id ('The deployment to generate credentials for'), client_name ('Name for the API client'), and validity_days ('Certificate validity in days'). The descriptions are clear and sufficient for proper invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Generate API client credentials' / 'Creates a new API client certificate') and the exact resource/target ('for connecting this MCP server to a Velociraptor deployment'). It effectively distinguishes from siblings like generate_agent_installer, generate_server_config, and generate_ansible_playbook by specifying this is for MCP API connection credentials.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides critical usage guidance with 'IMPORTANT: Save these credentials - they can only be displayed once,' warning users about the one-time nature of the output. While it doesn't explicitly compare against sibling alternatives, the specific naming and purpose make the differentiation clear, and the warning constitutes essential usage context.

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

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