
Mcp Pihole
io.github.aplaceforallmystuff由 GitHub 帳號 aplaceforallmystuff 發布v1.0.1更新於 Oct 24, 2026
Pi-hole v6 MCP server - manage DNS blocking, stats, whitelists/blacklists
概覽
把助理連接到自架的 Pi-hole v6 廣告封鎖器,用來查看 DNS 統計、開關封鎖,並管理白名單與黑名單網域。
- 可以做什麼
- 讀取 DNS 統計:查詢總量、封鎖比例、封鎖與放行最多的網域、查詢最多的用戶端,以及最近的查詢紀錄。
- 開啟或關閉 DNS 封鎖,可設定計時,並查看目前的封鎖狀態。
- 列出、新增與移除白名單及黑名單中的網域。
- 執行維護作業:更新 gravity 封鎖清單並清除 DNS 快取。
- 可選擇在終端機以 ASCII 儀表板與長條圖呈現統計資料。
- 適用情境
- 適合在網路上執行 Pi-hole v6、想用自然語言查詢 DNS 流量、暫時解除封鎖或調整允許與封鎖清單,而不想開啟網頁管理介面的情況。
- 執行需求
- 透過 npx 或全域 npm 安裝在本機執行,需要 Node.js 18 以上版本。需要可連線且已啟用 API 的 Pi-hole v6 執行個體,設定 PIHOLE_URL 環境變數,並在 PIHOLE_PASSWORD 提供 Pi-hole 應用程式密碼。本機需能透過網路連線到 Pi-hole。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Pihole,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP Pi-hole Server
[npm version] [CI] [License: MIT] [MCP]
An MCP (Model Context Protocol) server that connects AI assistants like Claude to your Pi-hole network-wide ad blocker. Manage DNS blocking, view statistics, control whitelists/blacklists, and more through natural language.
Why Use This?
If you're running Pi-hole on your network, this MCP server lets you:
- Monitor DNS traffic - View query statistics, top blocked domains, and client activity
- Control blocking - Enable/disable Pi-hole blocking instantly or with a timer
- Manage lists - Add or remove domains from whitelist and blacklist without opening the web UI
- View query logs - See recent DNS queries with detailed information
- Maintain your Pi-hole - Update gravity (blocklists) and flush DNS cache
Features
Prerequisites
- Node.js 18+
- Pi-hole v6 with API enabled
- Pi-hole app password (generated in Pi-hole settings)
- Network access to Pi-hole from your machine
Installation
Option 1: Install from npm (recommended)
Or install globally:
Option 2: Clone and Build
Configuration
1. Get Your Pi-hole App Password
- Open your Pi-hole web interface
- Go to Settings > API
- Generate a new app password
- Copy the password (it's only shown once)
2. Configure Your MCP Client
For Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
For Claude Code
Add to ~/.claude.json:
Environment Variables
Usage Examples
Once configured, you can interact with Pi-hole through natural language:
View Statistics
"Show me Pi-hole stats"
"What are the top blocked domains?"
"Which clients are making the most queries?"
Control Blocking
"Is Pi-hole blocking enabled?"
"Disable Pi-hole for 5 minutes"
"Re-enable Pi-hole blocking"
Manage Domain Lists
"Add example.com to the whitelist"
"Block ads.trackersite.com"
"Show me all whitelisted domains"
View Query Log
"Show me the last 50 DNS queries"
"What domains has my phone been querying?"
Visual Dashboards
"Show me Pi-hole stats with visualize: true"
"Get top blocked domains with visualization"
Available Tools
Statistics
pihole_get_stats- Get comprehensive Pi-hole statisticspihole_get_top_blocked- Get top blocked domainspihole_get_top_permitted- Get top permitted domainspihole_get_top_clients- Get top clients by query countpihole_get_query_log- Get recent DNS queries
Blocking Control
pihole_get_blocking_status- Check if blocking is enabledpihole_enable_blocking- Enable DNS blockingpihole_disable_blocking- Disable blocking (optionally with timer)
Domain Management
pihole_get_whitelist- List all whitelisted domainspihole_get_blacklist- List all blacklisted domainspihole_add_to_whitelist- Add domain to whitelistpihole_add_to_blacklist- Add domain to blacklistpihole_remove_from_whitelist- Remove domain from whitelistpihole_remove_from_blacklist- Remove domain from blacklist
Maintenance
pihole_update_gravity- Update blocklists (gravity)pihole_flush_cache- Flush DNS cache
ASCII Visualizations
This server supports colorful ASCII art visualizations rendered directly in your terminal using ANSI escape codes.
Supported Tools
The following tools support the optional visualize: true parameter:
Usage
Pass visualize: true to any supported tool:
When visualize is not set or false, tools return JSON data as usual.
Example Output
(Colors appear in terminals that support ANSI escape codes)
Development
Troubleshooting
"PIHOLE_URL and PIHOLE_PASSWORD environment variables are required"
Ensure both environment variables are set in your MCP config.
"Authentication failed"
Your app password is invalid or expired. Generate a new one from Pi-hole Settings > API.
"API request failed: 401"
Session expired. The server will automatically re-authenticate, but if issues persist, check your password.
Connection refused
Ensure Pi-hole is running and the URL is correct. Check that you can access the Pi-hole web interface from your machine.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Links
來源:README.md,提交 ac5c0d7
工具
0版本歷史
1- v1.0.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分