pihole-mcp
Provides tools for managing Pi-hole v6 DNS ad-blocker instances, including query logs, allow/deny lists, group management, gravity reload, blocking control, statistics, and local DNS records.
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-mcpWhat's today's blocked query count?"
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
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.
Related MCP server: MCP Pi-hole Server
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 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 transport - works with any MCP client that supports HTTP-based MCP
Docker secrets support - passwords via env vars or
/run/secrets/files
Quick Start
Docker (recommended)
git clone https://github.com/ranklancer/pihole-mcp.git
cd pihole-mcp
cp .env.example .env
# Edit .env with your Pi-hole URL(s) and password(s)
mkdir -p secrets
echo "your-pihole-password" > secrets/pihole_password
chmod 600 secrets/pihole_password
cp docker-compose.example.yml docker-compose.yml
docker compose up -dNode.js
npm install
npm run build
export PIHOLE_INSTANCES=pihole
export PIHOLE_BASE_URL=http://pihole.example.com
export PIHOLE_PASSWORD=your-password
npm startConfiguration
All configuration is via environment variables. See .env.example for the full reference.
Single Instance
PIHOLE_INSTANCES=pihole
PIHOLE_BASE_URL=http://192.0.2.100
PIHOLE_PASSWORD=your-passwordMultiple Instances
PIHOLE_INSTANCES=primary,secondary
PRIMARY_BASE_URL=http://192.0.2.100
PRIMARY_PASSWORD=password1
SECONDARY_BASE_URL=https://198.51.100.101
SECONDARY_PASSWORD=password2
SECONDARY_INSECURE_TLS=trueFor each instance name in PIHOLE_INSTANCES, provide:
Variable | Required | Description |
| Yes | Pi-hole base URL (e.g. |
| Yes | Pi-hole API password (or use Docker secrets) |
| No | Set |
Docker secrets are supported as a fallback: /run/secrets/<name>_password (lowercase).
Available MCP Tools
Tool | Description |
| Fetch query log with filters (limit, time range, client, domain, status) |
| Add to allowlist (auto-detects exact vs regex) |
| Add to denylist (auto-detects exact vs regex) |
| List all allowlist entries (exact + regex merged) |
| List all denylist entries (exact + regex merged) |
| Get Pi-hole statistics summary |
| Trigger gravity reload |
| CRUD operations on Pi-hole groups |
| Detect miscategorized regex in deny-exact list |
| Enable/disable blocking, with optional auto-revert timer |
| Update or delete an allow/deny domain (completes CRUD) |
| List/add/delete local DNS A records |
| List/add/delete local CNAME records |
Every tool accepts an optional instance parameter to target a specific Pi-hole. Defaults to the first configured instance.
Connecting to Your MCP Client
The server listens on http://HOST:PORT/mcp (default: http://localhost:3000/mcp).
Claude Desktop / Claude Code
Add to your MCP settings:
{
"mcpServers": {
"pihole": {
"url": "http://localhost:3031/mcp"
}
}
}Supergateway (stdio wrapper)
If your MCP client only supports stdio transport, use supergateway:
npx -y supergateway --streamableHttp http://localhost:3031/mcpHealth Check
curl http://localhost:3031/health
# {"ok":true,"service":"pihole-mcp","version":"0.3.0"}Development
npm install
npm run dev # Watch mode — recompiles on save
npm start # Run the serverRequirements
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
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA server that exposes Pi-hole functionality as tools for AI assistants, allowing them to retrieve local DNS settings and query history through natural language.8MIT
- AlicenseAqualityBmaintenanceConnects AI assistants to Pi-hole network-wide ad blocker, enabling monitoring of DNS traffic statistics, controlling blocking settings, managing whitelist/blacklist domains, viewing query logs, and performing maintenance tasks through natural language.16786MIT
- FlicenseNot gradedqualityDmaintenanceEnables control of Pi-hole v6 ad blocking, allowing users to toggle DNS blocking status and retrieve real-time statistics like query counts and blocked domains. It provides a structured interface for monitoring and managing network-level ad filtering through the Pi-hole REST API.
- AlicenseAqualityCmaintenanceMCP server for Pi-hole v6 that enables management of blocklists, DNS blocking, domain allow/deny lists, and query diagnostics through natural language.19MIT
Related MCP Connectors
Universal AI API Orchestrator — 1,554 tools, 96 services. One install.
Log, query, and edit expenses, budgets, and accounts in Ledgy from any MCP-compatible AI assistant.
Buy & manage domains from any AI chat: availability, register, DNS, email forwarding, AI bot stats.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ranklancer/pihole-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server