- Home
- MCP servers
- Cpanel
Cpanel
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You will deploy and use an MCP server that acts as a secure, local gateway for WHM and cPanel operations. It lets you automate server-wide tasks and user-level actions from your scripts or development workflows while keeping credentials safely on the server side.
How to use
You interact with two sets of endpoints through a single MCP server. Use the WHM API 1 endpoints to manage server-wide tasks such as accounts and hosting plans, and use the proxied UAPI endpoints to perform actions on behalf of individual cPanel users without exposing passwords. Your client simply makes HTTP requests to the provided endpoints or runs commands via a local CLI wrapper you build on top of these routes. All operations are translated into clear JSON responses for easy debugging.
How to install
Follow these concrete steps to install and run the MCP server locally.
git clone <your-repository-url>
cd <repository-directory>
Create and activate a virtual environment to isolate dependencies.
# macOS/Linux
python3 -m venv venv
source venv/bin/activate
# Windows
python -m venv venv
.\venv\Scripts\activate
Install the required Python packages.
pip install -r requirements.txt
Configure the environment with your WHM credentials. Create a WHM API Token and set these variables in a .env file at the project root (or export them in your shell). Replace placeholders with your actual values.
WHM_HOST="https://your-hostname.com:2087"
WHM_USER="root"
WHM_API_TOKEN="your_whm_api_token_here"
Run the MCP server. The server will listen on localhost:5001 by default.
python cpanel_mcp_server.py
Security and tips
-
The WHM API token is stored server-side and is never exposed to clients.
-
Use environment variables or a dedicated .env file to avoid committing credentials.
-
Review and limit API token permissions to only what you need for your automation.
-
Enable detailed console logging to see what is forwarded to WHM/cPanel during requests, which helps with debugging and auditing.
Usage examples (high level)
Phase 1 focuses on server-wide administration through WHM API 1 endpoints, such as listing accounts, creating new cPanel accounts, and managing hosting plans. Phase 2 focuses on actions for specific cPanel users via UAPI routes proxied by the MCP server.
Notes
If you already have the MCP server running, you can build your own CLI wrappers or scripts that call the /whmapi/* endpoints for server tasks and the /uapi/<user>/* endpoints for user-level automation. Ensure you pass appropriate data and handle standard JSON responses and errors.
Available tools
listaccts
List all WHM accounts under the managed server.
createacct
Create a new cPanel account with domain and plan details.
suspendacct
Suspend a cPanel account with an optional reason.
listpkgs
List hosting packages available in WHM.
limitbw
Adjust the bandwidth quota for a user.
DomainInfo/list_domains
List all domains for a specific cPanel user.
Email/list_pops
List email accounts for a cPanel user.
Email/add_pop
Create a new email account for a user.
Mysql/create_database
Create a MySQL database for a user.
Mysql/create_user
Create a MySQL user for a database.
Mysql/set_privileges_on_database
Assign privileges to a MySQL user on a database.