mbarki-abd/namecheap-mcp-server
If you are the rightful owner of namecheap-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Namecheap MCP Server is a comprehensive Model Context Protocol server designed to interact with the Namecheap API, offering extensive domain, DNS, and SSL management capabilities.
Namecheap MCP Server
A comprehensive Model Context Protocol (MCP) server for the Namecheap API, providing full access to domain management, DNS configuration, SSL certificates, and more. Designed for deployment on Google Cloud Run with SSE (Server-Sent Events) protocol support.
Features
Domain Management
- Check domain availability
- Register new domains
- Renew domains
- Get domain information
- List all domains
- Reactivate expired domains
- Manage domain contacts
- Transfer domains to Namecheap
DNS Management
- Get/Set DNS host records
- Configure custom nameservers
- Set default Namecheap DNS
- Manage email forwarding
- Create/delete/update nameservers
SSL Certificates
- List SSL certificates
- Get certificate information
- Activate SSL certificates
- Reissue certificates
- Renew certificates
WhoisGuard
- Enable/disable WhoisGuard
- List WhoisGuard subscriptions
Account Management
- Get pricing information
- Check account balances
- Manage address information
Requirements
- Node.js 18 or higher
- Namecheap API credentials
- Google Cloud Platform account (for deployment)
Getting Namecheap API Credentials
- Log in to your Namecheap account
- Go to Profile → Tools → Business & Dev Tools → API Access
- Enable API access
- Whitelist your server's IP address
- Copy your API credentials:
- API User
- API Key
- Username
- Whitelisted IP
Local Development
Installation
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm start
Environment Variables
Create a .env file (not included in the repository):
NAMECHEAP_API_USER=your_api_user
NAMECHEAP_API_KEY=your_api_key
NAMECHEAP_USERNAME=your_username
NAMECHEAP_CLIENT_IP=your_whitelisted_ip
NAMECHEAP_SANDBOX=true # Set to false for production
PORT=8080
Testing Locally
# Health check
curl http://localhost:8080/health
# Test SSE connection
curl http://localhost:8080/sse
Google Cloud Run Deployment
Prerequisites
- Install Google Cloud SDK
- Authenticate with Google Cloud:
gcloud auth login gcloud config set project YOUR_PROJECT_ID
Deployment Steps
-
Set environment variables:
export NAMECHEAP_API_USER="your_api_user" export NAMECHEAP_USERNAME="your_username" export NAMECHEAP_CLIENT_IP="your_whitelisted_ip" export NAMECHEAP_API_KEY="your_api_key" export NAMECHEAP_SANDBOX="false" # or "true" for sandbox export GCP_PROJECT_ID="your-gcp-project" export GCP_REGION="us-central1" -
Run deployment script:
chmod +x deploy.sh ./deploy.sh
Manual Deployment
# Build and push Docker image
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/namecheap-mcp-server
# Create secret for API key
echo -n "your_api_key" | gcloud secrets create namecheap-api-key --data-file=-
# Deploy to Cloud Run
gcloud run deploy namecheap-mcp-server \
--image gcr.io/YOUR_PROJECT_ID/namecheap-mcp-server \
--region us-central1 \
--platform managed \
--allow-unauthenticated \
--set-env-vars NAMECHEAP_API_USER=your_api_user,NAMECHEAP_USERNAME=your_username,NAMECHEAP_CLIENT_IP=your_ip,NAMECHEAP_SANDBOX=false \
--set-secrets NAMECHEAP_API_KEY=namecheap-api-key:latest
Using the MCP Server
Available Tools
Domain Operations
namecheap_check_domain- Check if domains are availablenamecheap_get_domain_info- Get detailed domain informationnamecheap_list_domains- List all domains in accountnamecheap_register_domain- Register a new domainnamecheap_renew_domain- Renew an existing domainnamecheap_reactivate_domain- Reactivate an expired domainnamecheap_get_contacts- Get domain contact informationnamecheap_set_contacts- Update domain contacts
DNS Operations
namecheap_get_dns_hosts- Get DNS host recordsnamecheap_set_dns_hosts- Set DNS host recordsnamecheap_get_email_forwarding- Get email forwarding confignamecheap_set_email_forwarding- Configure email forwardingnamecheap_set_custom_dns- Set custom nameserversnamecheap_set_default_dns- Use Namecheap default DNSnamecheap_get_dns_list- List DNS servers
SSL Operations
namecheap_list_ssl_certificates- List SSL certificatesnamecheap_get_ssl_info- Get SSL certificate detailsnamecheap_activate_ssl- Activate an SSL certificatenamecheap_reissue_ssl- Reissue a certificatenamecheap_renew_ssl- Renew a certificate
WhoisGuard Operations
namecheap_enable_whoisguard- Enable WhoisGuard protectionnamecheap_disable_whoisguard- Disable WhoisGuardnamecheap_list_whoisguard- List WhoisGuard subscriptions
Nameserver Operations
namecheap_create_nameserver- Create a nameservernamecheap_delete_nameserver- Delete a nameservernamecheap_get_nameserver_info- Get nameserver infonamecheap_update_nameserver- Update nameserver IP
Transfer Operations
namecheap_transfer_domain- Transfer domain to Namecheapnamecheap_get_transfer_status- Check transfer statusnamecheap_list_transfers- List all transfers
Account Operations
namecheap_get_pricing- Get product pricingnamecheap_get_balances- Get account balancesnamecheap_get_address_info- Get address information
Example Usage
// Check domain availability
{
"tool": "namecheap_check_domain",
"arguments": {
"domains": ["example.com", "mysite.net"]
}
}
// Register a domain
{
"tool": "namecheap_register_domain",
"arguments": {
"domainName": "example.com",
"years": 1,
"registrantFirstName": "John",
"registrantLastName": "Doe",
"registrantAddress1": "123 Main St",
"registrantCity": "New York",
"registrantStateProvince": "NY",
"registrantPostalCode": "10001",
"registrantCountry": "US",
"registrantPhone": "+1.2125551234",
"registrantEmailAddress": "john@example.com"
}
}
// Set DNS records
{
"tool": "namecheap_set_dns_hosts",
"arguments": {
"sld": "example",
"tld": "com",
"hosts": [
{
"hostName": "@",
"recordType": "A",
"address": "192.0.2.1",
"ttl": 1800
},
{
"hostName": "www",
"recordType": "CNAME",
"address": "example.com.",
"ttl": 1800
}
]
}
}
Architecture
- Express Server: HTTP server for SSE connections
- MCP SDK: Model Context Protocol implementation
- SSE Transport: Server-Sent Events for real-time communication
- Namecheap Client: Comprehensive API wrapper
- XML Parser: Handles Namecheap's XML responses
Security Notes
- API keys are stored as Google Cloud Secrets
- Environment variables for non-sensitive configuration
- IP whitelisting required by Namecheap
- Use sandbox mode for testing
Troubleshooting
Common Issues
-
API Authentication Errors
- Verify API credentials are correct
- Ensure your IP is whitelisted in Namecheap
- Check if API access is enabled in your account
-
Connection Errors
- Verify network connectivity
- Check if using correct endpoint (sandbox vs production)
- Ensure firewall allows outbound connections
-
Domain Operation Failures
- Verify domain format is correct
- Check account balance for purchases
- Ensure domain is eligible for the operation
Development
Project Structure
namecheap-mcp-server/
├── src/
│ ├── index.ts # Main server and MCP setup
│ └── namecheap-client.ts # Namecheap API client
├── Dockerfile # Container configuration
├── cloudbuild.yaml # Google Cloud Build config
├── deploy.sh # Deployment script
├── package.json # Dependencies
└── tsconfig.json # TypeScript configuration
Building
npm run build # Build TypeScript
npm run dev # Watch mode
npm run clean # Clean build artifacts
License
MIT
Support
For issues related to:
- This MCP server: Open an issue on GitHub
- Namecheap API: Contact Namecheap support
- MCP Protocol: Visit Model Context Protocol docs
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.