# mcp-pihole

Wires Pi-hole v6 into your AI assistant: query stats, allow and deny lists, blocking on and off, all through plain sentences.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 8
- Author: aplaceforallmystuff
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/aplaceforallmystuff/mcp-pihole
- Updated: 2026-08-12
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-pihole

## What it does

The server talks to your Pi-hole over the v6 API. Ask which domains get blocked most often, or which clients fire the most queries, and you get numbers back. Tell it to pause blocking for a few minutes and it does. List edits happen without opening the web UI.

Tools cover statistics (`pihole_get_stats`, `pihole_get_top_blocked`, `pihole_get_top_permitted`, `pihole_get_top_clients`, `pihole_get_query_log`), blocking control, allow and deny list CRUD, gravity updates and DNS cache flushes. Four statistics tools accept `visualize: true` and answer with an ANSI-colored ASCII dashboard instead of JSON.

You need Node.js 18+, Pi-hole v6 with the API switched on, and an app password generated in Pi-hole settings. That password shows once at creation, so copy it then. The machine running your assistant has to reach Pi-hole over the network.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `PIHOLE_URL`, `PIHOLE_PASSWORD` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp-pihole -e PIHOLE_URL=<PIHOLE_URL> -e PIHOLE_PASSWORD=<PIHOLE_PASSWORD> -- npx -y mcp-pihole-server
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add mcp-pihole --env PIHOLE_URL=<PIHOLE_URL> --env PIHOLE_PASSWORD=<PIHOLE_PASSWORD> -- npx -y mcp-pihole-server
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp-pihole": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-pihole-server"
            ],
            "env": {
                "PIHOLE_URL": "<PIHOLE_URL>",
                "PIHOLE_PASSWORD": "<PIHOLE_PASSWORD>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp-pihole": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "mcp-pihole-server"
            ],
            "env": {
                "PIHOLE_URL": "<PIHOLE_URL>",
                "PIHOLE_PASSWORD": "<PIHOLE_PASSWORD>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e PIHOLE_URL=<PIHOLE_URL> -e PIHOLE_PASSWORD=<PIHOLE_PASSWORD> mcp-pihole npx -y mcp-pihole-server
```
Replace <…> with your own values

## When to use it
- see which domains get blocked most
- pause blocking for a set time and restore it
- add a domain to the allow list without the web UI
- find which clients send the most DNS queries
- refresh gravity and clear the DNS cache

## Example prompts
- Show me Pi-hole stats
- Disable Pi-hole for 5 minutes
- Add example.com to the whitelist

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [Oh My Posh Validator](https://affpapa.org/en/nevibecode/mcp/oh-my-posh-validator.md) — MCP server · ★ 23643
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Coder](https://affpapa.org/en/nevibecode/mcp/coder.md) — MCP server · ★ 17160
- [mcp](https://affpapa.org/en/nevibecode/mcp/kubeshark-mcp.md) — MCP server · ★ 12109

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
