← Back to project

Namecheap DNS API Landscape & Requirements



This report examines Namecheap's DNS management API and outlines requirements for building an MCP (Model Context Protocol) server that enables AI agents to automate DNS record changes.

---

Why Namecheap?



---


Overview of Namecheap DNS API



Base endpoint: `https://api.namecheap.com/xml.response`

Authentication parameters (POST body, `application/x-www-form-urlencoded`):


All responses are XML with a top-level `<ApiResponse>` containing `Status` (`Success`/`Error`) and `IsSuccess` boolean. Errors are listed under `<Errors><Error><Number>` and `<Text>`.


Key Endpoints



| Command | Purpose | Important Parameters | Returns |
|---------|---------|----------------------|---------|
| `dnsns.getList` | List all DNS records for a domain | `SLD` (second-level domain, e.g., `example`), `TLD` (e.g., `com`) | `<DNSHostRecord>` elements with `ID`, `Type`, `Name`, `Value`, `TTL`, `MXPref` (for MX) |
| `dnsns.setHostRecords` | Replace all records for a domain (overwrite) | `SLD`, `TLD`, plus multiple `DNSHostRecord` groups (Type, Name, Value, TTL) | Updated record set |
| `dnsns.addHost` | Add a single record | `SLD`, `TLD`, `RecordType`, `HostName`, `Value`, `TTL`; for MX also `MXPref` | New record ID |
| `dnsns.delHost` | Delete a record | `SLD`, `TLD`, `RecordType`, `HostName`, `Value` (optional?) - usually you need `RecordID`? Actually `delHost` can accept `RecordID` or `HostName`+`Type`+`Value`. Best by `RecordID`. | Success/failure |
| `dnsns.setNameservers` | Change domain nameservers | `SLD`, `TLD`, `Nameserver` (multiple) | Updated nameservers |
| `dnsns.getNameservers` | Get current nameservers | `SLD`, `TLD` | `<Nameserver>` list |


Notes:


Obtaining API Credentials



1. Log into your Namecheap account.
2. Go to SecurityAPI Access (or directly: https://ap.www.namecheap.com/settings/token/)
3. Generate a new API key:

4. Note down:
5. Keep these credentials secure. They provide full control over your DNS zones.
6. For development, use the Sandbox environment:

---


Requirements for MCP Server



Functional



Non-Functional



---


Data Model Mapping



Namecheap's `DNSHostRecord`:

xml
<DNSHostRecord>
<ID>12345</ID>
<Type>A</Type>
<Name>www</Name>
<Value>1.2.3.4</Value>
<TTL>1800</TTL>
<MXPref>10</MXPref> <!-- only for MX -->
</DNSHostRecord>


Our MCP `list_records` will return array:

json
[
{ "id": 12345, "name": "www", "type": "A", "value": "1.2.3.4", "ttl": 1800 }
]


For MX: include `"mxpref": 10` maybe as optional field.

---

Open Questions



---


Next Steps



1. Confirm exact request/response parameters via Namecheap's official docs or quick manual test (sandbox account? They have a sandbox environment: `https://api.sandbox.namecheap.com/xml.response`). We should use sandbox for development.
2. Draft MCP tool JSON-RPC method definitions.
3. Implement Go HTTP client and XML structs.
4. Write MCP server skeleton.


---

Word count: ~950