mcp-porkbun
by keyserfaty
README.md
<div align="center">
# ๐ mcp-porkbun
**A [Model Context Protocol](https://modelcontextprotocol.io) server for Porkbun domain registration and DNS management.**
Let AI agents buy domains and configure DNS โ no browser required.
<br/>
[](https://python.org)
[](LICENSE)
[](https://modelcontextprotocol.io)
[](https://porkbun.com/api/json/v3/documentation)
</div>
---
## โจ Overview
`mcp-porkbun` exposes Porkbun's domain registration and DNS API as MCP tools, enabling AI agents to:
- ๐ **Check availability** โ look up domains and get first-year + renewal pricing
- ๐ **Register domains** โ purchase domains programmatically
- ๐ **List domains** โ inventory all domains in the account
- ๐ง **Manage DNS** โ create, list, and delete any DNS record type
Originally built to power **cold email infrastructure automation**: an AI agent checks availability, purchases domains, and configures MX + SPF + DMARC records โ all in a single workflow.
---
## ๐ Prerequisites
1. A [Porkbun](https://porkbun.com) account
2. A Porkbun **API key** and **secret key** โ generate them at [porkbun.com/account/api](https://porkbun.com/account/api)
3. API access **enabled per domain** in the Porkbun dashboard (Domain Settings โ API)
4. Python 3.11+
---
## ๐ Setup
### 1. Install
```bash
git clone https://github.com/keyserfaty/mcp-porkbun
cd mcp-porkbun
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e .
```
### 2. Configure Environment
```bash
export PORKBUN_API_KEY="pk1_..."
export PORKBUN_SECRET_KEY="sk1_..."
```
---
## โ๏ธ MCP Configuration
Add to your `~/.claude.json` (or project `.mcp.json`):
```json
{
"mcpServers": {
"porkbun": {
"type": "stdio",
"command": "/path/to/.venv/bin/python",
"args": ["/path/to/mcp-porkbun/server.py"],
"env": {
"PORKBUN_API_KEY": "pk1_...",
"PORKBUN_SECRET_KEY": "sk1_..."
}
}
}
}
```
---
## ๐ ๏ธ Tools Reference
### Auth
| Tool | Description |
|------|-------------|
| `ping` | Test credentials โ returns your public IP if successful |
### Domain Management
| Tool | Description | Key Parameters |
|------|-------------|----------------|
| `check_domain` | Check availability and pricing | `domain: str` |
| `register_domain` | Purchase a domain | `domain`, `price_dollars`, `years?`, `autorenew?` |
| `list_domains` | List all domains in the account | `start?: int` |
| `get_domain_info` | Get nameservers and status for a domain | `domain: str` |
**Typical purchase flow:**
```python
# 1. Check availability + price
result = check_domain("example.com")
# โ result["available"] == True, result["price_first_year"] == "9.73"
# 2. Register using the exact price returned
register_domain("example.com", price_dollars=9.73)
```
> โ ๏ธ After registering, **enable API access** for the domain in the Porkbun dashboard (Domain โ Settings โ API) before making DNS calls.
### DNS Management
| Tool | Description | Key Parameters |
|------|-------------|----------------|
| `get_dns_records` | List records, optionally filtered | `domain`, `record_type?`, `subdomain?` |
| `create_dns_record` | Add a DNS record | `domain`, `record_type`, `content`, `name?`, `ttl?`, `priority?` |
| `delete_dns_record` | Delete a record by ID | `domain`, `record_id` |
| `delete_dns_records_by_type` | Bulk delete all records of a type | `domain`, `record_type`, `subdomain?` |
**Google Workspace DNS setup example:**
```python
# SPF
create_dns_record("example.com", "TXT", "v=spf1 include:_spf.google.com ~all", name="@")
# DMARC
create_dns_record("example.com", "TXT", "v=DMARC1; p=none; rua=mailto:dmarc@example.com", name="_dmarc")
# MX records
create_dns_record("example.com", "MX", "ASPMX.L.GOOGLE.COM", name="@", priority=1)
create_dns_record("example.com", "MX", "ALT1.ASPMX.L.GOOGLE.COM", name="@", priority=5)
# DKIM (after generating key in Google Workspace)
create_dns_record("example.com", "TXT", "v=DKIM1; k=rsa; p=...", name="google._domainkey")
```
---
## ๐ค Example Agent Workflow
```
1. check_domain("newdomain.com") โ confirm available + get price
2. register_domain("newdomain.com", 9.73) โ purchase
3. create_dns_record(...) โ SPF, DMARC, MX (ร5), DKIM
4. get_dns_records("newdomain.com") โ verify all records are live
```
---
## ๐ Project Structure
```
mcp-porkbun/
โโโ server.py # MCP server & tool definitions
โโโ api.py # Porkbun API helper (auth + requests)
โโโ pyproject.toml # Package metadata & dependencies
โโโ README.md
```
---
## ๐ค Contributing
Contributions welcome โ especially:
- **Domain transfer** tools
- **URL forwarding** management
- **SSL certificate** retrieval
- **Bulk operations** with built-in rate limiting
---
## ๐ License
MIT ยฉ [Karen Serfaty](https://github.com/keyserfaty)
---
<div align="center">
<sub>Built for use with <a href="https://claude.ai/claude-code">Claude Code</a> ยท Powered by <a href="https://modelcontextprotocol.io">Model Context Protocol</a></sub>
</div>
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues