cPanel MCP Server
Provides tools for managing cPanel hosting accounts, including file management, databases, email accounts, subdomains, disk usage, backups, and SSL certificates.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cPanel MCP ServerCreate a new database called my_app_db"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cPanel MCP Server
A complete Model Context Protocol (MCP) server for managing cPanel hosting through AI assistants like Claude Code
๐ฏ Overview
This is a production-ready MCP server that enables natural language management of cPanel hosting accounts through AI assistants. Built from scratch with TypeScript, it provides 16 tools for comprehensive hosting management.
Why This Exists: The original cPanel MCP repository contained only documentation with no source code. This is a complete, working implementation that you can use today.
โจ Features
๐๏ธ File Management
List Files - Browse directories and view contents
Read Files - View file contents
Write Files - Create or update files
Delete Files - Remove files and directories
๐๏ธ Database Management
List Databases - View all MySQL databases
Create Database - Create new databases
Delete Database - Remove databases
๐ง Email Management
List Email Accounts - View all email accounts
Create Email - Add new email accounts with quotas
Delete Email - Remove email accounts
๐ Domain Management
List Subdomains - View all subdomains
Create Subdomain - Add new subdomains
Delete Subdomain - Remove subdomains
๐พ System & Security
Disk Usage - Check storage statistics and quotas
Full Backup - Initiate account backups
Install SSL - Set up SSL certificates
๐ Installation
Prerequisites
Node.js 18 or higher
cPanel account with API token access
AI assistant that supports MCP (like Claude Code)
Setup Steps
Clone the Repository
git clone https://github.com/aandersen2323/cpanel-mcp-server.git cd cpanel-mcp-serverInstall Dependencies
npm installBuild the Server
npm run buildConfigure Credentials
cp .env.example .env # Edit .env with your cPanel credentialsAdd to Your MCP Configuration
For Claude Code (VS Code), add to
.vscode/settings.json:{ "mcp.servers": { "cpanel": { "command": "node", "args": ["/absolute/path/to/cpanel-mcp-server/build/index.js"], "env": { "CPANEL_USERNAME": "your_username@your_domain.com", "CPANEL_API_TOKEN": "your_api_token", "CPANEL_SERVER_URL": "https://your-domain.com:2083" } } } }Restart Your AI Assistant The MCP server will auto-start and be ready to use!
๐ Usage Examples
Natural Language Commands
Once configured, you can use natural language to manage your hosting:
File Operations:
"List files in public_html directory"
"Read the contents of wp-config.php"
"Create a new file called test.html with Hello World"
"Delete the old-backup.tar.gz file"Database Operations:
"Show me all databases"
"Create a new database called my_app_db"
"Delete the test_database database"Email Management:
"List all email accounts"
"Create email account support@example.com with password SecurePass123"
"Delete email account old@example.com"Subdomain Management:
"List all subdomains"
"Create subdomain 'blog' under example.com"
"Delete subdomain test.example.com"System Information:
"Check disk usage"
"How much storage am I using?"
"Start a full account backup"Direct Tool Calls
You can also call tools directly:
// List files
mcp__cpanel__list_files({ dir: "/public_html" })
// Read file
mcp__cpanel__read_file({ file: "/public_html/index.php" })
// Create database
mcp__cpanel__create_database({ name: "myapp" })
// Check disk usage
mcp__cpanel__disk_usage()๐ ๏ธ Available Tools
Tool | Description | Parameters |
| List directory contents |
|
| Read file contents |
|
| Write/create file |
|
| Delete file/directory |
|
| Get disk usage stats | None |
| List all databases | None |
| Create database |
|
| Delete database |
|
| List email accounts |
|
| Create email account |
|
| Delete email account |
|
| List subdomains | None |
| Create subdomain |
|
| Delete subdomain |
|
| Full account backup | None |
| Install SSL cert |
|
๐ Security
Generating a cPanel API Token
Log into your cPanel account
Go to Security โ Manage API Tokens
Click Create to generate a new token
Copy the token and save it securely
Add it to your
.envfile
Best Practices
โ Never commit
.envfile - Contains sensitive credentialsโ Use API tokens, not passwords - More secure and can be revoked
โ Rotate tokens regularly - Update every 90 days
โ Use least privilege - Only grant necessary permissions
โ Monitor access logs - Check cPanel logs regularly
Security Features
Environment-based credential storage
HTTPS/SSL encrypted API communication
Basic authentication with API tokens
No credentials in source code or logs
Comprehensive
.gitignorefor sensitive files
๐๏ธ Architecture
cpanel-mcp-server/
โโโ src/
โ โโโ index.ts # MCP server implementation
โโโ build/
โ โโโ index.js # Compiled JavaScript
โ โโโ *.map # Source maps
โโโ .env.example # Credential template
โโโ .gitignore # Security rules
โโโ package.json # Dependencies
โโโ tsconfig.json # TypeScript config
โโโ LICENSE # MIT License
โโโ README.md # This fileTechnology Stack
TypeScript - Type-safe development
@modelcontextprotocol/sdk - MCP protocol implementation
node-fetch - HTTP client for cPanel API
cPanel UAPI - Modern cPanel API interface
๐ cPanel API Reference
Base URL Structure
https://your-domain.com:2083/execute/{Module}/{Function}Authentication
Authorization: Basic base64(username:api_token)API Modules Used
Fileman - File operations
Quota - Disk usage
Mysql - Database management
Email - Email accounts
SubDomain - Subdomain management
Backup - Backup operations
SSL - Certificate management
๐งช Testing
Verify Installation
# Check Node.js version
node --version # Should be 18+
# Build the server
npm run build
# Verify build output
ls build/index.js # Should existTest with AI Assistant
After configuring in your AI assistant:
"Check my disk usage"
"List all subdomains"
"Show me all databases"๐ Troubleshooting
Server Won't Start
Problem: MCP server fails to start
Solutions:
Verify Node.js is installed:
node --versionCheck build output exists:
ls build/index.jsRebuild:
npm run buildCheck logs for error messages
Authentication Errors
Problem: "401 Unauthorized" or "403 Forbidden"
Solutions:
Verify API token is correct in
.envCheck username format:
user@domain.comConfirm cPanel URL includes port
:2083Test credentials directly in cPanel
Generate new API token if expired
File Paths Not Working
Problem: File operations fail
Solutions:
Use absolute paths starting with
/Check file permissions in cPanel
Verify directory exists
Test with cPanel File Manager first
๐ Development
Build Commands
# Install dependencies
npm install
# Build TypeScript
npm run build
# Development mode (rebuild on changes)
npm run dev
# Start server directly
npm startProject Structure
src/index.ts- Main server implementationbuild/- Compiled JavaScript output.env- Your credentials (not committed).env.example- Template for credentials
๐ค Contributing
Contributions are welcome! Here's how you can help:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Development Setup
git clone https://github.com/aandersen2323/cpanel-mcp-server.git
cd cpanel-mcp-server
npm install
npm run build๐ Changelog
Version 1.0.0 (2025-10-09)
Initial Release
โ Complete MCP server implementation
โ 16 cPanel management tools
โ TypeScript with full type safety
โ File operations (list, read, write, delete)
โ Database management (list, create, delete)
โ Email management (list, create, delete)
โ Subdomain management (list, create, delete)
โ System monitoring (disk usage)
โ Backup and SSL support
โ Comprehensive documentation
โ Security best practices
โ Error handling
๐ Support
Resources
cPanel API Documentation: https://api.docs.cpanel.net/
MCP Protocol: https://modelcontextprotocol.io/
Issues: https://github.com/aandersen2323/cpanel-mcp-server/issues
Common Issues
"Module not found" - Run
npm installandnpm run build"Authentication failed" - Verify credentials in
.env"Cannot connect" - Check cPanel URL and port (usually 2083)
"Permission denied" - Verify API token has required permissions
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Built for use with Claude Code
Implements the Model Context Protocol
Uses cPanel UAPI
โญ Star This Repo
If this MCP server helps you manage your cPanel hosting more easily, please give it a star! โญ
Built with โค๏ธ by Claude Code
Status: Production Ready โ Version: 1.0.0 Last Updated: October 9, 2025
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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/aandersen2323/cpanel-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server