@paulgit/mcp-dns-tools 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ofer Shapira
4
+ Copyright (c) 2026 Paul Git
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,205 @@
1
+ # mcp-dns-tools
2
+
3
+ [![CI](https://code.paulg.it/paulgit/mcp-dns-tools/actions/workflows/ci.yml/badge.svg)](https://code.paulg.it/paulgit/mcp-dns-tools/actions/workflows/ci.yml)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-strict-blue.svg)](https://www.typescriptlang.org/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ DNS lookups, reverse DNS, and domain or IP registration checks from your AI assistant. No API keys, no config. Powered by Node.js built-in DNS, HTTPS RDAP, and public WHOIS fallback services.
8
+
9
+ > Works with Claude Desktop, Cursor, VS Code Copilot, and any MCP client. Uses Node.js native `dns` module, so there's nothing to sign up for.
10
+
11
+ Forked from [`ofershap/mcp-server-dns`](https://github.com/ofershap/mcp-server-dns) and renamed to `mcp-dns-tools` from v2.0.0 onwards.
12
+
13
+ ## Why
14
+
15
+ DNS and registration lookups come up more often than you'd think during development. Debugging email delivery? You need MX records. Auditing certificate issuance? CAA records identify the certificate authorities permitted to issue for a domain. Setting up a new domain? Check the nameservers. Investigating a suspicious URL? Registration data identifies the registrar and public ownership details. The existing MCP options for this often require paid API keys. This server uses Node.js built-in DNS resolution, IANA-discovered RDAP services, and public WHOIS fallback services, so it works without accounts or credentials.
16
+
17
+ ## Tools
18
+
19
+ | Tool | What it does |
20
+ | ------------------- | ------------------------------------------------------------------------- |
21
+ | `dns_lookup` | Resolve one requested non-NS record type, including A, MX, TXT, and CAA |
22
+ | `reverse_dns` | Perform reverse DNS (PTR) lookup on an IP address |
23
+ | `resolve_all` | Resolve common record types for a DNS overview; not for one named type |
24
+ | `check_nameservers` | Resolve NS, nameserver, authoritative nameserver, and delegation requests |
25
+ | `whois` | Query domain registration data using RDAP, with WHOIS fallback |
26
+ | `ip_whois` | Query IP allocation data using RDAP, with RIR WHOIS fallback |
27
+
28
+ ### Registration lookup behaviour
29
+
30
+ The existing `whois` and `ip_whois` tool names are retained for client compatibility, but both tools prefer Registration Data Access Protocol (RDAP):
31
+
32
+ - Domain services are discovered from IANA's RDAP DNS bootstrap registry.
33
+ - IP services use the longest matching prefix in IANA's IPv4 or IPv6 RDAP bootstrap registry.
34
+ - Bootstrap data is cached in memory for 24 hours.
35
+ - Domain lookups follow one advertised registrar RDAP link when available.
36
+ - TLDs without working RDAP fall back to public port 43 WHOIS, with at most three queries so registry-to-registrar referrals are supported.
37
+ - Unicode domains are converted to IDNA A-labels before lookup.
38
+ - HTTPS redirects, response sizes, timeouts, referral destinations, and private or loopback addresses are bounded or rejected.
39
+
40
+ RDAP is authoritative when it returns `404 Not Found`; the tools do not then fall back to potentially stale WHOIS data. On a transport failure, rate limit, or unusable RDAP response, WHOIS is attempted and the result includes a warning explaining the fallback.
41
+
42
+ #### Failure reporting
43
+
44
+ A valid lookup that cannot be completed is returned as MCP error content with separate details for each attempted protocol:
45
+
46
+ ```text
47
+ Status: failed
48
+ Domain: example.tld
49
+ RDAP status: failed
50
+ RDAP reason: RDAP_NOT_AVAILABLE
51
+ RDAP detail: IANA has no RDAP bootstrap service for this TLD
52
+ WHOIS status: failed
53
+ WHOIS reason: WHOIS_CONNECTION_REFUSED
54
+ WHOIS source: whois://whois.registry.example:43
55
+ WHOIS detail: connect ECONNREFUSED
56
+ Suggestion: Check outbound HTTPS and TCP port 43 access, then retry.
57
+ ```
58
+
59
+ Stable reasons cover unavailable or missing RDAP, authoritative not-found responses, HTTP errors, rate limits, timeouts, DNS and connection failures, empty or invalid responses, retired or web-only WHOIS services, unsupported query formats, invalid encoding, response-size limits, and rejected, looping, or excessive referrals. Successful WHOIS fallback results retain the registration data and include the RDAP reason as a warning.
60
+
61
+ ## Install
62
+
63
+ ```bash
64
+ npx -y @paulgit/mcp-dns-tools --transport stdio
65
+ ```
66
+
67
+ Node.js 24 or later is required. The server uses stdio by default; `--transport stdio` makes the transport explicit in MCP client configuration.
68
+
69
+ To build from source instead:
70
+
71
+ ```bash
72
+ git clone https://code.paulg.it/paulgit/mcp-dns-tools.git
73
+ cd mcp-dns-tools
74
+ npm ci
75
+ npm run build
76
+ ```
77
+
78
+ ## Optional Agent Skill
79
+
80
+ The MCP server works without the bundled skill. If your client supports Agent Skills or an equivalent skill format, install the entire `skills/dns-lookup` directory using that client's skill installation mechanism.
81
+
82
+ Generic copy:
83
+
84
+ ```bash
85
+ cp -R skills/dns-lookup /path/to/client/skills/
86
+ ```
87
+
88
+ Generic symlink for repository-based installations:
89
+
90
+ ```bash
91
+ ln -s /absolute/path/to/mcp-dns-tools/skills/dns-lookup \
92
+ /path/to/client/skills/dns-lookup
93
+ ```
94
+
95
+ Consult your client's documentation for its skills directory, then reload or restart the client. Clients without Agent Skills can skip this step; MCP tool descriptions and server instructions provide the essential routing guidance.
96
+
97
+ ## Quick Start
98
+
99
+ ### Cursor
100
+
101
+ Add to `.cursor/mcp.json`:
102
+
103
+ ```json
104
+ {
105
+ "mcpServers": {
106
+ "dns": {
107
+ "command": "npx",
108
+ "args": ["-y", "@paulgit/mcp-dns-tools", "--transport", "stdio"]
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Claude Desktop
115
+
116
+ Add to `claude_desktop_config.json`:
117
+
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "dns": {
122
+ "command": "npx",
123
+ "args": ["-y", "@paulgit/mcp-dns-tools", "--transport", "stdio"]
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### VS Code
130
+
131
+ Add to user settings or `.vscode/mcp.json`:
132
+
133
+ ```json
134
+ {
135
+ "mcp": {
136
+ "servers": {
137
+ "dns": {
138
+ "command": "npx",
139
+ "args": ["-y", "@paulgit/mcp-dns-tools", "--transport", "stdio"]
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ ## Examples
147
+
148
+ - "What are the DNS records for example.com?"
149
+ - "Do a reverse DNS lookup on 8.8.8.8"
150
+ - "Show me the WHOIS info for github.com"
151
+ - "Show me the registration data for nominet.uk"
152
+ - "What nameservers does cloudflare.com use?"
153
+ - "Resolve all record types for google.com"
154
+ - "Check the MX records for my-company.com"
155
+ - "Which certificate authorities can issue certificates for example.com?"
156
+ - "Check the CAA records for example.com"
157
+ - "Who owns the netblock for 8.8.8.8?"
158
+ - "Show me the IP WHOIS for 2001:4860:4860::8888"
159
+
160
+ ## Troubleshooting
161
+
162
+ ### DNS lookups fail with "DNS server refused the query"
163
+
164
+ Some local resolvers (e.g. Tailscale MagicDNS, some VPNs and corporate DNS) only answer A/AAAA queries and refuse other record types like MX, TXT, CAA, NS, SOA, or CNAME. The server uses Node's built-in resolver, which reads the system DNS configuration.
165
+
166
+ To use a different resolver, set the `DNS_SERVERS` environment variable to a comma-separated list of IP addresses:
167
+
168
+ ```bash
169
+ DNS_SERVERS=8.8.8.8,1.1.1.1 npx -y @paulgit/mcp-dns-tools --transport stdio
170
+ ```
171
+
172
+ ### Registration lookups fail on a restricted network
173
+
174
+ RDAP requires outbound HTTPS. Legacy fallback also requires outbound TCP port 43, which many corporate firewalls block. The returned error reports both failures when neither protocol is reachable.
175
+
176
+ ## Development
177
+
178
+ ```bash
179
+ npm test
180
+ npm run build
181
+ ```
182
+
183
+ ### Tool routing smoke test
184
+
185
+ After changing tool metadata, run these prompts in each supported MCP client with and without the optional skill installed:
186
+
187
+ | Prompt | Expected call |
188
+ | ------------------------------------------------- | --------------------------------------- |
189
+ | Check the CAA records for fastmail.com | `dns_lookup`, `type: "CAA"` |
190
+ | Which CAs may issue certificates for example.com? | `dns_lookup`, `type: "CAA"` |
191
+ | Check the MX records for example.com | `dns_lookup`, `type: "MX"` |
192
+ | Check the NS records for example.com | `check_nameservers` |
193
+ | What nameservers does example.com use? | `check_nameservers` |
194
+ | Show all DNS records for example.com | `resolve_all` |
195
+ | Give me a DNS overview for example.com | `resolve_all` |
196
+ | Check the CAA and MX records for example.com | `resolve_all` or two `dns_lookup` calls |
197
+ | Check the NS and MX records for example.com | `resolve_all` or two specific calls |
198
+ | Who is the registrar for example.com? | `whois` |
199
+ | Who owns the netblock for 8.8.8.8? | `ip_whois` |
200
+
201
+ Record the selected tool and arguments. Rebuild the server and reconnect the client before each test run so it refreshes MCP instructions and `tools/list` metadata.
202
+
203
+ ## License
204
+
205
+ MIT © 2026 Ofer Shapira, 2026 Paul Git