Skip to main content

PiHerder MCP

Release PyPI PiHerder MCP Install guide Sponsor Buy Me a Coffee

stdio process that lets Cursor, Claude, Codex, Windsurf, Continue, Goose, and other MCP clients call a PiHerder instance through the existing bearer API.

It runs on the computer that runs the agent. It is not part of the PiHerder image. PiHerder v1.11.0 also serves POST /mcp on the herder, including browser sign-in. This adapter does not use that sign-in. It is the air-gapped fallback for a machine that cannot reach that URL. The public demo is not a target.

Adapter 0.4.4 calls the PiHerder bearer API. trigger_job accepts the same list as hosted /mcp on PiHerder v1.11.0, including container_start, container_stop, container_restart, and container_redeploy. start_move, read_discovery, and start_discovery match the hosted tools. list_discovery_devices, rename_discovery_device, set_discovery_device_state, link_discovery_device, unlink_discovery_device, purge_discovery_device, purge_stale_discovery_devices, and scan_discovery_device tidy LAN Discovery devices. The two purge calls send confirm=true on the request. list_servers and get_server include effective_backup_schedule, next_backup_run, and backup_scheduled. prune_docker starts a Docker prune of images, containers, both, or networks. Volume prune stays on the Docker page. list_alerts returns open notifications. prune_build_cache clears the Docker build cache and the buildx cache. replace_stale_mac ignores a stale LAN Discovery row and copies its custom fields. fleet_summary returns counts and states. since is optional ISO-8601 and does not replace summary. A herder without GET /api/v1/fleet/summary returns 404. MCP registry name: io.github.bjorngluck/piherder-mcp (see server.json). Herder notes: PiHerder v1.13.0. Adapter notes: v0.4.4 · CHANGELOG.md. PyPI package: 0.4.4.

Install

Full steps and scope notes: Agents (MCP).

export PIHERDER_URL='https://piherder.example.com'
export PIHERDER_TOKEN='ph_…'
uvx piherder-mcp

Requires uv (uvx). The package is on PyPI. uvx piherder-mcp installs the latest published release, 0.4.4. A machine that cached 0.4.3 needs uvx --refresh piherder-mcp, then a restart of the MCP client.

Git fallback (pin a branch or commit):

uvx --from git+https://github.com/bjorngluck/piherder-mcp.git piherder-mcp

Auth and tokens

  1. In PiHerder 1.9.0: Settings → API management → Create new token → MCP agent. Details: API tokens.
  2. read is required. jobs, edit, and files add the write tools. A token without read exits on stderr.
  3. Set PIHERDER_URL and PIHERDER_TOKEN for the MCP process.

${PIHERDER_TOKEN} often does not expand inside client JSON env blocks. Many clients pass that string literally. Prefer one of:

  • Export PIHERDER_TOKEN in the host environment and omit it from the client env object (if the client inherits the parent env), or
  • Use the client's secret / env UI when it has one, or
  • Paste the token once into the client config and keep that file out of git.

Samples in clients/ use a ph_… placeholder — replace it, or remove the key and rely on the host env. Do not commit real tokens.

Clients

Samples: clients/ (Cursor, Claude Desktop, Codex, Grok, Windsurf, Continue, Goose, Windows cmd /c). Path notes: clients/README.md.

Claude Desktop config locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Minimal Cursor / Claude-shaped entry:

{
  "mcpServers": {
    "piherder": {
      "command": "uvx",
      "args": ["piherder-mcp"],
      "env": {
        "PIHERDER_URL": "https://piherder.example.com",
        "PIHERDER_TOKEN": "ph_…"
      }
    }
  }
}

The same operating note is in skills/piherder/SKILL.md (Grok), clients/cursor/piherder.mdc (Cursor), CLAUDE.md, and AGENTS.md.

Tools

A token with read, jobs, edit, and files has these 32 tools. A missing scope hides that group. A token without read exits on stderr and lists nothing.

Tool Scope What it does
health read Token health, scopes, and allowed features.
summary read Fleet heartbeat from the database. Does not SSH. Call this before a change.
fleet_summary read Counts and states for hosts, alerts, failed jobs, backups, Drive replication, and pending updates. since is optional ISO-8601. Does not replace summary. Does not SSH.
list_servers read Servers. q filters. limit defaults to 100 and caps at 100. offset pages. Each server includes effective_backup_schedule, next_backup_run, and backup_scheduled.
get_server read One server, including its feature flags and those three backup fields. backup_scheduled is false only when backups are on, the scheduler is running, and no job is registered. Null means that state is unknown.
inventory read Stored Docker inventory. Omit server_id for the fleet. Does not SSH.
services read Stored service up/down chips. Does not poll Uptime Kuma or Nginx Proxy Manager.
list_jobs read Jobs. Optional server_id, status_filter, job_type, active_only, limit, offset.
get_job read One job. detail true includes a longer log tail.
list_alerts read Open notifications. Does not include dismissed or resolved rows.
read_discovery read Read saved LAN Discovery ranges and recent scans.
list_discovery_devices read Page devices. Optional state, limit, and offset.
trigger_job jobs Start one job type from the table below.
start_move jobs Start a stop-first Move. confirm must be true. The source stack is left stopped. There is no undo.
start_discovery jobs Start a scan of the saved LAN Discovery ranges. confirm must be true.
scan_discovery_device jobs Scan one device inside those ranges. confirm must be true.
set_features edit Toggle backup, os_patch, or docker. Omit a field to leave it unchanged.
prune_docker edit Start a Docker prune job. prune_type is images, containers, both, or networks. Volume prune stays on the Docker page.
prune_build_cache edit Prune the Docker build cache and the buildx cache on one host. One audit row. Not a docker_prune job and not scheduled.
rename_discovery_device edit Set the operator name. Kind and map role stay.
set_discovery_device_state edit Set known, new, or ignored.
replace_stale_mac edit Ignore a stale LAN Discovery row that shares this device's hostname and IP. Copies display name, kind override, and notes onto this MAC. One audit row.
link_discovery_device edit Link a device to a fleet server.
unlink_discovery_device edit Unlink a device. It becomes known.
purge_discovery_device edit Delete one device. confirm must be true. A linked device is refused.
purge_stale_discovery_devices edit Delete offline devices. confirm must be true. Linked devices stay.
list_files files List a fleet-jail directory. p is jail-relative. "" is the jail root.
read_file files Download one fleet-jail file. Capped around 256 KiB. The result says when it was cut.
write_file files Upload text. p is the directory, name is the basename. Cap 256 KiB.
mkdir files Create a directory. p is the parent, name is the new directory.
rename_file files Rename inside the current directory. p, src, dest.
delete_file files Delete one file or an empty directory. Not recursive.

Read tools set readOnlyHint. set_features, prune_docker, prune_build_cache, replace_stale_mac, trigger_job, start_move, start_discovery, scan_discovery_device, rename_discovery_device, set_discovery_device_state, link_discovery_device, unlink_discovery_device, purge_discovery_device, purge_stale_discovery_devices, write_file, mkdir, rename_file, and delete_file set destructiveHint.

trigger_job types

server_id and job_type are required. source_filter, service, and os_steps are optional on the tool. For container_start, container_stop, container_restart, and container_redeploy, service (compose service name) and source_filter (compose project directory) are both required and are sent on POST /api/v1/servers/{id}/jobs. HTTP 202 means accepted. HTTP 409 means that job is already active: poll get_job and do not start another. The host feature flag and any feature:* scope still apply. The jobs scope is still required. Docker stays behind the server docker flag and feature:docker when the token is feature-restricted.

job_type Host feature Arguments
backup backup source_filter is the backup source name.
retention backup Prune backups.
os_patch os_patch os_steps is the optional step list.
os_update_check os_patch Check for OS package updates.
host_reboot os_patch Reboot the host.
container_patch docker Update containers.
container_update_check docker Check for container image updates.
docker_stack_check docker source_filter is the compose project path.
docker_stack_deploy docker source_filter is the compose project path.
docker_stack_stop docker source_filter is the compose project path.
docker_stack_start docker source_filter is the compose project path.
docker_stack_restart docker source_filter is the compose project path.
template_deploy docker On this list because the jobs POST accepts it. This call has no template slug or variable values, so a catalog deploy still starts from the template UI.
template_redeploy docker Same as template_deploy.
container_start docker service and source_filter are required. service is the compose service name. source_filter is the compose project directory.
container_stop docker Same required service and source_filter as container_start.
container_restart docker Same required service and source_filter as container_start.
container_redeploy docker Same required service and source_filter as container_start. One service, not the whole project.

Not accepted on trigger_job: docker_stack_down, docker_stack_remove, template_drift_check, Move (service_migrate), undo (service_migrate_undo), and dest-up recover (service_migrate_dest_recover). SSH, the console, and token admin are not tools. A Move is start_move. A LAN Discovery scan is read_discovery and start_discovery. A device scan is scan_discovery_device. Adapter 0.3.1 did not send start_move, read_discovery, or start_discovery. Adapter 0.4.0 did not send the device tools. This package does.

Move

start_move takes server_id (the source), dest_server_id, project (the compose project name, not a directory), and confirm: true. It calls POST /api/v1/servers/{id}/moves. The source stack is left stopped. There is no undo. 409 means a stack, Move, or backup is already running. Poll get_job. That route is on PiHerder 1.10.0.

LAN Discovery

read_discovery lists saved ranges and the latest scan. Pass integration_id for recent scans, or integration_id and run_id for one scan.

start_discovery takes integration_id and confirm: true. Optional intensity is discovery, inventory, detailed, or deep. The body is confirm and intensity only. The scan uses the ranges saved on that integration. The agent does not choose the ranges. Vulnerability scripts stay off.

list_discovery_devices pages devices. state is new, known, linked, ignored, or stale. rename_discovery_device sets the operator name and leaves kind and map role alone. set_discovery_device_state sets known, new, or ignored. A linked device cannot be marked new. link_discovery_device and unlink_discovery_device tie a device to a fleet server. purge_discovery_device and purge_stale_discovery_devices need confirm: true and send confirm=true on the request. A linked device cannot be purged. Offline purge removes only stale rows. There is no undo. scan_discovery_device scans one device whose address sits inside the saved ranges. Default intensity is deep. Vulnerability scripts stay off.

These tools call /api/v1/discovery. A herder without that route returns 404. Device routes need PiHerder v1.11.0.

Wiki

Topic Page
PiHerder v1.13.0 Notes. Package 1.13.0. This adapter 0.4.4. Prior herder tag: v1.12.1
PiHerder v1.12.1 Notes. Adapter 0.4.3. Prior herder tag: v1.12.0
PiHerder v1.11.0 Notes. Package 1.11.0. Prior tag: v1.10.0
PiHerder v1.9.0 Notes. Tag v1.9.0. Prior: v1.8.1
Adapter 0.4.4 Notes · changelog. Prior package: 0.4.3
Adapter 0.4.3 Notes · changelog. Prior package: 0.4.2
Adapter 0.4.2 Notes · changelog. Prior package: 0.4.1
Install, clients, scopes Agents (MCP)
Token scopes and allowlist API tokens
Jobs the token can start Jobs
Fleet-jail files Host Files

Do not vendor this tree inside the PiHerder Docker image.

Publishing (maintainers)

piherder-mcp 0.1.1 was the first PyPI release. 0.4.4 is the current package. Prior package: 0.4.3. Notes: docs/RELEASE_v0.4.4.md. The adapter badge reads the latest GitHub Release. The PyPI badge reads the latest package. The PiHerder badge is hand-typed v1.13.0 and links to the v1.13.0 notes.

Trusted Publisher is already set: GitHub Environment pypi, workflow release.yml, owner bjorngluck, repository piherder-mcp. Later versions reuse it. github-release and publish-pypi still run independently after the build, so a green GitHub Release is not proof the package is on PyPI.

  1. Package version is piherder_mcp.__version__. pyproject.toml reads it. CI checks server.json, the Continue sample, the changelog heading, and the README adapter line.
  2. Write docs/RELEASE_vX.Y.Z.md on that commit. The release workflow uses it as the GitHub Release body. Tag and push: git tag -a vX.Y.Z <sha> -m "piherder-mcp X.Y.Z" && git push origin vX.Y.Z.
  3. Confirm the Release has wheel and sdist assets and the publish-pypi job succeeded, then check pypi.org/project/piherder-mcp.
  4. Optional: publish server.json to the MCP registry; keep the README <!-- mcp-name: … --> marker in sync with server.json name (the version test checks the marker).
  5. Suggested GitHub topics: mcp, model-context-protocol, piherder, python, stdio, uvx.

See CHANGELOG.md. Workflow comments in .github/workflows/release.yml repeat the Trusted Publisher fields.

Tests

pip install -e ".[dev]"
pytest -q

Tests mock HTTP. They do not call a live herder. CI runs Python 3.10–3.12.

Support

Optional. Nothing here is required to install the adapter.

GitHub Sponsors   Buy me a coffee

github.com/sponsors/bjorngluck · buymeacoffee.com/bjorngluck · Support the project

Metadata

Release files for piherder-mcp 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piherder-mcp 0.4.4
File Size Uploaded Provenance Actions
piherder_mcp-0.4.4.tar.gz 27.0 kB With provenance Details for piherder_mcp-0.4.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for piherder-mcp 0.4.4
File Interpreter ABI Platform Actions
piherder_mcp-0.4.4-py3-none-any.whl Python 3 none any Details for piherder_mcp-0.4.4-py3-none-any.whl

Total release size: 44.0 kB

Release files / piherder_mcp-0.4.4.tar.gz

Download URL piherder_mcp-0.4.4.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9b857e9b25c870426185f07cc6d2bd4babc30989dfcfe49f9cf62ab55754dfd4
BLAKE2b-256 checksum
How to use checksums
4baaea4087cbcd6d2e5882c4536e93603cbb405a0f310e718c7f9e388f2816a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / piherder_mcp-0.4.4-py3-none-any.whl

Download URL piherder_mcp-0.4.4-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8036a99164015bd7a9a45ae1fdc56e2eb039d82380a7cb6989e7e11c6b64183e
BLAKE2b-256 checksum
How to use checksums
493ff469832c29f81469a564ece5ce60bfe7cb7cd5c01f4bb6b58912bd69085b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for piherder-mcp 0.4.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for piherder_mcp-0.4.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page