MCP server for Pi-hole v6
Project description
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/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_pihole-0.1.1.tar.gz.
File metadata
- Download URL: mcp_pihole-0.1.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3264d97d1bc9ea1f0397c26d64ec9282bb9bd7a0be6169ab969a2364765adb61
|
|
| MD5 |
df5c6687ec89b304f6a7fcd14aab1cfb
|
|
| BLAKE2b-256 |
3cd2824e7d9101e1a39ebca11ee72a89df9b6caa56b80a3b4eed034fa889b262
|
Provenance
The following attestation bundles were made for mcp_pihole-0.1.1.tar.gz:
Publisher:
release.yml on obrien-matthew/mcp-pihole
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_pihole-0.1.1.tar.gz -
Subject digest:
3264d97d1bc9ea1f0397c26d64ec9282bb9bd7a0be6169ab969a2364765adb61 - Sigstore transparency entry: 1374688571
- Sigstore integration time:
-
Permalink:
obrien-matthew/mcp-pihole@a4f425c29851cfe583976818290d4f01f74de0f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/obrien-matthew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4f425c29851cfe583976818290d4f01f74de0f3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_pihole-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_pihole-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97f20ef31e96381ee63bed1cb89bae1a51a76670698fd03e75ab22388553f98a
|
|
| MD5 |
8082798998c0ea72b3b35dc4fed20d07
|
|
| BLAKE2b-256 |
02537c9ed302c6ef452e3fa4a3487ca23a392c888dafc6d19cb2ee4c3ac1a16e
|
Provenance
The following attestation bundles were made for mcp_pihole-0.1.1-py3-none-any.whl:
Publisher:
release.yml on obrien-matthew/mcp-pihole
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_pihole-0.1.1-py3-none-any.whl -
Subject digest:
97f20ef31e96381ee63bed1cb89bae1a51a76670698fd03e75ab22388553f98a - Sigstore transparency entry: 1374688667
- Sigstore integration time:
-
Permalink:
obrien-matthew/mcp-pihole@a4f425c29851cfe583976818290d4f01f74de0f3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/obrien-matthew
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4f425c29851cfe583976818290d4f01f74de0f3 -
Trigger Event:
push
-
Statement type: