
Pi-hole MCP Server
io.github.ranklancer由 GitHub 帳號 ranklancer 發布v0.2.0更新於 Oct 26, 2026
MCP server for Pi-hole v6 API — manage multiple instances: queries, lists, groups, stats
概覽
讓助理查詢與管理一個或多個 Pi-hole v6 DNS 廣告封鎖器的 MCP 伺服器,可查看查詢日誌、允許/拒絕清單、群組、用戶端與統計。
- 可以做什麼
- 依條件篩選讀取查詢日誌,並取得各執行個體的統計摘要
- 列出、新增、更新與刪除允許清單與拒絕清單網域,自動判斷精確比對或正規表示式,並偵測分類錯誤的正規表示式項目
- 管理群組與用戶端及其群組歸屬
- 啟用或停用封鎖(可設定自動回復計時),並觸發 gravity 重新載入
- 列出、新增與刪除本機 DNS A 記錄與 CNAME 記錄
- 每次呼叫可指定目標執行個體,預設使用第一個執行個體
- 適用情境
- 適合執行一個或多個 Pi-hole v6 執行個體的 homelab 或網路管理員,希望以對話方式查看被封鎖的流量、調整過濾規則或比較各執行個體統計,而不必操作管理介面或撰寫 curl 指令。
- 執行需求
- 以本機 Node.js 程序(Node.js 20 或更新版本)或 Docker 執行;需要能連線至已開啟 API 的 Pi-hole v6 執行個體。透過環境變數設定:PIHOLE_INSTANCES、PIHOLE_BASE_URL 與 PIHOLE_PASSWORD,以及每個執行個體的 NAME_BASE_URL、NAME_PASSWORD 與選用的 NAME_INSECURE_TLS;密碼也可來自 Docker secret 檔案。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Pi-hole MCP Server,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
pihole-mcp
[License: MIT] [Node.js] [Pi-hole v6] [MCP]
An MCP (Model Context Protocol) server that gives AI assistants like Claude full control over your Pi-hole v6 DNS ad-blocker - query logs, allow/deny lists, group management, gravity reload, and stats. Designed from day one for multi-instance deployments: manage one or many Pi-hole instances from a single MCP endpoint.
Why?
Pi-hole's admin API is powerful but cumbersome to script against. This MCP server turns every Pi-hole API action into a tool that any MCP-compatible AI assistant can call directly. Instead of clicking through the admin UI or writing curl commands, just ask your AI to check what's being blocked, allowlist a domain, or compare stats across instances.
Perfect for homelabbers running multiple Pi-holes (primary + secondary, or per-VLAN), network admins managing DNS filtering at scale, and anyone who wants AI-assisted DNS management.
Features
- Multi-instance support - configure 1 to N Pi-hole instances via environment variables
- Full Pi-hole v6 API coverage - query logs, allow/deny lists (full CRUD), group and client management, blocking control, local DNS (A + CNAME) records, gravity reload, stats
- Smart regex detection - automatically routes domains to exact or regex lists based on metacharacter analysis
- Regex landmine detector - finds deny-exact entries that look like they should be regex (miscategorized rules)
- Docker-ready - multi-stage Dockerfile with non-root user, health checks, and security hardening
- Streamable HTTP or stdio transport - run as a long-lived HTTP service, or let the MCP client spawn it on demand
- Docker secrets support - passwords via env vars or
/run/secrets/files
Quick Start
Docker (recommended)
Node.js
Local on demand (stdio, no Docker)
The MCP client starts the server as a child process when needed and talks to it over stdin/stdout. No port is opened and nothing keeps running in the background.
Register it with Claude Code (user scope):
Or add it manually to your MCP client config:
HOST and PORT from .env are ignored in stdio mode.
Configuration
All configuration is via environment variables. See .env.example for the full reference.
Single Instance
Multiple Instances
For each instance name in PIHOLE_INSTANCES, provide:
Docker secrets are supported as a fallback: /run/secrets/<name>_password (lowercase).
Available MCP Tools
Every tool accepts an optional instance parameter to target a specific Pi-hole. Defaults to the first configured instance.
Connecting to Your MCP Client
This section applies to the HTTP transport (Docker or npm start). For stdio, see Local on demand.
The server listens on http://HOST:PORT/mcp (default: http://localhost:3000/mcp). The HTTP endpoint has no authentication, so keep it bound to localhost or a trusted network.
Claude Desktop / Claude Code
Add to your MCP settings:
Health Check
Development
Requirements
- Node.js >= 20
- Pi-hole v6 with API access enabled
- Network connectivity to your Pi-hole instance(s)
Related Projects
- Pi-hole — Network-wide ad blocking
- Model Context Protocol — Open standard for AI tool integration
- MCP Server Registry — Directory of MCP servers
License
MIT
來源:README.md,提交 40f73e2
工具
0版本歷史
1- v0.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分