Scrapbook: Namecheap DNS MCP
Date: 2026-02-16T18:10:00Z
Initial Thoughts
- Namecheap’s API is well‑documented but uses XML over HTTPS POST. Parameters are form‑encoded. Responses are XML.
- We’ll need to build a small client library in Go to handle:
- Building the request (ApiUser, ApiKey, UserName, Command, and command‑specific params)
- Parsing XML response into Go structs (use `encoding/xml`).
- Error handling: API returns XML with `<Errors><Error>` elements; also `IsSuccess` attribute.
- The API requires the client IP to be whitelisted in the Namecheap account. For an MCP server running on the VPS, we can whitelist the VPS IP. That’s straightforward.
- Tools should be idempotent where possible. For `add_record`, we can first check existing records to avoid duplicates, or rely on Namecheap error (which may return `duplicate`). Simpler: just call `dnsns.addHost` and ignore “already exists” errors.
- TTL: Namecheap defaults to 1800; we should pass explicit TTL (default 3600 maybe).
- Record types supported: A, AAAA, CNAME, MX, TXT, SRV, etc. We can start with A, AAAA, CNAME, MX, TXT, NS.
- Potential gotcha: MX records require a priority (e.g., “10 mail.example.com.”). Namecheap’s `dnsns.addHost` expects `RecordType`, `HostName`, `Value`, and for MX also `MXPref`. We’ll handle that in the MCP tool by expecting a combined value (like “10 mail.example.com.”) or separate params. Better to have separate fields? Keep tool simple: `value` for A/AAAA/TXT/CNAME; for MX, pass `value` as “10 mail.example.com.” and parse; for SRV, more complex. For MVP, support common types.
- Rate limits: Namecheap doesn’t publish strict limits but is generally generous for low volume. We can add a simple rate limiter (1‑2 req/s) if needed.
- MCP server: stdio JSON-RPC. No need for network exposure. We can embed MCP server into a single binary that runs in the foreground, reading env vars for credentials.
- Deployment: systemd unit under `dnsmgr` or `namecheap` user; environment file `/etc/default/namecheap-mcp` or `/etc/namecheap-mcp.env`.
Questions
- Should we support batch operations? Probably not needed initially.
- Should we support filtering records by name/type? `list_records` can return all; client can filter.
- Should we support pagination? Unlikely needed; typical zone has <1000 records.
- Should we cache domain list? Could, but not necessary.
---
Ready to write Report 1.