Skip to main content
Glama

Pi-hole MCP Server

WARNING!!: Currently works only when this MCP server and AI client are on the same machine. Need to figure out why it doesn't approve request from other machines in local network.

An MCP (Model Context Protocol) server for controlling Pi-hole ad blocking.

Note: This server is configured for Pi-hole v6 with REST API authentication using app passwords.

Configuration

The server uses a config.json file for configuration. Create this file in the project root:

{
  "server": {
    "mode": "stdio",
    "port": 5000
  },
  "pihole": {
    "base_url": "http://192.168.68.59:8081/api"
  }
}

Configuration Options

  • server.mode: Server mode - "stdio" (default) or "port"

  • server.port: Port number when using port mode (default: 5000)

  • pihole.base_url: Pi-hole API base URL (default: "http://192.168.68.59:8081/api")

Related MCP server: pihole-mcp

Setup

  1. Ensure your Pi-hole has an app password configured (Settings > API > App Password)

  2. Set the environment variable with your app password:

    export PIHOLE_APP_PASSWORD=your_app_password_here
  3. Configure the server mode in config.json

Running

Stdio Mode (Default)

Run the server in stdio mode (for MCP clients):

python main.py

Port Mode

Set "mode": "port" in config.json and run:

python main.py

The server will start on the configured port (default: 5000) using Server-Sent Events (SSE).

Or use the VS Code task: Ctrl+Shift+P > Tasks: Run Task > Run Python Script

Running with Docker

Prerequisites

  • Docker and Docker Compose installed

  • Pi-hole app password configured

Setup

  1. Ensure your config.json is configured for your environment

  2. Set the Pi-hole app password as an environment variable:

    export PIHOLE_APP_PASSWORD=your_app_password_here

Running

# Build and start the container
docker-compose up --build

# Or run in background
docker-compose up -d --build

Configuration

The container uses the config.json file mounted as a volume. You can modify the configuration file and restart the container:

docker-compose restart

Logs

# View logs
docker-compose logs -f

# View logs for specific service
docker-compose logs -f pihole-mcp

Cleanup

# Stop and remove containers
docker-compose down

# Remove containers and volumes
docker-compose down -v

# Remove images
docker-compose down --rmi all

Tools

  • get_pihole_status: Get current Pi-hole blocking status (enabled/disabled)

  • get_pihole_summary: Get Pi-hole statistics summary (queries, blocked domains, etc.)

  • enable_pihole: Enable ad blocking permanently

  • disable_pihole: Disable ad blocking (optional duration in seconds)

API Details

This implementation uses Pi-hole v6 REST API with session-based authentication:

  • Authentication: POST to /api/auth with app password

  • Status: GET /api/dns/blocking

  • Summary: GET /api/stats/summary

  • Control: POST to /api/dns/blocking with JSON payload

Testing

Run unit tests (mocked):

python -m pytest test_main.py::TestPiHoleMCP -v

Run configuration tests:

python -m pytest test_main.py::TestConfiguration -v

Run integration tests (requires PIHOLE_APP_PASSWORD and will actually control Pi-hole):

export PIHOLE_APP_PASSWORD=your_app_password
python -m pytest test_main.py::TestPiHoleIntegration -v -s

Warning: Integration tests will enable/disable Pi-hole blocking. Use with caution!

Debugging

Open main.py, press F5 or use the Run and Debug panel.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • Plausible MCP server for ChatGPT, Claude and any AI agent: list sites, get site stats, get top pages, get traffic sources, create site, add goal, create shared link and invite guest in your own Plausible account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Plausible yourself; Cotlet does not store your password and you need no Plausible API key. About the official Plausible API: Plausible has an official API, but a limited one (checked 22 Oct 2026). The Stats API only reads data and needs the Business plan, the Sites API that creates sites, goals and shared links is Enterprise only, and there is no official MCP server. Setup and FAQ: https://cotlet.dev/integrations/plausible-api-mcp-server

    • Hostelworld MCP server for ChatGPT, Claude and any AI agent: list reservations, reply to review, reply to guest and get payouts report in your own Hostelworld account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Hostelworld yourself; Cotlet does not store your password and you need no Hostelworld API key. About the official Hostelworld API: Hostelworld has no public API for property owners (checked 11 Oct 2026). Its affiliate programme offers an API for property and destination information "on a case by case basis", and properties sync rates, availability and bookings only through an integrated channel manager. Setup and FAQ: https://cotlet.dev/integrations/hostelworld-api-mcp-server

    • Hostfully MCP server for ChatGPT, Claude and any AI agent: list reservations, get reservation, accept booking request, send guest message, read Central Calendar and list properties in your own Hostfully account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Hostfully yourself; Cotlet does not store your password and you need no Hostfully API key. About the official Hostfully API: Hostfully has an official REST API, the Open API v3, and no official MCP server (checked 31 Oct 2026). It is a paid add-on: you email api@hostfully.com with your use case, test in a sandbox, and only then get production access. Setup and FAQ: https://cotlet.dev/integrations/hostfully-api-mcp-server

    • Buildium MCP server for ChatGPT, Claude and any AI agent: record lease payment, list outstanding balances, send text message, create task, add work order and send announcement in your own Buildium account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Buildium yourself; Cotlet does not store your password and you need no Buildium API key. About the official Buildium API: Yes, Buildium has an official REST API, the Open API, but only on the Premium plan (checked 27 Oct 2026). Buildium's developer guide says "To take advantage of the Buildium Open API you must have a Premium Subscription", and an administrator has to switch it on under Settings > Application settings > Api settings before anyone can create a key. Setup and FAQ: https://cotlet.dev/integrations/buildium-api-mcp-server

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Connects AI assistants to Pi-hole network-wide ad blocker, enabling monitoring of DNS traffic statistics, controlling blocking settings, managing whitelist/blacklist domains, viewing query logs, and performing maintenance tasks through natural language.
      16
      125 npm
      8
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      An MCP server for managing Pi-hole v6 DNS filtering and ad-blocking. It provides tools for monitoring statistics, controlling blocking, managing domain lists, and performing maintenance operations through a unified interface.
      73
      MIT