home / mcp / mcp pi-hole server
Provides an MCP server to connect AI assistants with Pi-hole for DNS blocking management, statistics, and logs via natural language.
Configuration
View docs{
"mcpServers": {
"aplaceforallmystuff-mcp-pihole": {
"command": "npx",
"args": [
"-y",
"mcp-pihole-server"
],
"env": {
"PIHOLE_URL": "http://your-pihole-address:8080",
"PIHOLE_PASSWORD": "your-app-password"
}
}
}
}You can connect an MCP client to your Pi-hole network-wide ad blocker to monitor DNS traffic, control blocking, manage domain lists, view logs, and perform maintenance all through natural language. This MCP server lets AI assistants interact with Pi-hole to simplify everyday administration and give you quick, actionable insights from your network.
You use an MCP client to talk to the Pi-hole MCP server by configuring a server entry that points to the local or remote MCP runtime. Once configured, you can ask for Pi-hole statistics, top blocked domains, active clients, and recent queries. You can also enable or disable blocking (optionally with a timer), manage white- and blacklists, update gravity, and flush the DNS cache. When you request visual dashboards, you’ll receive colorful ASCII visualizations in supported terminals.
Prerequisites you need before installing are Node.js version 18 or newer and access to a Pi-hole v6 instance with the API enabled. You also need a Pi-hole app password generated in Pi-hole settings and network access from your machine to the Pi-hole web interface.
Option 1: Install from npm (recommended) You can run the MCP server directly with npx or install it globally.
npx mcp-pihole-server
```
```bash
npm install -g mcp-pihole-serverOption 2: Clone and build If you prefer to build locally, clone the repository, install dependencies, and build the project.
git clone https://github.com/aplaceforallmystuff/mcp-pihole.git
cd mcp-pihole
npm install
npm run buildTo connect your MCP client to Pi-hole, you specify the Pi-hole web URL and the app password generated in Pi-hole settings. The client configuration uses an MCP server entry with the command to run the MCP server locally and the environment variables for Pi-hole access.
Example client configuration for Claude Desktop and Claude Code uses the same runtime and environment values. You must replace the placeholders with your actual Pi-hole address and app password.
You can query Pi-hole statistics, enable or disable blocking (with an optional timer), and retrieve the query log. You can also update gravity to refresh blocklists and flush the DNS cache. Visual dashboards are available to render data as ASCII charts in terminals that support ANSI colors.
Protect your Pi-hole app password and limit access to the MCP client to trusted machines. Use a strong app password and ensure your Pi-hole API is secured. Regularly rotate the app password if you suspect it has been exposed.
If you encounter issues connecting to Pi-hole, verify that Pi-hole is running, the API is enabled, and the URL in your MCP client configuration is correct. If authentication fails, generate a new app password in Pi-hole Settings > API and update your client configuration.
{
"mcpServers": {
"pihole": {
"type": "stdio",
"name": "pihole",
"command": "npx",
"args": ["-y", "mcp-pihole-server"],
"env": {
"PIHOLE_URL": "http://your-pihole-address:8080",
"PIHOLE_PASSWORD": "your-app-password"
}
}
}
}Get comprehensive Pi-hole statistics such as total queries, blocking rate, top domains, and top clients.
Retrieve the top blocked domains with counts and percentages.
Retrieve the top permitted domains with counts and percentages.
List top clients by query count.
Fetch recent DNS queries with details like client, status, and response time.
Check whether Pi-hole blocking is enabled.
Enable DNS blocking.
Disable DNS blocking, with optional timer support.
List all whitelisted domains.
List all blacklisted domains.
Add a domain to the whitelist.
Add a domain to the blacklist.
Remove a domain from the whitelist.
Remove a domain from the blacklist.
Update blocklists (gravity).
Flush DNS cache.