About PiHole MCP Server
PiHole MCP Server is a Java server for AI applications that need to inspect and manage a Pi-hole instance. It exposes controls for DNS blocking and domain lists alongside statistics and system information.
Key features
- 01Restart the FTL DNS service
- 02Read and change DNS blocking
- 03Add domains to allowlists or denylists
- 04Retrieve query and domain statistics
- 05View system metrics and uptime
Use cases
- 01Enable or disable DNS blocking
- 02Add a domain to an allowlist or denylist
- 03Review blocked-query statistics
- 04Check Pi-hole system load and uptime
MCP support
It exposes Pi-hole management tools to MCP clients, including controls for DNS blocking, domain lists, service restarts, statistics, and system information.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEPi-hole MCP Server
Manage Pi-hole with the power of AI
A Pi-hole MCP (Model Control Protocol) server implemented in Java that allows AI applications to interact with and manage a Pi-hole instance through standard commands.
Features
- Core AI tools
Restart Pi-hole FTL Service— restart the Pi-hole FTL DNS service to apply changes or recover.Get Pi-hole DNS Blocking Status— retrieve current blocking mode and remaining timer.Set Pi-hole DNS Blocking Status— enable/disable DNS blocking; optionally set a disable duration (seconds).Add New Domain— add domains to allowlist/denylist (supportsexactandregexkinds) with validation and optional comment.Retrive Pi-hole Statistics— fetch statistics like total queries, blocked queries, and top domains.Retrive Pi-hole System Information— get system info including CPU load, memory usage, blocking percentage, and uptime.
Running the Server
To run the MCP server, you need to have Java 21 installed on your machine.
- Download the Pi-hole MCP server JAR file from the releases page
- Add MCP server configuration to your AI application client.
JSON configuration example:
{
"mcpServers": {
"pihole-mcp-server-java": {
"command": "java",
"args": [
"-jar",
"/absolute/path/to/pihole-mcp.jar"
],
"env": {
"PIHOLE_PORT": "8080",
"PIHOLE_HOST": "192.168.1.2",
"PIHOLE_APP_PASSWORD": "your_app_password"
}
}
}
}
YAML configuration example:
name: pihole-mcp-server-java
version: 0.0.1
schema: v1
mcpServers:
- name: pihole-mcp-server-java
command: java
args:
- -jar
- /absolute/path/to/pihole-mcp.jar
env: {
"PIHOLE_PORT": "8080",
"PIHOLE_HOST": "192.168.1.2",
"PIHOLE_APP_PASSWORD": "your_app_password"
}
Environment Variables
Make sure to set the following environment variables:
PIHOLE_PORT: (Optional) The port on which your Pi-hole instance is running (default is 80).PIHOLE_HOST: The IP address or hostname of your Pi-hole instance.PIHOLE_APP_PASSWORD: The application password for your Pi-hole instance.
Building from Source
Pre requisites:
- Java JDK 21
- Maven
To build the Pi-hole MCP server from source, follow these steps:
- Clone/Download the repository.
- Build the project using Maven:
mvn clean package - Run the server using the command mentioned above.
License
This project is licensed under the MIT License. See the LICENSE file for details
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.