Skip to content

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.

Terminal window
go build -o dns-monitor-mcp ./cmd/dns-monitor-mcp

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.

Lists the targets declared in config.yaml (name, record type, host, expected values).

Input: none.

Returns the most recent check for every configured target — the same data that powers the dashboard’s status table.

Input: none.

Returns recent check rows for a single target, most recent first.

FieldTypeDefaultNotes
targetstringTarget name from config.yaml. Required.
limitinteger20Max rows to return. Capped at 500.

Aggregate stats for one target: total checks, success/failure counts, average/min/max latency, first-seen and last-seen timestamps.

FieldTypeNotes
targetstringTarget name from config.yaml. Required.

On-demand DNS lookup for an arbitrary hostname. Does not persist to the history database — useful for spot-checks without polluting your metrics.

FieldTypeDefaultNotes
hoststringHostname to resolve. Required.
typestringAOne of A, AAAA, CNAME, MX, TXT, NS.

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.