Pi-hole MCP Server

v0.2.0
io.github.ranklancer/pihole-mcp Checked 1 day ago Published 7 months ago

MCP server for Pi-hole v6 API — manage multiple instances: queries, lists, groups, stats

Values you need

VariableWhat it is
PIHOLE_INSTANCESrequired Comma-separated list of Pi-hole instance names (e.g. 'pihole' or 'primary,secondary')
PIHOLE_BASE_URLrequired Base URL of your first Pi-hole instance (e.g. 'http://192.168.1.100')
PIHOLE_PASSWORDrequired secret API password for your first Pi-hole instance

npm (npx)

Requires Node.js 18+

Run in a terminal
claude mcp add pihole-mcp -e 'PIHOLE_BASE_URL=<PIHOLE_BASE_URL>' -e 'PIHOLE_INSTANCES=<PIHOLE_INSTANCES>' -e 'PIHOLE_PASSWORD=<PIHOLE_PASSWORD>' -- npx -y @ranklancer/pihole-mcp@0.2.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "pihole-mcp": {
      "args": [
        "-y",
        "@ranklancer/pihole-mcp@0.2.0"
      ],
      "command": "npx",
      "env": {
        "PIHOLE_BASE_URL": "<PIHOLE_BASE_URL>",
        "PIHOLE_INSTANCES": "<PIHOLE_INSTANCES>",
        "PIHOLE_PASSWORD": "<PIHOLE_PASSWORD>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "pihole-mcp": {
      "args": [
        "-y",
        "@ranklancer/pihole-mcp@0.2.0"
      ],
      "command": "npx",
      "env": {
        "PIHOLE_BASE_URL": "<PIHOLE_BASE_URL>",
        "PIHOLE_INSTANCES": "<PIHOLE_INSTANCES>",
        "PIHOLE_PASSWORD": "<PIHOLE_PASSWORD>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "PIHOLE_BASE_URL",
      "id": "pihole-base-url",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "PIHOLE_INSTANCES",
      "id": "pihole-instances",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "PIHOLE_PASSWORD",
      "id": "pihole-password",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "pihole-mcp": {
      "args": [
        "-y",
        "@ranklancer/pihole-mcp@0.2.0"
      ],
      "command": "npx",
      "env": {
        "PIHOLE_BASE_URL": "${input:pihole-base-url}",
        "PIHOLE_INSTANCES": "${input:pihole-instances}",
        "PIHOLE_PASSWORD": "${input:pihole-password}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.pihole-mcp]
command = "npx"
args = ["-y", "@ranklancer/pihole-mcp@0.2.0"]
env = { "PIHOLE_BASE_URL" = "<PIHOLE_BASE_URL>", "PIHOLE_INSTANCES" = "<PIHOLE_INSTANCES>", "PIHOLE_PASSWORD" = "<PIHOLE_PASSWORD>" }

For AI agents

  1. Ask the user for: PIHOLE_INSTANCES, PIHOLE_BASE_URL, PIHOLE_PASSWORD. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json