pihole-mcp
Provides comprehensive management of Pi-hole v6 DNS filtering and ad-blocking services, including statistics monitoring, query log analysis, domain list management, local DNS record configuration, and blocking controls.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pihole-mcpshow me the top blocked domains"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pihole-mcp
Unified Pi-hole v6 MCP server. Consolidates the useful tools from three upstream MCPs (aplaceforallmystuff/mcp-pihole, sbarbett/pihole-mcp-server, cwdcwd/mcp-server-pihole) into one Python server that matches the chris2ao-unifi-mcp stack (FastMCP + httpx + Pydantic v2).
Tools (28)
Stats (8): get_stats, get_top_blocked, get_top_permitted, get_top_clients, get_query_types, get_forward_destinations, get_recent_blocked, get_history
Queries (2): get_query_log (rich filters: time range, domain, client, upstream, cursor), get_query_suggestions
Blocking (3): get_blocking_status, enable_blocking, disable_blocking (with optional timer)
Domain lists (6): get_whitelist, get_blacklist, add_to_whitelist, add_to_blacklist, remove_from_whitelist, remove_from_blacklist
Local DNS (5): list_local_dns, add_local_a_record, remove_local_a_record, add_local_cname_record, remove_local_cname_record
Maintenance (4): update_gravity, flush_cache, flush_logs, get_tail_log
Plus server_info.
See docs/plans/consolidated-tool-map.md for per-tool endpoint mapping.
Auth
Pi-hole v6 uses session-based auth. This server handles it automatically:
POST /api/authwith{"password": "<app-password>"}returns a session SID.All subsequent calls include
X-FTL-SID: <sid>.On 401 or near-expiry, the client re-authenticates and retries once.
On shutdown,
DELETE /api/authreleases the session.
App password is created in the Pi-hole Web UI: Settings > Web Interface > "Application password" > Generate. This is separate from the main admin web password and is the correct credential for API clients.
Install
cd /Users/chris2ao/GitProjects/chris2ao-pihole-mcp
uv sync
cp .env.example .env # fill in PIHOLE_URL and PIHOLE_PASSWORD
uv run pytestOr via the wrapper (production use with Claude Code):
~/.claude/scripts/pihole-wrapper.shRegister with Claude Code
In ~/.claude.json, add to mcpServers:
"pihole": {
"command": "/Users/chris2ao/.claude/scripts/pihole-wrapper.sh",
"args": []
}The wrapper sources ~/.claude/secrets/secrets.env for PIHOLE_URL and PIHOLE_PASSWORD, then invokes uv run.
Development
Run tests:
uv run pytestCoverage:
uv run pytest --cov --cov-report=termPython: 3.12+
Relation to chris2ao-unifi-mcp
Same stack (FastMCP, httpx, Pydantic-settings, hatchling, uv). Simpler than unifi-mcp because Pi-hole is a single product (no dynamic product loading or discovery). If you extend this for multi-Pi-hole or for the gap items (adlist/gravity CRUD, groups, DHCP, Teleporter), follow the unifi-mcp module-per-capability pattern.
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chris2ao/pihole-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server