MCP server
dns-monitor ships a companion binary, dns-monitor-mcp, that speaks the Model Context Protocol over stdio. It reads the same config.yaml and SQLite database as the main server, so any MCP-capable client (Claude Desktop, custom agents, etc.) can query your DNS history and trigger ad-hoc lookups.
Build it
Section titled “Build it”go build -o dns-monitor-mcp ./cmd/dns-monitor-mcpRegister with Claude Desktop
Section titled “Register with Claude Desktop”Edit ~/Library/Application Support/Claude/claude_desktop_config.json on macOS (or %AppData%\Claude\claude_desktop_config.json on Windows):
{ "mcpServers": { "dns-monitor": { "command": "/absolute/path/to/dns-monitor-mcp", "args": ["--config", "/absolute/path/to/config.yaml"] } }}Restart Claude Desktop. The five tools below will appear in the MCP tool picker.
list_targets
Section titled “list_targets”Lists the targets declared in config.yaml (name, record type, host, expected values).
Input: none.
latest_checks
Section titled “latest_checks”Returns the most recent check for every configured target — the same data that powers the dashboard’s status table.
Input: none.
target_history
Section titled “target_history”Returns recent check rows for a single target, most recent first.
| Field | Type | Default | Notes |
|---|---|---|---|
target | string | — | Target name from config.yaml. Required. |
limit | integer | 20 | Max rows to return. Capped at 500. |
target_stats
Section titled “target_stats”Aggregate stats for one target: total checks, success/failure counts, average/min/max latency, first-seen and last-seen timestamps.
| Field | Type | Notes |
|---|---|---|
target | string | Target name from config.yaml. Required. |
resolve_now
Section titled “resolve_now”On-demand DNS lookup for an arbitrary hostname. Does not persist to the history database — useful for spot-checks without polluting your metrics.
| Field | Type | Default | Notes |
|---|---|---|---|
host | string | — | Hostname to resolve. Required. |
type | string | A | One of A, AAAA, CNAME, MX, TXT, NS. |
Logging and stdio
Section titled “Logging and stdio”The MCP server runs over stdio, so stdout is reserved for JSON-RPC traffic. All logging is routed to stderr via the standard library log package. Avoid adding fmt.Println calls inside the MCP code path — they will corrupt the protocol stream.