Simplified MCP Server for AI-powered Commit Generation
CommitSmith is a Model Context Protocol (MCP) server that provides AI assistants with a single intelligent tool to generate high-quality conventional commit messages. Instead of generating commits itself, it empowers AI assistants like Claude to understand your code changes and craft perfect commit messages according to your preferences through natural language requests.
- True MCP Architecture: Provides tools for AI, doesn't replace AI
- Single Intelligent Tool: Natural language requests determine behavior automatically
- Smart Auto-Handling: Intelligently manages unstaged files with confirmation flow
- Streamlined: Focused on commit message generation without unnecessary complexity
- IDE Integration: Works with VS Code, vim, emacs, and any git-enabled editor
- Flexible Workflows: Interactive, prepare-for-review, or auto-commit modes
# Via npm
npm install -g commit-smith
# Via Docker
docker pull commitsmith/commit-smith
# From source
git clone https://github.com/commit-smith/commit-smith.git
cd commit-smith
pnpm install && pnpm build- Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"commit-smith": {
"command": "commit-smith",
"args": []
}
}
}- Stage your changes (optional - CommitSmith can handle unstaged files):
git add .- Ask Claude with natural language:
"Generate a short commit message for my changes"
Or for more complex requests:
"Create a detailed commit and commit it automatically"
Claude will automatically:
- Analyze your changes (staged and unstaged)
- Parse your natural language request to determine commit style
- Handle unstaged files intelligently (auto-stage or ask for confirmation)
- Generate a perfect conventional commit message
- Validate the message against conventional commit rules
- Prepare the message in .git/COMMIT_EDITMSG for review
- Optionally auto-commit when requested
"Generate a commit message for my changes""Create a short commit message""Make a detailed commit for my work"
"Generate a minimal commit message"(single line only)"Create a strict commit with proper validation"(enterprise-grade)"Make a descriptive commit with context"(detailed explanations)
"Generate a commit and commit it automatically""Create a short commit and commit it""Auto-commit my detailed changes"
"Generate a commit for my changes"(auto-stages unstaged files)"Create a commit without staging files"(asks for confirmation)
{
request: string, // Natural language description of desired commit
auto_commit?: boolean, // Whether to auto-commit (default: true)
auto_stage?: boolean // Whether to stage unstaged files (default: true)
}-
request(required): Natural language description of what you want- Examples:
"Generate a short commit message","Create a detailed commit and commit it" - The AI automatically determines commit style, auto-commit behavior, and staging preferences
- Examples:
-
auto_commit(optional, default:true): Whether to automatically commit after preparing the message- Set to
truefor fully automated workflows (default behavior) - Set to
falsefor manual review in your IDE
- Set to
-
auto_stage(optional, default:true): Whether to automatically stage unstaged files- Set to
trueto automatically include all unstaged changes - Set to
falseto get a confirmation request with file list
- Set to
The tool parses your request to automatically determine:
- Commit Style:
short,detailed,strict, ordefault - Auto-commit: Whether to commit automatically or prepare for review
- Auto-staging: Whether to stage unstaged files or ask for confirmation
- When
auto_stage: true: Automatically stages all unstaged files - When
auto_stage: false: Returns a confirmation request with the list of unstaged files - No staged changes: Returns an error if no changes are found
- Validates generated messages using conventional commit rules
- Prepares valid messages in
.git/COMMIT_EDITMSGfor IDE review - Provides detailed error messages for invalid commits
commit://agent-definition- Complete AI behavior promptcommit://presets- Available agent presets for different commit styles
User: "Generate a short commit message for my changes"
AI:
1. Analyzes staged and unstaged changes
2. Parses "short" request β uses minimal style
3. Generates single-line commit message
4. Validates against conventional commit rules
5. prepare_commit_message β ready for your review
6. "Message prepared in .git/COMMIT_EDITMSG - review in your IDE!"
User: "Create a detailed commit and commit it automatically"
AI:
1. Analyzes all changes
2. Parses "detailed" and "commit it" β uses descriptive style + auto_commit
3. Generates detailed commit message with body
4. Validates message
5. prepare_commit_message
6. commit_with_message β executes the commit
7. "Committed successfully: abc123"
User: "Generate a commit without staging files"
AI:
1. Detects unstaged files
2. Returns confirmation request:
{
"needs_confirmation": true,
"message": "Found 3 unstaged files. Please confirm if you want to stage them:",
"unstaged_files": ["file1.js", "file2.js", "file3.js"],
"suggestion": "You can call the commit tool again with auto_stage: true to automatically stage these files."
}
- AI generates message via
committool - Open Source Control panel
- Message is pre-filled in the commit message editor
- Edit if needed and click Commit
# After commit tool prepares message
git commit -e # Opens editor with pre-filled messageWorks with any IDE that reads .git/COMMIT_EDITMSG
User: "I made significant changes to the authentication system,
including JWT validation, refresh tokens, and error handling.
Create a strict commit and commit it automatically"
AI:
1. Parses "strict" β uses strict preset (enterprise-grade)
2. Parses "commit it automatically" β sets auto_commit: true
3. Generates detailed commit message with exactly 2-3 bullet points
4. Validates against strict rules
5. Auto-commits the changes
User: "Generate a commit message"
AI (if validation fails):
{
"success": false,
"validation_errors": [...],
"formatted_errors": "Subject must be under 50 characters",
"suggestion": "The generated commit message doesn't meet the validation requirements. Please try a different approach."
}
git clone https://github.com/commit-smith/commit-smith.git
cd commit-smith
pnpm installpnpm test # Run all tests
pnpm run test:watch # Watch mode
pnpm run test:coverage # Coverage reportpnpm build # Compile TypeScript
pnpm run dev # Development modeWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Built with the Model Context Protocol SDK
- Inspired by Conventional Commits
- Git operations powered by simple-git
- MCP Documentation
- Claude Desktop Setup
- Conventional Commits Specification
- Commitlint Configuration
- Issues & Feature Requests
Made with β€οΈ for developers who care about commit quality