herdr-mcpSource version v1.2.1
Start

Agent install

Minimal end-to-end execution contract for a coding agent. Human-facing details live in the manual install guide; failure diagnosis lives in troubleshooting.

Execution role: Agent. Read once and execute. Open linked details only for an active blocker. Human-only steps are sign-in, system approval, Cloudflare Token/account/domain choice, and ChatGPT OAuth.

1. Execution rules#

  1. Plan before calling tools. Resolve fleet state, human boundaries, dependencies and checks before mutation. Batch safe related work into one bounded execution call. Re-plan only when safety, human action or uncertain delivery requires it.
  2. Preserve existing work. Never reset --hard, clean -fd, overwrite unrelated dirty files, or rebuild an existing fleet as an installation shortcut.
  3. Normal installation uses the current Stable GitHub Release only. Do not clone this repository or use npm/cargo to build the workstation runtime unless the user explicitly asked for source development.
  4. Keep secrets ephemeral. Never echo or log Cloudflare Tokens or write them to Git or shell history; use process environment or hidden input. Never put HERDR_MCP_TOKEN or Cloudflare Tokens in ChatGPT.
  5. Do not change the user's network environment. Do not switch proxies, rewrite system DNS, or create a generic proxy. The only recovery exception is the verified single-Worker hosts entry in §6.
  6. Pause only at human boundaries. Automate safe steps. Ask once when Cloudflare login, token creation, macOS approval, account/zone choice or ChatGPT OAuth requires the user.

2. Decide first: first Worker or existing fleet#

Resolve this in order without repeatedly questioning the user:

  • A pairing address was already supplied: this machine is joining an existing Herdr Worker; go to §5.
  • This machine is already enrolled: preserve the existing fleet and repair/verify it instead of creating another Worker.
  • Otherwise prepare for a first Worker. After a Cloudflare Token is available, list GET /client/v4/accounts/<ACCOUNT_ID>/workers/scripts; if that Account already contains a Herdr Worker, stop new-Worker mutation, require a pairing from an enrolled device, and continue at §5.
  • Never run herdr-mcp worker pair on the computer currently being installed as a fleet-discovery probe.
  • Never fall back to a random-suffixed Worker, second R2 bucket, or second Connector unless the user explicitly changes fleet intent.

3. Local installation phase#

Do not stop the installation just because herdr is missing or its Server is not running. Download the Latest stable herdr-mcp platform binary from https://github.com/whshang/herdr-mcp/releases, place it on the user PATH (normally ~/.local/bin/herdr-mcp), then run:

herdr-mcp --version
herdr-mcp install
herdr-mcp doctor

herdr-mcp install owns Herdr dependency recovery: it resolves the Herdr TUI binary, verifies or updates it, invokes the official https://herdr.dev/tui/ installer if absent, and verifies Server/API reachability. Do not duplicate that flow unless dependency recovery fails. Never install the Herdr app or herdr-core (hc) for herdr-mcp v1.1. On Windows Candidate UAT use the exact candidate artifact, not an ad-hoc build.

If ~/.local/bin/herdr-mcp exists but the shell cannot resolve it, classify installed_but_not_on_shell_path, repair PATH, verify a fresh shell, and do not reinstall or create a second PATH owner.

On macOS, run herdr-mcp permissions status before Cloudflare work. If it reports needs_setup, grant Full Disk Access to the stable Herdr-MCP broker, then run herdr-mcp permissions verify; do not probe protected paths first or use sudo. Linux and Windows use their normal user-level service/process paths. Normal install needs no Node.js, Wrangler, npm or Cargo.

Optional fast semantic decisions#

Fast semantic decisions are optional and must not block installation; TypeSafe.ai is the reference provider. After the core runtime is healthy, the user may run:

herdr-mcp semantic setup
herdr-mcp semantic status

semantic setup reads the API key through hidden input. Skipping it keeps the same deterministic behavior.

4. First Worker: Cloudflare + bootstrap#

Cloudflare Workers Free is enough for Herdr and needs no payment method. If the user has no account, say registration is free and recommend Google sign-in. When a Token is required, open https://dash.cloudflare.com/profile/api-tokens. Prefer Edit Cloudflare Workers for the selected Account. A custom token needs Account Settings → Read and Workers Scripts → Write/Edit. If workers/subdomain returns 403, report the missing permission and do not inflate the token scope. Core install does not require R2; add Workers R2 Storage only for artifact relay.

Keep the Token only in the current process as CLOUDFLARE_API_TOKEN or provide it through the hidden worker bootstrap input. Do not put the Token in a command-line literal, repository config, or ordinary log.

Run:

herdr-mcp worker bootstrap

This command owns Cloudflare API preflight, Account/workers.dev resolution, existing-Worker detection, release manifest + herdr-edge-<version>.mjs artifact attestation, Worker/DO bootstrap, device enrollment, credentials, and production Link reconciliation. It does not run Wrangler or require a source checkout.

If activation fails after first-device credentials and config are saved, fix the local error and rerun worker bootstrap on the same computer and OS account. Keep the journal and credential: retry authenticates the same device without re-pairing or reprovisioning fleet secrets. Missing, revoked or mismatched credentials fail closed; previously revoked or deleted credentials cannot be restored this way.

Choose the public origin once, before Connector creation:

  • If the Account has one clearly suitable active zone, prefer a dedicated Custom Domain such as https://herdr-mcp.example.com/mcp.
  • If several materially different zones are suitable, ask the user once which one to use.
  • If no suitable zone exists, the user does not want one, or the hostname conflicts, keep workers.dev, for example https://herdr-edge-device.username.workers.dev/mcp.

The normal Custom Domain path does not require generic DNS Write. Later network recovery must not silently change the selected OAuth/MCP public origin.

5. Join an existing Worker#

An enrolled device creates the pairing; the fresh machine only consumes it:

herdr-mcp worker connect "<pairing-address>"

Ask for the six-digit verification code only when the CLI requests it. The display name defaults from the computer name; pass --name only when the user explicitly wants a different name. This path does not deploy another Worker, create another Connector, or copy a fleet-wide long-lived secret to the new machine.

The immutable device_id is dev_<ULID> with a 26-character ULID (for example dev_01ARZ3NDEKTSV4RRFFQ69G5FAV); keep display name separate. Do not invent a WORKSTATION_ID from hostname.

See join an existing fleet for detail.

worker bootstrap / worker connect creates a per-device credential and reconciles the production Link. The Agent only needs to verify:

herdr-mcp status
herdr-mcp doctor
herdr-mcp link status

Without a Custom Domain, try workers.dev first. On DNS failure, query Cloudflare DNS then Google DNS; only a candidate passing real TLS /health may become a marked single-host hosts entry. Retry direct Link, then an existing local proxy; keep signed shared Relay last. Never change system DNS, OAuth issuer, or public MCP origin.

7. Final acceptance#

Combine read-only checks into one final verification wave. Installation is complete only when:

  • herdr-mcp status / doctor are healthy;
  • herdr-mcp link status shows the enrolled production Link online;
  • the canonical public origin serves /health and OAuth discovery correctly;
  • the machine has a canonical dev_<ULID> device identity;
  • one real authenticated MCP request completes from the public origin to this workstation and back.

Then open ChatGPT Settings → Apps & Connectors (legacy Plugins → Browse plugins) and enable Developer mode. Click + → Create APP, create an MCP app with https://…workers.dev/mcp, finish OAuth, and approve it locally. herdr is the recommended App name; custom names work. Work inside a ChatGPT Project, using the + button in the first message of each new chat to select that App.

Chrome extension / Native Messaging is optional for v1.1 Control Center, queued turns, no-ID handoff, multi-provider WebChat (ChatGPT, Claude, Grok, Doubao), fenced browser-page, and browser Skills; install from the Store or herdr-mcp extension standalone install per extension guide and WebChat guide.

8. Cleanup, upgrades, and report#

Unset CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID and delete temporary credential files. Report only non-secret facts: runtime version, device name/id, Worker name, final public origin, Link status, /health, OAuth, and MCP E2E result. Routine v1.1 upgrades use attested herdr-mcp update (and herdr-mcp worker update when Worker drift is reported; see self-upgrade).

If permissions, network, OAuth, existing-Worker ownership, or uncertain delivery blocks progress, open the matching section of manual install guide or troubleshooting; do not preload the full runbook.

Quick Agent Bootstrap

Fastest path: paste one prompt into your local coding agent

Your coding agent reads the authoritative install protocol, installs Herdr and the attested release binary, bootstraps Cloudflare Edge, and pauses only at human auth boundaries.

Install and configure Herdr and herdr-mcp for me. First read and follow this guide end to end: https://raw.githubusercontent.com/whshang/herdr-mcp/main/docs/i18n/en/agent-install.md . Install the local herdr-mcp runtime from GitHub Releases, not from a git clone. Pause only when I personally need to sign in/create a Cloudflare API Token, or when I need to add the herdr Connector/app in ChatGPT. Automate and verify everything else.

Read the complete quick agent install protocol

Documentation

Search herdr-mcp docs

Type to search across all guides (supports English, Chinese, and Japanese queries).