commit-discipline-mcp
Enforces disciplined Git workflows by planning coding tasks into 2-4 ordered, test-gated stages and creating focused commits only when tests pass and the worktree is clean.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@commit-discipline-mcp Plan this feature into test-gated commits and commit each stage"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Why commit discipline?
Coding agents can solve large tasks quickly, but their Git history often arrives as one oversized commit—or a trail of commits made before tests ran. commit-discipline-mcp puts a small, deterministic control loop around that work.
Common failure mode | Built-in guardrail |
One giant, hard-to-review commit | Every task is planned into 2–4 ordered stages |
Tests are run after the commit | The detected test suite must pass before staging |
Unrelated files sneak into a commit | Files outside the active stage block the operation |
An agent skips ahead | Only the next pending stage can be committed |
Manual commits invalidate the plan | Unexpected |
A tool silently pushes code | This package never pushes or rewrites Git history |
It works with Codex, Claude Code, Cursor, and any MCP client that supports stdio tools. The same workflow is also available as a regular CLI.
Related MCP server: Development Workflow MCP Server
Quick start
Requirements: Node.js 18+, Git, and a clean Git repository.
npx -y commit-discipline-mcp@latest init --client all --yesThat command adds project-scoped MCP configuration and a reusable commit-discipline skill. Commit the generated files, reload your coding client, and ask:
Use commit-discipline to split this task into small test-gated stages. Commit each completed stage and finish the task when the worktree is clean.
Choose clients explicitly when needed:
npx -y commit-discipline-mcp@latest init --client codex --yes
npx -y commit-discipline-mcp@latest init --client claude --yes
npx -y commit-discipline-mcp@latest init --client cursor --yesClient | MCP configuration | Installed skill |
Codex |
|
|
Claude Code |
|
|
Cursor |
|
|
Use --dry-run to preview changes. Existing configuration is merged and backed up; --force is required to replace a conflicting entry.
How it works
flowchart LR
A[Clean repository] --> B[Plan 2–4 stages]
B --> C[Work on current stage]
C --> D{Tests pass?}
D -- No --> C
D -- Yes --> E[Validate scope and limits]
E --> F[Create focused commit]
F --> G{Stages left?}
G -- Yes --> C
G -- No --> H[Finish with clean worktree]The MCP server exposes four focused tools:
Tool | Purpose |
| Record 2–4 stages with exact repository-relative files |
| Test, validate, stage, and commit only the active stage |
| Report progress and the next permitted stage |
| Verify all stages are complete and the worktree is clean |
Plan state is stored locally in .commit-discipline/plan.json and ignored by default.
CLI workflow
Prefer a terminal? Install the binary globally:
npm install --global commit-discipline-mcpCreate a stage file:
[
{
"id": "core",
"title": "Build the core",
"description": "Implement the service layer",
"files": ["src/core.ts"]
},
{
"id": "tests",
"title": "Add coverage",
"description": "Cover the service behavior",
"files": ["tests/core.test.ts"]
}
]Then run the lifecycle:
commit-discipline plan-task --description "Build the feature" --stages-file stages.json
commit-discipline task-status
commit-discipline commit-stage core --message "feat: add core service"
commit-discipline commit-stage tests --message "test: cover core service"
commit-discipline finish-taskSee the guided throwaway-repository demo for copy-pasteable PowerShell and Bash examples.
Configuration
Add commit-discipline.config.json to the repository root when the defaults need adjustment:
{
"schemaVersion": 1,
"enforcement": "strict",
"maxFiles": 15,
"maxLines": 400,
"testTimeoutMs": 900000,
"planVisibility": "local",
"testCommand": {
"command": "npm",
"args": ["test"]
}
}Option | Default | Behavior |
|
| Use |
|
| Maximum changed files per stage |
|
| Maximum added and deleted lines per stage |
|
| Test-process timeout in milliseconds |
|
| Store plan state locally or as tracked project state |
| auto-detected | Override the test command and arguments |
Without an override, the tool detects one JavaScript, Python, Go, Rust, or Make test ecosystem. If several ecosystems are present, set testCommand explicitly. Failed tests always block a commit.
--file <path>commits a subset of the active stage's declared files.--max-files Nand--max-lines Napply one-off limits.--dry-runvalidates a stage without tests, staging, commits, or state changes.--jsonreturns machine-readable output for scripts and agents.
Safety by design
Plans start only from a clean worktree.
Absolute paths and path traversal are rejected.
Pre-existing staged files and out-of-scope changes are blocked.
Tests run before staging; scope is checked again afterward.
Dry runs do not mutate Git or plan state.
No runtime network calls and no telemetry.
No
git push, force operations, resets, or history rewriting.
Platform support
Every release is exercised across Windows, Ubuntu, and macOS on Node.js 18, 20, and 22. Packed-package smoke tests cover the full CLI lifecycle and the MCP stdio handshake.
Platform | Native launch path | Status |
Windows |
| Tested in PowerShell and Command Prompt |
Linux |
| Tested in Bash |
macOS |
| Tested in Zsh |
For implementation details and trust boundaries, read the architecture overview. Reusable starting points are available in examples/.
Development
git clone https://github.com/ayush-singh-0601/commit-discipline-mcp.git
cd commit-discipline-mcp
npm ci
npm run verify
npm run smoke:package
npm run benchmark:gitThe release gate includes type checking, 46+ unit and integration tests, package installation, a complete CLI/MCP lifecycle, and a Git-overhead benchmark against the PRD's 300 ms target.
Community
Read CONTRIBUTING.md before opening a pull request.
Report vulnerabilities privately using SECURITY.md.
Get usage help through SUPPORT.md.
See CHANGELOG.md for release history.
Track upcoming directions in ROADMAP.md.
If this project makes your agent-generated Git history easier to review, consider starring it—it helps other developers discover the tool.
License
MIT © Ayush Singh
Available Tools
4 toolscommit_stageCommit the next stageADestructive
Test, size-check, stage, and commit only the next declared plan stage.
Inputs: stage (required), message (required), files, dryRun, +2 more.
finish_taskFinish a taskAIdempotent
Mark a complete, clean task plan as finished.
Inputs: no named parameters.
plan_taskPlan a taskA
Create an ordered 2-4 stage commit plan from a clean Git worktree.
Inputs: stages (required), description (required).
task_statusRead task statusARead-onlyIdempotent
Read the active plan, completed commits, and next stage.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a unique, non-overlapping role: plan creation, stage execution, status inspection, and task completion. No ambiguity in purpose.
All tool names follow the consistent verb_noun pattern (plan_task, commit_stage, task_status, finish_task), making the API predictable.
4 tools provide a focused, well-scoped workflow for commit discipline without unnecessary bloat or missing essentials.
The toolset covers the full lifecycle: create plan, execute stages, check status, and finish. No obvious gaps in the workflow.
Maintenance
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
MCP server for generating rough-draft project plans from natural-language prompts.
Related MCP Servers
- AlicenseBqualityBmaintenanceMCP server that integrates DevFlow with AI code assistants to enforce structured development workflows including planning, task tracking, and code review gates.6515 npm1MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enforces development discipline and workflow best practices, guiding users through a structured process of coding, testing, documenting, committing, and releasing.28 npm1MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that adds engineering discipline to AI-assisted development, enforcing evidence-gated TDD, security review, backup strategy, and deployment generation to turn AI-generated code into production-ready software.5 npm11MIT
- AlicenseAqualityFmaintenanceAn MCP server that enforces safe git commits by allowing only specified files and providing fixup capabilities for earlier commits.21MIT