cPanel MCP Server

cPanel MCP Server

A complete MCP server enabling AI assistants to manage cPanel hosting through natural language, including file, database, email, subdomain, and system operations.

Category
Visit Server

README

cPanel MCP Server

A complete Model Context Protocol (MCP) server for managing cPanel hosting through AI assistants like Claude Code

License: MIT TypeScript Node.js


๐ŸŽฏ 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

  1. Clone the Repository

    git clone https://github.com/aandersen2323/cpanel-mcp-server.git
    cd cpanel-mcp-server
    
  2. Install Dependencies

    npm install
    
  3. Build the Server

    npm run build
    
  4. Configure Credentials

    cp .env.example .env
    # Edit .env with your cPanel credentials
    
  5. Add 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"
          }
        }
      }
    }
    
  6. 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
cpanel_list_files List directory contents dir: path (optional)
cpanel_read_file Read file contents file: full path
cpanel_write_file Write/create file file: path, content: text
cpanel_delete_file Delete file/directory file: path
cpanel_disk_usage Get disk usage stats None
cpanel_list_databases List all databases None
cpanel_create_database Create database name: database name
cpanel_delete_database Delete database name: database name
cpanel_list_email_accounts List email accounts domain: optional
cpanel_create_email Create email account email, password, quota
cpanel_delete_email Delete email account email: address
cpanel_list_subdomains List subdomains None
cpanel_create_subdomain Create subdomain subdomain, domain
cpanel_delete_subdomain Delete subdomain subdomain: full name
cpanel_backup Full account backup None
cpanel_install_ssl Install SSL cert domain: domain name

๐Ÿ” Security

Generating a cPanel API Token

  1. Log into your cPanel account
  2. Go to Security โ†’ Manage API Tokens
  3. Click Create to generate a new token
  4. Copy the token and save it securely
  5. Add it to your .env file

Best Practices

  • โœ… Never commit .env file - 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 .gitignore for 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 file

Technology 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 exist

Test 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 --version
  • Check build output exists: ls build/index.js
  • Rebuild: npm run build
  • Check logs for error messages

Authentication Errors

Problem: "401 Unauthorized" or "403 Forbidden"

Solutions:

  • Verify API token is correct in .env
  • Check username format: user@domain.com
  • Confirm cPanel URL includes port :2083
  • Test 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 start

Project Structure

  • src/index.ts - Main server implementation
  • build/ - Compiled JavaScript output
  • .env - Your credentials (not committed)
  • .env.example - Template for credentials

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

  1. "Module not found" - Run npm install and npm run build
  2. "Authentication failed" - Verify credentials in .env
  3. "Cannot connect" - Check cPanel URL and port (usually 2083)
  4. "Permission denied" - Verify API token has required permissions

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments


โญ 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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured