Skip to main content
Glama
ashrobertsdragon

cPanel MCP Server

cli.py2.9 kB
import argparse import inspect from cpanel_mcp.connector import Connector from cpanel_mcp.cpanel_email import CpanelEmail """CLI entry point.""" def create_parser() -> argparse.ArgumentParser: """Create the argument parser for the CLI. Returns: argparse.ArgumentParser: The populated argument parser. """ parser = argparse.ArgumentParser( "cpanel-cli", description="CLI for cPanel-MCP" ) parser.add_argument( "connector", help="Connector to use", choices=["api", "ssh"] ) parser.add_argument("--domain", help="Domain name") parser.add_argument("--email", help="Email address") parser.add_argument("--password", help="Email password") parser.add_argument("--quota", help="Email quota", default=0, type=int) parser.add_argument("--destination", help="Forwarder destination") command = parser.add_mutually_exclusive_group(required=True) command.add_argument( "-a", "--add-email", action="store_const", const="add_email_account", dest="command", ) command.add_argument( "-d", "--delete-email", action="store_const", const="delete_email_account", dest="command", ) command.add_argument( "-l", "--list-accounts", action="store_const", const="list_email_accounts", dest="command", ) command.add_argument( "-s", "--settings", action="store_const", const="get_email_settings", dest="command", ) command.add_argument( "-u", "--update-quota", action="store_const", const="update_quota", dest="command", ) command.add_argument( "-p", "--change-password", action="store_const", const="change_password", dest="command", ) command.add_argument( "-f", "--create-forwarder", action="store_const", const="create_email_forwarder", dest="command", ) command.add_argument( "-r", "--delete-forwarder", action="store_const", const="delete_email_forwarder", dest="command", ) command.add_argument( "--list-forwarders", action="store_const", const="list_email_forwarders", dest="command", ) return parser def main() -> None: """Run the CLI application.""" args = create_parser().parse_args() connector = Connector[args.connector.upper()] api = CpanelEmail(connector) tool = getattr(api, args.command) sig = inspect.signature(tool) kwargs = { name: getattr(args, name) for name in sig.parameters if hasattr(args, name) } print(tool(**kwargs))

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/ashrobertsdragon/cpanel-mcp'

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