cpanel_forwarders_list
Retrieve all email forwarders configured for a domain in cPanel. Specify account, cPanel user, and domain to get the list.
Instructions
List all email forwarders for a cPanel user's domain
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | Account alias from accounts.json (use list_accounts to see options) | |
| cpanel_user | Yes | ||
| domain | Yes |
Implementation Reference
- src/tools.py:537-538 (handler)Handler for the cpanel_forwarders_list tool. Calls cPanel UAPI Email::list_forwarders with the domain argument.
case "cpanel_forwarders_list": return await _get(client, url("Email", "list_forwarders"), headers, {"domain": args.get("domain", "")}) - src/tools.py:314-325 (schema)Tool registration with input schema for cpanel_forwarders_list. Requires: account, cpanel_user, domain.
Tool( name="cpanel_forwarders_list", description="List all email forwarders for a cPanel user's domain", inputSchema={ "type": "object", "properties": { **ACCOUNT_PARAM, "cpanel_user": {"type": "string"}, "domain": {"type": "string"} }, "required": ["account", "cpanel_user", "domain"] } - src/server.py:34-44 (registration)Tools are registered via list_tools() which calls cpanel_tools() (defined in src/tools.py) to collect all cpanel tool definitions.
@app.list_tools() async def list_tools() -> list[Tool]: all_tools = [] all_tools.append(Tool( name="list_accounts", description="List all configured WHM/cPanel server accounts available in this MCP", inputSchema={"type": "object", "properties": {}, "required": []} )) all_tools.extend(whm_tools()) all_tools.extend(cpanel_tools()) return all_tools - src/tools.py:17-22 (helper)Helper _cpanel_url constructs the WHM-proxied UAPI URL used to call Email::list_forwarders.
def _cpanel_url(account: dict, module: str, function: str, cpanel_user: str = None) -> str: host = account["host"] port = account.get("port", 2087) # WHM-proxied UAPI call on behalf of a cPanel user user = cpanel_user or account.get("cpanel_user", "") return f"https://{host}:{port}/json-api/cpanel?api.version=1&cpanel_jsonapi_user={user}&cpanel_jsonapi_module={module}&cpanel_jsonapi_func={function}&cpanel_jsonapi_apiversion=3" - src/tools.py:34-40 (helper)Helper _get is the async HTTP GET function used to execute the API call for list_forwarders.
async def _get(client: httpx.AsyncClient, url: str, headers: dict, params: dict = None) -> dict: try: r = await client.get(url, headers=headers, params=params or {}) r.raise_for_status() return r.json() except Exception as e: return {"error": str(e)}