
A Model Context Protocol (MCP) server for Pi-hole
A Model Context Protocol (MCP) server for Pi-hole
A Model Context Protocol (MCP) server for Pi-hole. This server exposes Pi-hole functionality as tools that can be used by AI assistants.
uv (Optional, for Development)If you want to run the application locally, use uv. Install it with your package manager of choice.
Create a .env file in the project root with your Pi-hole credentials:
# Primary Pi-hole (required)
PIHOLE_URL=https://your-pihole.local/
PIHOLE_PASSWORD=your-admin-password
#PIHOLE_NAME=Primary # optional, defaults to URL if unset
# Secondary Pi-hole (optional)
#PIHOLE2_URL=https://secondary-pihole.local/
#PIHOLE2_PASSWORD=password2
#PIHOLE2_NAME=Secondary # optional
# Up to 4 Pi-holes:
#PIHOLE3_URL=...
#PIHOLE3_PASSWORD=...
#PIHOLE3_NAME=...
#PIHOLE4_URL=...
#PIHOLE4_PASSWORD=...
#PIHOLE4_NAME=...The project follows a modular organization for better maintainability:
/
├── main.py # Main application entry point
├── tools/ # Pi-hole tools organized by functionality
│ ├── __init__.py
│ ├── config.py # Configuration-related tools (DNS settings)
│ └── metrics.py # Metrics and query-related tools
├── resources/ # MCP resources
│ ├── __init__.py
│ └── common.py # Common resources (piholes://, version://)
├── docker-compose.yml # Docker Compose configuration for production
├── docker-compose.dev.yml # Docker Compose for development with volume mounts
└── Dockerfile # Docker build configurationThis structure separates the code into logical components while maintaining compatibility with all run modes.
There are several ways to run the Pi-hole MCP server:
# Standard deployment
docker-compose up -dThe server will be available at http://localhost:8383
For development, use the dev compose file which builds locally:
docker-compose -f docker-compose.dev.yml upYou can run the MCP inspector using uv and the mcp CLI:
uv run mcp dev main.pyThis will start an interactive interface at http://localhost:6274 where you can test tools and resources.
This MCP server exposes the following resources and tools:
piholes://: Returns information about all configured Pi-holesversion://: Returns the MCP server versionlist-tools://: Returns a list of tool categories
list-tools://{category}: Returns a list of tools within a specific categoryEach tool call returns results as a list of dictionaries with the following structure:
[
{
"pihole": "Pi-hole Name",
"data": [...] # Result data from this Pi-hole
},
...
]list_local_dns: Lists all local DNS settings from Pi-hole(s)add_local_a_record: Adds a local A record to Pi-hole(s).add_local_cname_record: Adds a local CNAME record to Pi-hole(s).remove_local_a_record: Removes all A records for a hostname.remove_local_cname_record: Removes all CNAME records for a hostname.list_queries: Fetches the recent DNS query history from Pi-hole(s)list_query_suggestions: Get query filter suggestionslist_query_history: Get activity graph data for queries over timegooseGoose is a CLI LLM client that's useful for testing and development. Follow their install instructions here.
The following assumes you've completed the initial setup with goose configure.
goose configure to open the configuration menu.pihole-mcp.http://localhost:8383/sse.Once the server is installed, start a chat session.
goose sessionTry asking it: "What are my local DNS records?"
...or telling it: "Show me my recent DNS queries."
Claude's desktop client currently only support's the STDIO protocol, however you can use a proxy to communicate with the SSE endpoint.
Add the following to your claude_desktop_config.json file.
{
"mcpServers": {
"pihole": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8383/sse"
]
}
}
}If you're connecting to a different host on your local network and using an unsecured connection, you'll need to explicitly allow it with the --allow-http argument. For example:
{
"mcpServers": {
"pihole": {
"command": "npx",
"args": [
"mcp-remote",
"http://192.168.1.255:8383/sse",
"--allow-http"
]
}
}
}Afterwards, completely restart the application and try it out.
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add pihole -- npx mcp-remote http://localhost:8383/sse{
"mcpServers": {
"pihole": {
"args": [
"mcp-remote",
"http://localhost:8383/sse"
],
"command": "npx"
}
}
}code --add-mcp '{"name":"pihole","args":["mcp-remote","http://localhost:8383/sse"],"command":"npx"}'[mcp_servers.pihole]
command = "npx"
args = ["mcp-remote", "http://localhost:8383/sse"]Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/pihole-mcp-server to learn what the "Pihole Mcp Server" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
This server runs locally, so we can't read its tool list over the web yet.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/pihole-mcp-server)Nothing comparable is listed yet.
v0.2.1PiHoleMCPServer v0.2.1 — Manage Local DNS, System Prompt & Descriptors/InstructionsRelease notesv0.2.0PiHoleMCPServer v0.2.0 – Project Modularity, Version Resource & New ToolsRelease notesv0.1.1PiHoleMCPServer v0.1.1 – Multi-PiHole Support, CI/CD, CHANGELOG, Session ManagementRelease notesConnect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "pihole-mcp-server" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.