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+
- uv
- Pi-hole v6+ with the REST API enabled
Setup
uv sync
Configuration
Environment Variables
| Variable | Required | Description |
|---|---|---|
PIHOLE_URL |
Yes | Base URL of your Pi-hole instance (e.g., http://192.168.0.160:8080) |
PIHOLE_PASSWORD |
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-pihole
Or 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 |
|---|---|
get_status |
Pi-hole status summary (queries, blocked count, blocking state) |
get_top_domains |
Top queried or blocked domains |
get_top_clients |
Top DNS clients by query count |
get_queries |
Recent DNS query log with cursor-based pagination |
get_version |
Pi-hole FTL version information |
Blocklist Management
| Tool | Description |
|---|---|
get_lists |
List all configured blocklists |
add_list |
Add a blocklist URL |
remove_list |
Remove a blocklist by URL |
update_list |
Enable/disable a blocklist or update its comment |
update_gravity |
Rebuild gravity database (required after blocklist changes) |
Domain Management
| Tool | Description |
|---|---|
get_domains |
List allow/deny domains (exact or regex) |
add_domain |
Add a domain to allow or deny list |
remove_domain |
Remove a domain from allow or deny list |
search_domains |
Check if a domain is blocked and by which list |
DNS Control and DHCP
| Tool | Description |
|---|---|
get_blocking_status |
Current DNS blocking status and timer |
set_blocking |
Enable/disable blocking, optionally with a timer |
get_dhcp_leases |
Current DHCP leases |
restart_dns |
Restart the DNS resolver |
Development
uv sync
uv run pytest tests/ -x -q
uv run ruff check src/ tests/
uv run pyright src/
Metadata
Release files for mcp-pihole 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_pihole-0.2.1.tar.gz | 7.9 kB | With provenance | Details for mcp_pihole-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_pihole-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for mcp_pihole-0.2.1-py3-none-any.whl |
Total release size: 18.0 kB
Release files / mcp_pihole-0.2.1.tar.gz
| Download URL | mcp_pihole-0.2.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d093ad86c74bcb852be7f4f412c5958a4df7f60b5f85072f5c963c61038e55f9
|
|
BLAKE2b-256 checksum How to use checksums |
70821cb2e079004c0e3be73cefb76a1c185d0c1704d2f49cdf55fb2fde744c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / mcp_pihole-0.2.1-py3-none-any.whl
| Download URL | mcp_pihole-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46c7e58a2cf1437b66cab6543017fe81dc201ec9bbd799cfbdf1f2abef3b5bbc
|
|
BLAKE2b-256 checksum How to use checksums |
47da0da097315aa553a5da468186b613e268d220d96270924f5f5b469be525f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for mcp-pihole 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_pihole-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.