mpt-workflow
Manages local git commits on the user's behalf: stages the working tree, binds a one-shot human approval to the exact content hash, re-checks the staged hash before committing, enforces scope/pre-commit hooks, and keeps pushes manual.
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.
mpt-workflow
A local MCP server, CLI and dashboard that turn a multi-agent, multi-repo PLAN → TODO → implement → accept → commit workflow into an enforceable state machine.
Status: pre-1.0. See ROADMAP.md for the current release and next steps.
Try it in 60 seconds
npx mpt-workflow demo
# prints a disposable workspace; then run the printed command:
npx mpt-workflow web --root <printed path> --port 7788The demo creates everything under $TMPDIR; nothing outside it is touched.
Larger, checked-in workspaces live in examples/.
Related MCP server: agent-bridge
Why
Running several Claude Code sessions against several git repos looks fine until it doesn't:
Nobody knows where the work stands. A new session has to be told "you are the PLAN agent for
my-service, M3 is accepted, M4 has no TODO yet".Roles are advisory. The PLAN agent is told not to edit source. Nothing stops it.
The human is the message bus. You copy a question from the TODO session into the PLAN session, then copy the answer back.
"It passes" is unverifiable. Evidence is typed into a document by the same agent that wrote the code.
Commits happen mid-thought. You wanted to review the diff first.
This tool keeps the workflow in Markdown (so it stays reviewable), and adds a state layer on top: derived status, role-scoped writes, server-executed evidence, one-shot commit approvals, and persistent messaging between agents.
How it works
┌─────────────────────────────────────────┐
PLAN.md / TODO-Mn.md │ mpt-workflow │
docs/agent-questions │ parse → derive state → gate → notify │
.workflow/program.yaml │ │ │
└────────┼────────────┼───────────┼────────┘
│ │ │
MCP tools PreToolUse pre-commit
(Claude) hooks hooks
│ │ │
┌────▼────────────▼───────────▼────┐
│ Claude Code sessions by role │
│ main · plan@repo · todo@repo │
└───────────────┬──────────────────┘
│
┌────────▼─────────┐
│ localhost:7788 │
│ dashboard (user) │
└──────────────────┘Three principles:
Markdown is the source of truth.
PLAN.md,TODO-Mn.md,docs/agent-questions.md,.workflow/program.yamlare human-readable and git-reviewable. The tool derives state from them; it never invents a second database of record.The MCP server is not the enforcement boundary. Agents edit files with
Edit/Write, which never touches MCP. Real enforcement is aPreToolUsehook (blocks out-of-role writes andgit push) plus apre-commithook (scope check).The human approves, the machine remembers. Commits use a one-shot approval bound to the exact working-tree hash; messages and status survive restarts and new sessions.
Requirements
Node.js 22+ (Node 20 reached end-of-life in April 2026)
git
macOS, Linux, or WSL2. Native Windows is not supported yet — see docs/platform-support.md.
Claude Code — the supported MCP client and hook host. Other MCP stdio clients can connect, but hook-based enforcement is Claude Code-specific.
Language and clients
This project is Chinese-first: CLI output, the dashboard, MCP tool descriptions and server instructions are Chinese. The English README is for discovery. We do not ship half-translations; a full locale layer is a demand-driven, post-1.0 option.
Claude Code is the supported client. It provides the PreToolUse /
SessionStart hooks that enforce the role ACL and commit gate. Other MCP stdio
clients are not documented yet: without those hooks, only the MCP tools and the
git pre-commit hook enforce anything. See
docs/support-scope.md for the reasoning and what would
change it.
Install
npm install -g mpt-workflow
mpt-workflow --help
# or run it without a global install
npx mpt-workflow --helpThe npm package name is mpt-workflow. workflow-mcp is already taken by
an unrelated package, so do not install or run that name.
Source install (for development):
git clone git@github.com:Ye-Yu-Mo/mpt-workflow.git
cd mpt-workflow
npm install
npm run build
node dist/cli.js --helpnpm link puts the mpt-workflow and mpt binaries on your PATH.
Quick start
# Try it in a throwaway workspace (nothing outside $TMPDIR is touched)
mpt-workflow demo
# Adopt an existing multi-repo workspace (idempotent; never overwrites files)
mpt-workflow init --root /path/to/workspace
# Add the enforcement hooks (recommended)
mpt-workflow init --root /path/to/workspace --install-hooks
# See where things stand
mpt-workflow status --root /path/to/workspace
mpt-workflow next
# Open the dashboard
mpt-workflow web --root /path/to/workspace --port 7788Every command also works as npx mpt-workflow <command>.
Examples
Example | Shows |
One repo, two milestones, a question board | |
Serial | |
|
They are parsed by tests/examples.test.ts, so the checked-in Markdown cannot
silently rot.
Want to see it work first? mpt-workflow demo builds a throwaway workspace,
adopts it, prints status and sends a message. Nothing outside $TMPDIR is
touched. From a source checkout, ./scripts/demo.sh does the same.
init writes:
Path | Purpose |
| program, repos, phases, active repo, contracts — tracked in git |
| keeps |
| registers the MCP server (excluded via |
| created only if missing |
| only with |
| only with |
Roles
Role | Address | May write | Must not write |
|
| umbrella docs, decisions, | source code, tests, manifests |
|
| repo | source, manifests, other repos |
|
| anything in the bound repo |
|
|
| everything (final authority) | — |
The umbrella root is a sentinel (root), not a configured repo: no role can
plan or implement there, and only main/user may commit its docs (see
Umbrella (root) commits).
Declare the role per session. Use environment variables when sessions run concurrently — the on-disk lease is machine-wide:
WF_ROLE=plan WF_REPO=my-service claude
WF_ROLE=todo WF_REPO=my-service claude
WF_ROLE=main claudeOr call bootstrap(role="plan", repo="my-service") as the first tool in the
session.
The daily loop
plan writes TODO-M3.md (plain Write)
todo milestone_claim(M3)
todo ... code ...
todo evidence_run("cargo test --workspace --locked")
todo milestone_complete(M3) → plan gets a message
plan milestone_accept(M3) → main and user get a message
user reviews the diff in the dashboard, clicks Approve
agent commit_request → commit (local only, never pushes)Every transition is idempotent and recorded. next tells each role what to do
based on derived state.
Commit safety
agent: commit_request(message="feat: ...")
→ scope check, returns a one-shot approval id
user: approve in the dashboard, or `mpt-workflow approve ap-xxx`
agent: commit(approval="ap-xxx") (MCP tool)
→ refuses if the working tree changed since approval
→ local git commit only; push is always manualThe approval is a guardrail against mistakes, not an authorization system:
the server runs as your OS user. It exists so a human sees the diff before it
lands. commit_request stages the tree to bind the approval to exactly that
content; the MCP commit re-checks the staged hash. Agent Bash calls to
git commit / git push (and mpt-workflow approve|commit) are refused by the
hook; commits go through the MCP tool, and the human pushes.
Umbrella (root) commits
The workspace root is usually its own git repository holding the umbrella
documents. It is addressed with the sentinel repo id root, which is never
listed in program.yaml.repos and has no PLAN/TODO/milestone state:
# from the root, with role main:
commit_request(repo="root", message="docs: update umbrella contracts")
# user approves in the dashboard or: mpt-workflow approve ap-...
commit(repo="root", approval="ap-...")repo may be omitted when the MCP process runs at the umbrella root. Only
main and user may commit it — plan/todo are refused, and root does not
change the repo binding of a session.
A root commit may contain only these paths:
Allowed | Purpose |
| umbrella agent instructions |
| umbrella documentation |
| cross-repo milestones and contracts |
| program config (tracked) |
| keeps |
Anything else is refused before staging: component-repo contents, nested
repositories/gitlinks, .workflow/runtime/**, .mcp.json, .claude/**, .git/**
and ad-hoc files. The approval is bound to the working tree and staged hashes
like any other commit; a later edit makes it stale. Root commits are local only;
git push stays a human action.
Messaging and notifications
Agents don't need a human relay anymore. Events and messages are persisted, queryable and acknowledged:
Event | From → To |
| question participants |
|
|
|
|
|
|
| any → |
| any → |
|
|
mpt-workflow inbox --role plan --repo my-service --unread
mpt-workflow read msg-...
mpt-workflow ack msg-... --note "handled"
mpt-workflow wait --role plan --repo my-service --timeout 60000
mpt-workflow watch --role mainAt-least-once. A message is a file on disk; a failed wake-up never loses it. Offline recipients see
queued, promoted tounreadon their nextbootstrap/inbox.Blocking messages prevent
milestone_claim/complete/accept/rejectuntil acknowledged, and are surfaced first bynextand by the SessionStart hook.Expiry. Blocking messages expire after 45 minutes by default and escalate to
userandmain.Send ACL.
todo@repo → plan@same-repo;todo → mainonly foralert;plan → main;plan → todo@same-repo;plan → useronly foralert;main,userandsystemare unrestricted. Cross-repo traffic goes throughmain.
Dashboard
mpt-workflow web serves a single-page, local-only dashboard:
program progress, blocking issues, unread messages, in-flight milestones
repo cards with a milestone track, evidence and current state
question inbox — answer inline (writes back to Markdown, notifies the asker), adopt the recommendation, or copy a relay message
message panel with read/ack and 未读 / blocking / 全部 filters
pending commit approvals with a diff review (file list, stat, unified diff) before you approve; a changed worktree is flagged and approval is disabled
copyable agent session command (
WF_ROLE=… WF_REPO=… claude) for each next action, and a 设为 active control on each repo cardenvironment checks and an event timeline
inline write errors (a fixed toast), so a failed ack/answer/approve is visible
The dashboard auto-refreshes every 15 seconds, but pauses while you are typing or reviewing a milestone, preserves drafts and the open milestone detail, restores focus after a refresh, and shows a retry banner if the API fails.
The only write actions are: answer/close a question, approve a commit, ack a message, switch the active repo.
Maintenance
mpt-workflow doctor # runtime size + stale CLI paths
mpt-workflow gc # dry run: list eligible state
mpt-workflow gc --apply # delete processed messages/approvals
# older than 30 days + stale presence/locks
mpt-workflow gc --apply --evidence-days 90 # also delete full evidence logs older than 90 daysgc is a dry run unless you pass --apply. It never removes unread messages or
pending approvals, and evidence logs are kept unless --evidence-days is set
(the TODO keeps a truncated tail). Use --older-than N to change the processed
state threshold.
MCP tools
Tool | Roles | Purpose |
| all | declare role, get ACL + unread summary |
| all | state, recommended action, environment checks |
| all | list questions |
| by addressee | question lifecycle |
| todo, main | start / finish implementation |
| todo, plan, main | execute a command, record exit code + tree oid + output |
| plan, main | accept with evidence / reject with reason |
| all | diff vs declared files and role ACL |
| all (root: main/user) | request approval, commit with it |
| main, user | serial repo lock |
| all (ACL) | targeted messages |
| all | long-poll for the next message |
| main / all / all | broadcast, presence, escalation |
What it reads
The parser is deliberately forgiving so existing repos can be adopted without a rewrite:
Milestones from a
PLAN.mdtable (| M1 | name | ... |) or headings (### M1 — name), unioned withTODO-M*.mdfiles.Status from YAML front matter (
status: implementing) or a Chinese/English marker (状态:已验收,**已验收(...)**).Allowed files from the
**影响文件**list in each TODO.Questions from
## Q-001 [open] to: mainblocks.Evidence from a
## 证据记录section.
Empty or missing files degrade gracefully: a repo without a PLAN.md shows up
as "no milestones", not an error.
Safety model
Read SECURITY.md before running this on a shared machine.
evidence_runexecutes arbitrary shell commands as your user, by design. It has the same trust level as your terminal.The dashboard binds
127.0.0.1only and has no authentication.Hooks are guardrails, not a sandbox;
git commit --no-verifyandWF_ALLOW_COMMIT=1bypass the scope check.Bash-path ACLs only inspect obvious redirects. Use the pre-commit hook as the backstop.
Repository layout
src/core/ parsing, state machine, ACL, git, evidence, approvals, messages
src/mcp/ MCP server (25 tools)
src/web/ HTTP API + single-page dashboard
src/cli.ts init / status / doctor / web / mcp / hook / inbox / send ...
tests/ node:test suites (72 tests, incl. real examples + MCP stdio)
docs/ architecture and requirement notesDevelopment
npm run typecheck # tsc --noEmit
npm run typecheck:tests # typecheck the test suite too
npm run lint # Biome: formatting + lint
npm run format # Biome: write safe fixes
npm test # runs the 72 tests via tsx
npm run build # tsc + copies the dashboard assets into dist/See CONTRIBUTING.md for the full workflow, and docs/architecture.md for the design rationale. Stuck? See docs/troubleshooting.md.
License
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
Git collaboration for AI agents and people: tasks, hand-offs, reviews, teams, shared memory.
Coordination hub for AI coding agents: message teammates, ask humans, audit every event.
Source control for coding agents: declare an intent, settle overlaps before code, verify each push.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceCoordinates multiple Claude Code agents to work collaboratively on projects with role-based task management, shared state, and automated code review.2-
- AlicenseNot gradedqualityAmaintenanceEnables coordinating Claude Code and Codex across separate Git worktrees with shared issue ownership, file reservations, messages, and explicit handoffs.280 PyPI3MIT
- AlicenseNot gradedqualityCmaintenanceEnables multiple AI coding CLIs (Claude Code, Gemini/Antigravity, Codex, and OpenCode) to collaborate as a coordinated team by routing cross-agent prompts, sharing messages and review tickets, tracking tasks on a shared store, and isolating each agent in its own Git worktree with turn-budget safeguards—all inspectable and steerable from a local web dashboard.MIT
- AlicenseNot gradedqualityCmaintenanceEnables multiple AI coding agents to coordinate on a shared software project by registering, claiming tasks, declaring file intents, publishing structured change reports, and handing off context, with a local dashboard showing state in near real time.MIT