git-commit-message-mcp
Provides tools to retrieve git diffs and change metadata from the working directory or between branches/commits, enabling AI-generated commit messages based on repository changes.
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., "@git-commit-message-mcp generate a commit message for my current changes"
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.
git-commit-message-mcp
AI-powered git commit message generator using Model Context Protocol (MCP).
Features
🤖 Generate commit messages using AI
🔀 Support for branch comparison
📝 Customizable prompt templates
🌍 Multi-language support (Chinese/English)
⚙️ Flexible configuration (project-level and global)
Related MCP server: MCP Git Commit Generator
Built-in Prompts
The package includes 4 built-in prompt templates you can use out-of-the-box:
Prompt Name | Description | Language | Use Case |
default | Default Conventional Commits style | Chinese | General use, Chinese teams |
conventional | Standard Conventional Commits | English | Open source, English projects |
simple | Concise one-line messages | Any | Quick commits, simple changes |
detailed | Comprehensive What/Why/How format | Any | Complex features, detailed documentation |
Location: These prompts are in the prompts/ directory of the npm package.
How to Use Built-in Prompts
In conversation:
"Generate commit message" → Uses
default"Use conventional prompt" → Uses
conventional"Use simple prompt" → Uses
simple"Use detailed prompt" → Uses
detailed
Set as default via MCP config:
{
"mcpServers": {
"git-commit-message-mcp": {
"command": "npx",
"args": ["-y", "git-commit-message-mcp"],
"env": {
"DEFAULT_PROMPT_FILE": "conventional"
}
}
}
}Now "Generate commit message" uses conventional instead of default!
Set as default via config file:
{
"defaultPromptFile": "simple"
}Installation
npm install
npm run buildQuick Start
1. Configure MCP Server
Add to your Claude Desktop or Claude Code MCP configuration:
{
"mcpServers": {
"git-commit-message-mcp": {
"command": "node",
"args": ["/absolute/path/to/git-commit-message-mcp/dist/index.js"]
}
}
}For Claude Desktop, the config file is at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
For Claude Code:
Use the MCP settings in your IDE
2. Use in Conversation
Scenario 1: Generate commit message for working directory
User: "Generate commit message"
AI: [Calls git_diff() → generate_commit_message_prompt() → Returns suggested commit message]Scenario 2: Compare with a branch
User: "Compare with development branch and generate commit message"
AI: [Calls git_diff({compare: "development"}) → Returns commit message]Scenario 3: Compare two branches
User: "Compare featureA with development branch, generate commit message"
AI: [Calls git_diff({base: "development", compare: "featureA"}) → Returns commit message]Configuration
MCP Configuration (Recommended)
Configure via environment variables in your MCP server config:
{
"mcpServers": {
"git-commit-message-mcp": {
"command": "npx",
"args": ["-y", "git-commit-message-mcp"],
"env": {
"PROMPTS_DIR": "./.cursor/mcp/git-commit-message-mcp-prompts",
"DEFAULT_PROMPT_FILE": "conventional",
"MAX_DIFF_LENGTH": "3000"
}
}
}
}Supported Environment Variables:
Variable | Description | Example | Default |
| User prompts directory |
| None |
| Default prompt to use |
|
|
| Maximum diff length |
|
|
Note: You can also use GCM_* prefix (e.g., GCM_PROMPTS_DIR) to avoid conflicts.
Project-Level Configuration
Create .git-commit-msg.json in your project root:
{
"promptsDir": "./.cursor/mcp/git-commit-message-mcp-prompts",
"defaultPromptFile": "conventional",
"maxDiffLength": 3000
}This file can be committed to version control for team-wide sharing.
Global Configuration
Create ~/.config/git-commit-msg/config.json:
{
"promptsDir": "~/.config/git-commit-msg/prompts",
"defaultPromptFile": "simple"
}Configuration Priority
Environment Variables (MCP config) - Highest
Project Config File (
.git-commit-msg.json)Global Config File (
~/.config/git-commit-msg/config.json)Built-in Defaults - Lowest
Custom Prompt Templates
Creating Custom Prompts
Set up prompts directory:
mkdir -p .cursor/mcp/git-commit-message-mcp-promptsCreate custom prompts (e.g.,
a.md,b.md):
# My Custom Prompt
Generate a commit message with Jira ticket.
Format: [PROJ-123] type: description
## Code Changes
Stats: {stats}
Files: {files}
Diff: {diff}
Generate commit message:Configure (via MCP env or config file):
MCP Config:
{
"env": {
"PROMPTS_DIR": "./.cursor/mcp/git-commit-message-mcp-prompts"
}
}Or .git-commit-msg.json:
{
"promptsDir": "./.cursor/mcp/git-commit-message-mcp-prompts"
}Using Prompts in AI Chat
"Generate commit message" → Uses default.md
"Use conventional prompt for this commit" → Uses conventional.md
"Use prompt a to compare featureA with main" → Uses a.md
"What prompts are available?" → Lists all promptsSupported Placeholders
{diff}- Full git diff output{stats}- Change statistics (e.g., "3 files changed, 45 insertions(+)"){files}- List of changed files{summary}- Summary of changes
For detailed documentation, see PROMPT_SYSTEM.md.
MCP Tools
git_diff
Get git diff showing code changes.
Parameters:
base(optional): Base branch or commitcompare(optional): Branch or commit to compare
Examples:
// Working directory vs HEAD
git_diff()
// development vs HEAD
git_diff({ compare: "development" })
// featureA vs development
git_diff({ base: "development", compare: "featureA" })list_prompts
List all available commit message prompts (both built-in and user-defined).
Parameters: None
Returns:
{
"prompts": [
{ "name": "default", "source": "builtin" },
{ "name": "conventional", "source": "builtin" },
{ "name": "a", "source": "user" },
{ "name": "b", "source": "user" }
]
}generate_commit_message_prompt
Generate AI prompt for commit message.
Parameters:
diff(required): Git diff contentstats(optional): Git diff statsfiles(optional): List of changed filespromptName(optional): Prompt name (e.g., "conventional", "a") or file path
Examples:
// Use default prompt
generate_commit_message_prompt({ diff: "..." })
// Use specific prompt by name
generate_commit_message_prompt({ diff: "...", promptName: "conventional" })
// Use custom prompt
generate_commit_message_prompt({ diff: "...", promptName: "a" })Examples
See the prompts/ directory for example prompt templates:
default.md- Default prompt with Conventional Commits formatconventional.md- Conventional Commits style (English)simple.md- Simple one-line styledetailed.md- Detailed What/Why/How style
You can use these as templates for creating your own custom prompts.
For comprehensive documentation on the prompt system, see PROMPT_SYSTEM.md.
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run watchLicense
MIT
Available Tools
3 toolsgenerate_commit_message_promptB
Generate AI prompt for commit message based on diff.
Supports custom prompts:
Use promptName to specify a prompt (e.g., "conventional", "simple", "a", "b")
Prompts are loaded from: user prompts directory > built-in prompts
If no promptName specified, uses default.md
Inputs: diff (required), files, stats, promptName.
git_diffA
Get git diff showing code changes.
Usage:
No params: working directory changes vs HEAD
compare="branch": HEAD vs branch
base="dev", compare="feature": feature vs dev (shows changes in feature relative to dev)
Inputs: base, compare.
list_promptsA
List all available commit message prompts (both built-in and user-defined)
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 3 tools
Each tool has a distinct role: git_diff retrieves changes, list_prompts enumerates available prompt templates, and generate_commit_message_prompt builds the AI prompt from the diff. The two prompt-related tools are cleanly separated by action (list vs. generate), and the descriptions make the workflow order obvious.
All names use snake_case and two follow a verb_noun pattern (list_prompts, generate_commit_message_prompt). git_diff deviates slightly by using a noun_noun 'git_' prefix rather than a verb, but it remains readable and unambiguous.
Three tools is a tight, purpose-fit surface for a commit-message helper: fetch diff, discover prompts, produce prompt. No tool feels redundant or padded, and nothing obviously missing at this scope.
The diff-to-prompt lifecycle is covered end to end, but the surface stops at prompt generation — there is no tool to actually produce or apply a commit message, nor to inspect or manage individual custom prompts beyond naming them. These are minor, workable gaps given the deliberately narrow scope.
Maintenance
Related MCP Connectors
Generate changelogs, release emails, help-center articles, banners, and social posts from commits.
Plain-English git for agents: 22 tools to branch, commit, push and tag. Free tier.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAnalyzes git changes in repositories and generates conventional commit messages using OpenAI's GPT models, supporting both staged and unstaged changes with detailed summaries.15MIT
- AlicenseBqualityBmaintenanceAutomatically generates conventional commit messages from staged git changes and checks repository status. Analyzes git diffs to create properly formatted commit messages following conventional commit standards.29MIT
- AlicenseAqualityDmaintenanceGenerates commit messages, PR titles and descriptions, and release notes from git changes, with automatic domain detection for appropriate PR templates.1017 npm1MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to create conventional Git commits, update changelogs, and optionally push changes to remote repositories.22MIT