mcp-pihole
Manage Pi-hole v6 blocklists, DNS blocking, domain allow/deny lists, and query diagnostics.
Click on "Deploy 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., "@mcp-pihole add ads.example.com to the deny list"
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.
mcp-pihole
MCP server for Pi-hole v6. Manage blocklists, DNS blocking, domain allow/deny lists, and query diagnostics through the Model Context Protocol.
Prerequisites
Python 3.14+
Pi-hole v6+ with the REST API enabled
Related MCP server: Pi-hole MCP Server
Setup
uv syncConfiguration
Environment Variables
Variable | Required | Description |
| Yes | Base URL of your Pi-hole instance (e.g., |
| No | Web interface password. Omit or leave empty for passwordless instances. |
Claude Code
claude mcp add pihole \
-e PIHOLE_URL=http://192.168.0.160:8080 \
-e PIHOLE_PASSWORD=yourpassword \
-- uvx mcp-piholeOr add to .claude/settings.json:
{
"mcpServers": {
"pihole": {
"command": "uvx",
"args": ["mcp-pihole"],
"env": {
"PIHOLE_URL": "http://192.168.0.160:8080",
"PIHOLE_PASSWORD": "yourpassword"
}
}
}
}Claude Desktop
Add to your Claude Desktop config:
{
"mcpServers": {
"pihole": {
"command": "uvx",
"args": ["mcp-pihole"],
"env": {
"PIHOLE_URL": "http://192.168.0.160:8080",
"PIHOLE_PASSWORD": "yourpassword"
}
}
}
}Tools
Diagnostics
Tool | Description |
| Pi-hole status summary (queries, blocked count, blocking state) |
| Top queried or blocked domains |
| Top DNS clients by query count |
| Recent DNS query log with cursor-based pagination |
| Pi-hole FTL version information |
Blocklist Management
Tool | Description |
| List all configured blocklists |
| Add a blocklist URL |
| Remove a blocklist by URL |
| Enable/disable a blocklist or update its comment |
| Rebuild gravity database (required after blocklist changes) |
Domain Management
Tool | Description |
| List allow/deny domains (exact or regex) |
| Add a domain to allow or deny list |
| Remove a domain from allow or deny list |
| Check if a domain is blocked and by which list |
DNS Control and DHCP
Tool | Description |
| Current DNS blocking status and timer |
| Enable/disable blocking, optionally with a timer |
| Current DHCP leases |
| Restart the DNS resolver |
Development
uv sync
uv run pytest tests/ -x -q
uv run ruff check src/ tests/
uv run pyright src/Available Tools
19 toolsadd_domainB
Add a domain to the allow or deny list.
domain: the domain or regex pattern to add. type: "allow" (whitelist) or "deny" (blacklist). kind: "exact" (exact domain match) or "regex" (regular expression). comment: optional description.
Inputs: domain (required), type, kind, comment.
add_listA
Add a blocklist by URL.
address: URL of the blocklist (e.g., https://example.com/hosts.txt). comment: optional description. enabled: whether the list is active (default True).
After adding, run update_gravity to apply changes.
Inputs: address (required), comment, enabled.
get_blocking_statusA
Get current DNS blocking status.
Returns whether blocking is enabled/disabled and any active timer.
Inputs: no named parameters.
get_dhcp_leasesA
Get current DHCP leases.
Returns active leases with IP, MAC address, hostname, and expiry time.
Inputs: no named parameters. Returns: result
get_domainsB
Get configured domain entries.
type: "allow" (whitelist) or "deny" (blacklist). kind: "exact" (exact match) or "regex" (regular expression).
Inputs: type, kind. Returns: result
get_listsA
Get all configured blocklists.
Returns each list's URL, enabled/disabled status, comment, and groups.
Inputs: no named parameters. Returns: result
get_queriesA
Get recent DNS queries.
length: number of queries to return (max 100). cursor: database ID for cursor-based pagination. Pass the cursor value from a previous response to get the next page.
Inputs: length, cursor.
get_server_versionA
Return the installed version of the mcp-pihole server.
Inputs: no named parameters. Returns: result
get_statusA
Get Pi-hole status summary.
Returns blocking status, total queries today, blocked count, percentage blocked, domains on blocklist, clients seen, unique domains, cached and forwarded query counts.
Inputs: no named parameters.
get_top_clientsA
Get top DNS clients by query count.
count: number of clients to return (max 100). blocked: if True, returns clients with most blocked queries.
Inputs: count, blocked.
get_top_domainsA
Get top queried domains.
count: number of domains to return (max 100). blocked: if True, returns top blocked domains instead of top permitted.
Inputs: count, blocked.
get_versionA
Get Pi-hole FTL version information.
Inputs: no named parameters.
remove_domainB
Remove a domain from the allow or deny list.
domain: the exact domain or regex pattern to remove. type: "allow" or "deny". kind: "exact" or "regex".
Inputs: domain (required), type, kind. Returns: result
remove_listA
Remove a blocklist by URL.
address: exact URL of the blocklist to remove. After removing, run update_gravity to apply changes.
Inputs: address (required). Returns: result
restart_dnsA
Restart the Pi-hole DNS resolver.
Use after configuration changes that require a DNS restart.
Inputs: no named parameters. Returns: result
search_domainsA
Check if a domain is blocked and by which list.
Searches gravity, antigravity, exact deny/allow, and regex deny/allow lists. Useful for troubleshooting why a domain is blocked or allowed.
Inputs: domain (required).
set_blockingA
Enable or disable DNS blocking.
enabled: True to enable, False to disable. timer: optional seconds before blocking auto-reverts. Example: set_blocking(False, 300) disables for 5 minutes.
Inputs: enabled (required), timer.
update_gravityA
Rebuild the gravity database.
Required after adding, removing, or modifying blocklists for changes to take effect. Runs asynchronously on the Pi-hole server.
Inputs: no named parameters. Returns: result
update_listA
Update a blocklist's enabled status or comment.
address: exact URL of the blocklist to update. enabled: set True to enable, False to disable. comment: update the list's description.
Only provided fields are changed. After changes, run update_gravity.
Inputs: address (required), enabled, comment.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Each tool targets a distinct resource and action. The get_* tools retrieve different types of data (status, leases, domains, lists, queries, top clients, top domains, versions) with clear descriptions. Add/remove/update/set/restart/search all have non-overlapping purposes, avoiding ambiguity even between get_version and get_server_version.
All tool names follow a consistent verb_noun pattern in snake_case. Verbs like add, get, remove, restart, search, set, update are used uniformly. The naming is predictable and easy to understand, with only minor variation like 'update_gravity' fitting the pattern well.
With 19 tools, the server covers the full range of Pi-hole administration: domain and list management, blocking control, statistics, DHCP, version info, and DNS restart. The count is well-scoped for the domain; every tool serves a clear purpose without bloat or omission.
The tool surface covers most essential CRUD operations for domains and lists, blocking control, statistics, and DHCP. A minor gap is the lack of an update_domain tool to modify domain comments, which may require workarounds. Overall, the set is nearly complete for Pi-hole management.
Maintenance
Related MCP Connectors
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Related MCP Servers
- AlicenseCqualityBmaintenanceAn MCP server for managing Pi-hole v6 DNS filtering and ad-blocking. It provides tools for monitoring statistics, controlling blocking, managing domain lists, and performing maintenance operations through a unified interface.73MIT
- AlicenseAqualityDmaintenanceEnables management of Pi-hole DNS servers through natural language commands, including enabling/disabling blocking, viewing statistics, and configuration.5MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Pi-hole v6.x that provides direct API proxying and composite tools for analyzing network devices, managing block/allow lists, local DNS records, and performing backups.MIT
- AlicenseNot gradedqualityBmaintenanceEnables natural language management of AdGuard Home DNS filtering, clients, DHCP, rewrites, and more via MCP.613 npm15MIT