pi-mcp
Provides Git repository operations for isolated agent work: creating per-worker worktrees and branches, inspecting diffs, committing changes, merging verified branches, cleaning up branches, and pushing to remotes.
Integrates with GitHub to push verified branches, open or reuse pull requests carrying evidence summaries, and use the GitHub merge queue when pushing is explicitly allowed.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
pi-coffee
An MCP server for running several pi coding agents on one repository without them stepping on each other. Every worker gets its own git worktree and branch; the daemon keeps the file claims, the mailbox, the shared board and an evidence trail. You stay the reviewer: nothing merges until the exact candidate has passed a fixed acceptance command and every declared requirement has a verdict.
Any MCP client can drive it — Codex and DeepSeek Harness are the reference clients. Small fixes stay direct.
Why bother
One agent in a repository is easy to supervise. Several are not: they overwrite each other's files, or they leave behind long-lived branches that are painful to merge. Copying the repo wastes the parallelism; running things strictly one after another wastes your time.
pi-coffee gives every worker a private worktree and branch, makes file ownership explicit, and keeps one supervisor responsible for the final result. When a worker finishes, you get a diff, a report, a passing acceptance run against the exact candidate, and a merge gate that refuses anything else.
Workers are worth it for clearly scoped, independent, objectively verifiable work. They are not worth it for a one-line repair or a tightly coupled change — do that yourself.
Related MCP server: agentbus
Requirements
Requirement | Notes |
Node.js ≥ 22.19 | Runtime and test suite. CI covers 22.19, 24 and 26. |
git | Worktrees, diffs, merges, branch cleanup. |
pi | Installed as a pinned local npm dependency. It can authenticate from an API key in the environment, so |
An MCP client | Codex and DeepSeek Harness are the reference clients; any MCP-capable client works. |
Windows 10+ | Git for Windows with Git Bash, plus Node and the client CLI on |
Run the daemon, the client and the workers as the same user: they share file ownership. Root is not
required — any user with a working pi and write access to the repository is fine. Provider
credentials come from the generated env file or from pi's own ~/.pi/agent/auth.json.
Quick start
No checkout needed — the one-line installer fetches the newest release into ~/.pi-coffee/app and runs
the same installer:
curl -fsSL https://raw.githubusercontent.com/lucasjingcn/pi-coffee/main/scripts/bootstrap.sh | bashOr from a checkout:
git clone https://github.com/lucasjingcn/pi-coffee.git
cd pi-coffee
npm run install:local # build, install the skill + pi CLI, register clients, start the daemonIt checks Node and git first, installs the pinned pi CLI and the pi-orchestrator skill, registers
the MCP server pi with every client it finds, asks for provider, API key and model
(~/.pi-coffee/env), and starts a per-user background daemon. No client is required up front: a
missing Codex is skipped and the summary prints the exact command for the client you do have. For a
scripted install, forward the setup options:
npm run install:local -- --provider deepseek --model deepseek-flash --api-key sk-...A missing credential is a warning, not a failed install: run npm run setup, then the restart command
the summary printed. Then check the daemon and prove the whole loop without spending tokens:
node scripts/check-health.mjs # the daemon is up
npm run demo # offline end-to-end check, a few secondsRestart your MCP client afterwards; the pi_* tools and the orchestration policy load then. Clients
the installer cannot write (DSH, Claude Code, Cursor) are connected with
node scripts/register-clients.mjs, which prints the exact command or snippet.

A first worker
With the pi_* tools visible, hand the client one small task and let the loop run once:
In this repository spawn one pi worker:
spec: { goal: "make the acceptance command pass for src/app.ts", scope: ["src/app.ts"],
task_type: "mechanical", purpose: "implementation" }
acceptance_command: "node --test tests/app.test.mjs"
Then show me pi_diff, run pi_verify, record pi_review for the requirement, pi_merge, and
pi_finish with outcome success_first.One task, end to end
Spawn. Call
pi_spawnwith aspec(goal,scope,purpose), a fixedacceptance_command, andacceptance_filesfor any independent tests. The scope is claimed before the worker starts, so an overlapping workstream is rejected immediately.Work. The worker edits inside its scope in a private worktree. Questions come back through
coord_ask; conflicting claims are explained instead of silently overwritten.Review. When the worker settles, read the full
pi_diffand commit the reviewed changes.Verify.
pi_verifyrebuilds an isolated candidate from the exact worker and target commits and runs the acceptance command. Exit code, timeout, output, SHAs and tree evidence are recorded.Approve requirements.
pi_reviewrecords one verdict per hard requirement and one reason per changed existing test file, bound to that verification.Merge.
pi_mergerefuses a changed commit, a failed or timed-out run, a dirty checkout, a scope violation, or a missing review.pi_prand the GitHub merge queue are available when pushing is explicitly allowed.Close.
pi_finishrecords the outcome;pi_reportandpi_metricsshow what landed first try;pi_gcreclaims what is no longer needed.
Tools
The full reference — arguments, gates, edge cases — is in docs/reference/tools.md.
Tool | What it does |
| Create a worktree and branch, then start a worker. Returns its one-time |
| Send an instruction ( |
| Block for a settled worker, a question, or a new handoff notice. |
| Show concise state and pending questions for one or more sessions. |
| List sessions, optionally limited to the ids from this chat. |
| Read a worker transcript incrementally. |
| Show committed, uncommitted and untracked changes for a worker branch. |
| Stage and commit everything in a worker's worktree. |
| Run the acceptance command or validator chain against the exact candidate and record evidence. |
| List, read or re-hash the durable evidence bundle written by |
| Record per-requirement verdicts and approvals for changed existing tests. |
| Merge only with current passing evidence, valid scope and clean checkouts. |
| Push a verified branch and open or reuse a GitHub PR carrying the evidence summary. |
| Push the current branch, or an explicit one, to a remote. |
| Run a diagnostic shell command in a worker's worktree. Never merge evidence. |
| Answer a worker's pending question. |
| Stop an unfinished worker early, optionally removing its worktree and branch. |
| Restart a stopped, unfinished worker on its own transcript instead of re-dispatching. |
| Record the outcome ( |
| Outcome counts by purpose, per-task notes, cost coverage and inconsistent successes. |
| Usage and cost evidence for active and historical sessions. |
| Register orchestrator cost evidence with a source and reference. |
| Verify the hash-chained audit log, or tail its newest entries. |
| Claim repository paths by hand so other workers stay out. |
| Release claims held by a session. |
| List every active file claim. |
| Send durable mail to a worker, with a persisted read-back receipt. |
| Read mail addressed to a worker. |
| Post a shared fact, decision or interface contract. |
| Read the shared board; |
| Recover a lost worker control key with this chat's scope key. |
| Drain the daemon before a restart; new spawns pause, running workers finish. |
| Reclaim selected stopped work, and delete only branches whose integration is proven. |
Daemon-spawned pi sessions additionally get the worker-side tools coord_ask, coord_send,
coord_inbox, coord_claim, coord_release, coord_board_post, coord_board_read and
coord_status.
File claims
Before a worker writes, it claims the path. edit and write claim their target file; bash claims
the literal redirect, tee and sed -i targets it recognizes. If another worker holds a conflicting
claim, the call is blocked and the worker is told who holds it. Claims are namespaced per repository,
so two checkouts of the same repo share them and unrelated repos never collide.
Claims are coordination protection, not a sandbox: dynamic paths, variables and globs are not fully contained, and a worker can still run arbitrary code inside its worktree. For untrusted code, use the Docker sandbox — see docs/reference/coordination.md.
Configuration
Everything is set through PI_COFFEE_* environment variables, read from the private env file
(~/.pi-coffee/env) or the process environment. The ones people change most:
Variable | Default | Meaning |
|
| Worker provider and model. |
|
| pi thinking level; overridable per spawn. |
|
| Hard cap on concurrent workers. |
| (none) | Repository used when |
|
| Daemon state: locks, mailbox, board, metadata, evidence, audit log. |
| (none) | Shared secret for |
|
| Execution backend: |
|
| Explicit opt-in for |
|
| Merge method for the GitHub merge queue: |
| (empty) | Glob allowlist of global plugins a worker may inherit. |
All 50+ variables, their validation rules and the env-file precedence are in docs/reference/configuration.md.
Client timeouts
pi_verify and pi_exec may run for up to 10 minutes. Most MCP clients cap a tool call at 60
seconds, so raise the limit once per client:
[mcp_servers.pi]
# ...command/args...
tool_timeout_sec = 600// ~/.pi/agent/mcp.json
{ "mcpServers": { "pi": { "timeout": 600 } } }A client timeout cancels nothing: the worker keeps working and the evidence stays valid. Read the
real state with pi_status / pi_list instead of treating it as a failure.
Docker
The image bundles Node, git and pi, so the only host requirement is Docker.
cp .env.example .env # provider key and model
mkdir -p workspace # the repository workers should edit
docker compose up -d --build
curl http://127.0.0.1:8787/internal/health./workspace is mounted at /workspace and is the default repo; a named volume holds /data. Point
your client at http://127.0.0.1:8787/mcp. Details and the no-Compose invocation are in
docs/reference/operations.md.
Docs
Document | What is in it |
Install, services and logs, dashboard and metrics, upgrades, uninstall, state recovery, cleanup, security, troubleshooting. | |
Every tool with its arguments and gates. | |
Every environment variable. | |
Claims, mailbox and board receipts, chat isolation, audit log, Docker sandbox. | |
Architecture, commands, tests, docs contract, release. | |
The authoritative orchestration policy. | |
Release history. |
Development
npm ci
npm run build
npm test # build + offline suite, no credentials or network
npm run verify # typecheck, extension typecheck, offline suite, docs contractThe offline suite drives the whole control surface against a fake pi that speaks JSONL. See
docs/development.md for the architecture and release process.
Security and limits
The daemon binds to loopback with no authentication. Set
PI_COFFEE_TOKENbefore exposing it, and only on a trusted network.Claims and digest checks block mistakes and invalid integration; they are not an OS sandbox.
A graceful daemon stop stops workers. A crash is recovered on the next start for sessions that were active at the time; explicitly stopped sessions are not resumed, and Windows has no automatic orphan-process recovery.
The worktree model assumes one worker per branch. The same branch in two worktrees is unsupported.
License
Apache License 2.0. See LICENSE.
Copyright 2026 lucasjing.
pi (@earendil-works/pi-coding-agent) is a separate MIT-licensed program by Mario Zechner. This
repository invokes it as an external tool rather than redistributing its code; the Docker image
installs it from npm at build time. pi is not affiliated with, and does not endorse, this project.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Coordinate coding agents through MCP using existing AI plans, saved work, and independent checks.
Control plane for autonomous software labor. Agents claim objectives over MCP with audit trail.
- aXDeprecatedio.github.ax-platform
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
Related MCP Servers
- AlicenseAqualityDmaintenanceDelegate coding tasks to external AI coding agents in isolated git worktrees with independent verification, enabling any MCP client to orchestrate multi-agent workflows.5MIT
- AlicenseNot gradedqualityCmaintenanceEnables coordinating Claude Code and Codex on one machine by fanning out tasks to multiple agents in isolated Git worktrees, comparing results, picking a winning candidate, and handing off work between harnesses. It provides MCP stdio tools, a CLI, and a local loopback web cockpit.Apache 2.0
- AlicenseBqualityBmaintenanceEnables MCP-compatible clients to delegate complex multi-step programming and research goals to coordinated teams of specialized subagents, with cross-session messaging, swarm and pipeline workflows, sandboxed workspace tools, persistent SQLite state, and a live dashboard.22559 npm1MIT
- AlicenseNot gradedqualityAmaintenanceProvides a provider-agnostic MCP server that coordinates structured multi-agent workflows, owning task claims, action logs, handoffs, and server-side health gates for coding agents. It enables tracked specs, tasks, reviews, and verified completion across Claude Code, Codex CLI, Cursor, Grok Build, and OpenCode.29 npmMIT