MCP server for Pi-hole v6 — DNS blocking, query analysis, and multi-instance management for AI assistants
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
git clone https://github.com/hexamatic/pihole-mcp{
"mcpServers": {
"pihole-mcp": {
"command": "pihole-mcp",
"env": {
"PIHOLE_URL": "<pihole_url>",
"PIHOLE_PASSWORD": "<pihole_password>"
}
}
}
}PIHOLE_URLPIHOLE_PASSWORDMCP Servers overview
<div align="center">
<img src="assets/logo.svg" width="120" alt="pihole-mcp">
# pihole-mcp
A production-grade [MCP](https://modelcontextprotocol.io/) server for [Pi-hole](https://pi-hole.net/) v6.
**76+ tools** | **9 prompts** | **5 resources** | Multi-instance + sync | Single Go binary | 6.4 MB download (slim: 3.8 MB)
[](https://github.com/hexamatic/pihole-mcp/actions/workflows/ci.yml)
[](https://codecov.io/gh/hexamatic/pihole-mcp)
[](https://scorecard.dev/viewer/?uri=github.com/hexamatic/pihole-mcp)
[](https://pkg.go.dev/github.com/hexamatic/pihole-mcp)
[](LICENSE)
</div>
Gives AI assistants full control over your Pi-hole instance — DNS blocking, domain management, query analysis, statistics, network devices, DHCP, and system administration. Compatible with the Pi-hole v6 REST API.
## Quick Start
Most MCP clients use the same configuration format. Add this to your client's config:
```json
{
"mcpServers": {
"pihole": {
"command": "pihole-mcp",
"env": {
"PIHOLE_URL": "http://192.168.1.2",
"PIHOLE_PASSWORD": "your-password"
}
}
}
}
```
Then install the binary via one of the methods below.
## Installation
### MCP Registry
pihole-mcp is listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/) as:
```
io.github.hexamatic/pihole-mcp
```
Clients that support registry install can add it by that name and will prompt for
`PIHOLE_URL` and `PIHOLE_PASSWORD`. The listing points at the `ghcr.io` image, so the
client needs a working Docker.
### Homebrew
```bash
brew install hexamatic/tap/pihole-mcp
```
Installs on both macOS and Linux (Homebrew on Linux). On macOS the cask clears the
quarantine attribute during install, so the binary runs without a Gatekeeper prompt.
### Scoop (Windows)
```powershell
scoop bucket add hexamatic https://github.com/hexamatic/scoop-bucket
scoop install pihole-mcp
```
### Go Install
```bash
go install github.com/hexamatic/pihole-mcp/cmd/pihole-mcp@latest
```
### Docker
```bash
docker pull ghcr.io/hexamatic/pihole-mcp:latest
```
### Linux Packages
`.deb` and `.rpm` packages for Debian-based (Ubuntu, Raspberry Pi OS) and RPM-based (Fedora, RHEL) distributions are available on the [Releases](https://github.com/hexamatic/pihole-mcp/releases) page.
```bash
# Debian / Ubuntu / Raspberry Pi OS
sudo dpkg -i pihole-mcp_X.Y.Z_linux_amd64.deb
# Fedora / RHEL / CentOS
sudo rpm -i pihole-mcp_X.Y.Z_linux_amd64.rpm
```
### Binary Download
Pre-built binaries for Linux, macOS, and Windows (amd64 and arm64) are available on the [Releases](https://github.com/hexamatic/pihole-mcp/releases) page.
Releases are checksummed, signed with keyless cosign, and ship SPDX SBOMs and SLSA build provenance — see [SECURITY.md](SECURITY.md#verifying-release-artefacts) for the verification commands.
## Configuration
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `PIHOLE_URL` | Yes | — | Pi-hole base URL (e.g. `http://192.168.1.2`) |
| `PIHOLE_PASSWORD` | Yes | — | Admin password or [application password](https://docs.pi-hole.net/api/auth/) |
| `PIHOLE_REQUEST_TIMEOUT` | No | `30s` | HTTP request timeout |
| `PIHOLE_MAX_RETRIES` | No | `3` | Retries after a failed Pi-hole API call. `0` disables. |
| `PIHOLE_RETRY_MAX_DELAY` | No | `8s` | Upper bound on a single backoff wait. |
| `PIHOLE_RATE_LIMIT` | No | `120` | Per-session requests-per-minute cap on the HTTP/SSE transports. `0` disables. |
| `PIHOLE_ALLOWED_ORIGINS` | No | `localhost,127.0.0.1,[::1]` | Comma-separated Origin/Host allowlist for HTTP/SSE transports. The literal `*` disables enforcement (unsafe). |
| `PIHOLE_TLS_SKIP_VERIFY` | No | `false` | Disable TLS certificate verification for Pi-hole connections. Only for instances serving self-signed certificates — prefer a trusted certificate where possible. |
| `TZ` | No | System timezone (UTC in Docker) | IANA timezone for rendered timestamps (e.g. `Australia/Adelaide`). Timezone data is embedded in the binary, so this works in the Docker image out of the box. |
| `OTEL_EXPORTER_OTLP_ENDPOINT` | No | — | OpenTelemetry collector endpoint. Setting it enables tracing; ignored in slim builds. |
Application passwords are recommended for automation — they bypass TOTP 2FA and can be revoked independently.
`PIHOLE_RATE_LIMIT` and `PIHOLE_ALLOWED_ORIGINS` only apply to the `http` and `sse` transports; stdio is a single-process, single-user channel by definition and isn't gated.
### Multiple instances
To manage more than one Pi-hole, configure numbered instances instead of `PIHOLE_URL`/`PIHOLE_PASSWORD`:
| Variable | Required | Description |
|----------|----------|-------------|
| `PIHOLE_1_URL`, `PIHOLE_2_URL`, … | Yes | Base URL of each instance (contiguous from 1) |
| `PIHOLE_1_PASSWORD`, `PIHOLE_2_PASSWORD`, … | Yes | Password for the matching instance |
| `PIHOLE_1_NAME`, `PIHOLE_2_NAME`, … | No | Friendly name (default `instance-1`, `instance-2`, …) |
```json
{
"mcpServers": {
"pihole": {
"command": "pihole-mcp",
"env": {
"PIHOLE_1_URL": "http://192.168.1.2",
"PIHOLE_1_PASSWORD": "primary-password",
"PIHOLE_1_NAME": "downstairs",
"PIHOLE_2_URL": "http://192.168.1.3",
"PIHOLE_2_PASSWORD": "secondary-password",
"PIHOLE_2_NAME": "upstairs"
}
}
}
}
```
Every tool then accepts an optional `instance` argument, and every result is labelled with the instance it came from. Omit the argument to target the first instance; pass a name to target a specific one; pass `instance=all` on a read-only tool (e.g. `pihole_padd`, `pihole_stats_summary`) to query every instance concurrently and get back a single structured aggregate (per-instance results plus a success/failure summary — one slow or unreachable instance no longer fails the whole call). State-changing tools require a single named instance. `PIHOLE_URL` and `PIHOLE_1_URL` are mutually exclusive.
### Keeping instances in sync
When you run more than one Pi-hole, two extra tools appear for keeping them aligned:
- **`pihole_instance_diff`** — compare two instances and see exactly what differs across adlists/allowlists, allow/deny rules (exact and regex), groups, clients, local DNS A/AAAA records, and CNAME records. It is read-only and writes nothing.
- **`pihole_instance_sync`** — push a source instance's configuration onto a target. It is deliberately cautious:
- **One direction only.** You name the `source` of truth and the `target`; only the target is ever written to.
- **Dry-run first.** It returns a plan and a `confirm_token` by default; nothing changes until you re-run with `mode=apply` and that token. If the configuration drifts between planning and applying, the token no longer matches and the apply is refused.
- **Add/update by default.** Entries on the target but not the source are left alone unless you pass `prune=true`.
- **Backed up.** A teleporter backup of the target is taken before any change (disable with `snapshot=false`).
- **Safe by omission.** Host-specific and identity settings — DHCP, interface bindings, passwords, TLS certificates, sessions, 2FA — are never synced. Group *membership* associations are not synced either, because Pi-hole group IDs are local to each instance.
Example: preview what the `upstairs` Pi-hole is missing relative to `downstairs`, then apply it.
```text
pihole_instance_diff { "source": "downstairs", "target": "upstairs" }
pihole_instance_sync { "source": "downstairs", "target": "upstairs" } → returns a plan + confirm_token
pihole_instance_sync { "source": "downstairs", "target": "upstairs",
"mode": "apply", "confirm_token": "<token from the plan>" }
```
## Client Setup
The Quick Start config above works for most clients. Expand the section below for client-specific instructions.
<details>
<summary><strong>Claude Desktop</strong></summary>
Add to your Claude Desktop configuration file:
| OS | Path |
|----|------|
| macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
| Linux | `~/.config/Claude/claude_desktop_config.json` |
```json
{
"mcpServers": {
"pihole": {
"command": "pihole-mcp",
"env": {
"PIHOLE_URL": "http://192.168.1.2",
"PIHOLE_PASSWORD": "your-password"
}
}
}
}
```
Restart Claude Desktop after saving.
</details>
<details>
<summary><strong>Claude Code</strong></summary>
```bash
claude mcp add pihole \
-e PIHOLE_URL=http://192.168.1.2 \
-e PIHOLE_PASSWORD=your-password \
-- pihole-mcp
```
Verify with:
```bash
claude mcp list
```
</details>
<details>
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
Add to `.vscode/mcp.json` in your workspace:
```json
{
"servers": {
"pihole": {
"type": "stdio",
"command": "pihole-mcp",
"env": {
"PIHOLE_URL": "http://192.168.1.2",
"PIHOLE_PASSWORD": "your-password"
}
}
}
}
```
Or add via the command palette: `MCP: Add Server`.
> **Note:** VS Code uses `"servers"` as the top-level key (not `"mcpServers"`), and requires `"type": "stdio"`.
</details>
<details>
<summary><strong>Cursor</strong></summary>
Add to `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"pihole": {
"command": "pihole-mcp",
"env": {
"PIHOLE_URL": "http://192.168.1.2",
"PIHOLE_PASSWORD": "your-password"
}
}
}
}
```
</details>
<details>
<summary><strong>Windsurf</strong></summary>
Add to `~/.codeium/windsWhat people ask about pihole-mcp
What is hexamatic/pihole-mcp?
+
hexamatic/pihole-mcp is mcp servers for the Claude AI ecosystem. MCP server for Pi-hole v6 — DNS blocking, query analysis, and multi-instance management for AI assistants It has 6 GitHub stars and was last updated today.
How do I install pihole-mcp?
+
You can install pihole-mcp by cloning the repository (https://github.com/hexamatic/pihole-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is hexamatic/pihole-mcp safe to use?
+
Our security agent has analyzed hexamatic/pihole-mcp and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains hexamatic/pihole-mcp?
+
hexamatic/pihole-mcp is maintained by hexamatic. The last recorded GitHub activity is from today, with 0 open issues.
Are there alternatives to pihole-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy pihole-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/hexamatic-pihole-mcp)<a href="https://claudewave.com/repo/hexamatic-pihole-mcp"><img src="https://claudewave.com/api/badge/hexamatic-pihole-mcp" alt="Featured on ClaudeWave: hexamatic/pihole-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!