mcp-dns-insights
Captures DNS queries leaving your Mac and serves them to Claude via MCP for traffic pattern analysis, answering questions about top domains, categories, and temporal patterns.
README
mcp-dns-insights
Capture the DNS queries leaving your Mac and serve them to Claude over the Model Context Protocol so Claude can analyse your traffic patterns and hand back a structured JSON overview.
It answers questions like:
- Which domains does my machine talk to the most?
- How much of my traffic is advertising, analytics, or telemetry?
- When am I busiest, and were there any unusual bursts of activity?
How it works
┌────────────┐ ┌──────────────┐ ┌───────────────┐ ┌────────┐
│ tcpdump │ --> │ capture │ --> │ SQLite db │ <-- │ MCP │ <── Claude
│ (port 53) │ │ daemon │ │ (dns.db) │ │ server │
└────────────┘ └──────────────┘ └───────────────┘ └────────┘
- A capture daemon runs
tcpdump, parses each DNS question off the wire, and appends it to a local SQLite database. - An MCP server exposes read-only tools over stdio. Claude calls
analyze_patterns(and friends) and receives JSON it can summarise.
The two halves are decoupled through the database: capture is a single writer, the server is a read-only consumer.
Install
Requires Python 3.10+ and the tcpdump that ships with macOS.
git clone https://github.com/luke-nielsen/mcp-dns-insights.git
cd mcp-dns-insights
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
Usage
1. Capture DNS traffic
Packet capture needs root, so run the daemon under sudo:
sudo -E mcp-dns-insights capture
Leave it running in the background (or install it as a launchd job — see below).
Use -i en0 to pin a specific interface; the default any captures all of them.
2. Inspect from the terminal
mcp-dns-insights stats --hours 24 # human-readable summary
mcp-dns-insights stats --hours 24 --json
mcp-dns-insights info # database location & span
3. Connect it to Claude
The server speaks MCP over stdio. Register it with Claude Code:
claude mcp add dns-insights -- mcp-dns-insights serve
or add it to your MCP host config manually:
{
"mcpServers": {
"dns-insights": {
"command": "mcp-dns-insights",
"args": ["serve"]
}
}
}
Then ask Claude: "Analyse my DNS traffic from the last 24 hours and tell me what's noteworthy."
MCP tools
| Tool | Purpose |
|---|---|
analyze_patterns |
Full JSON overview: top domains, categories, temporal, notes. |
recent_queries |
The most recent queries as a JSON list. |
search_domain |
Find queries whose hostname matches a substring. |
database_info |
Database path, size, and time span. |
Shape of analyze_patterns
{
"summary": { "total_queries": 4213, "unique_hostnames": 612, "unique_domains": 241, "window": { ... } },
"top_hostnames": [ { "name": "api.github.com", "count": 88 }, ... ],
"top_domains": [ { "name": "github.com", "count": 140 }, ... ],
"query_types": { "A": 3100, "AAAA": 980, "HTTPS": 133 },
"clients": [ { "name": "192.168.1.10", "count": 4100 } ],
"resolvers": [ { "name": "1.1.1.1", "count": 4213 } ],
"categories": { "analytics": 210, "advertising": 95, "cdn": 540 },
"flagged_domains": [ { "domain": "doubleclick.net", "category": "advertising", "count": 60 } ],
"temporal": { "by_hour": { ... }, "busiest_hour": { ... }, "peak_queries_per_minute": 47 },
"observations": [ "github.com accounts for 140 queries (3% of the total).", ... ]
}
Run as a launchd job (optional)
Create ~/Library/LaunchAgents/us.radiusgroup.mcp-dns-insights.plist (capture
needs root, so a LaunchDaemon in /Library/LaunchDaemons is the better fit):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>us.radiusgroup.mcp-dns-insights</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/.venv/bin/mcp-dns-insights</string>
<string>capture</string>
</array>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>
sudo cp us.radiusgroup.mcp-dns-insights.plist /Library/LaunchDaemons/
sudo launchctl load /Library/LaunchDaemons/us.radiusgroup.mcp-dns-insights.plist
Configuration
All settings have sensible defaults and can be overridden via the environment:
| Variable | Default |
|---|---|
MCP_DNS_INSIGHTS_DB |
~/Library/Application Support/mcp-dns-insights/dns.db |
MCP_DNS_INSIGHTS_HOME |
data directory (overrides the default location) |
MCP_DNS_INSIGHTS_IFACE |
any |
MCP_DNS_INSIGHTS_FILTER |
udp port 53 or tcp port 53 |
MCP_DNS_INSIGHTS_TCPDUMP |
tcpdump |
MCP_DNS_INSIGHTS_FLUSH_INTERVAL |
2.0 (seconds) |
MCP_DNS_INSIGHTS_FLUSH_BATCH |
100 (queries) |
Privacy
The database contains a record of every hostname your Mac looked up — that is
sensitive. It is stored only on your machine and is never transmitted
anywhere except to the local MCP server you explicitly connect to Claude. The
.gitignore excludes *.db so capture data is never committed.
Note: queries answered by DNS-over-HTTPS/TLS (e.g. some browsers' built-in secure DNS) are encrypted and will not be visible to a port-53 capture.
Development
pip install -e ".[dev]"
pytest # run the test suite
ruff check . # lint
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。