Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-server-auto-commit

MCP.Pizza Chef: jatinsandilya

mcp-server-auto-commit is an MCP server that analyzes Git repository changes and automatically generates conventional commit messages using GPT models like GPT-4o-mini. It supports both staged and unstaged changes, summarizes modified, added, and deleted files, and includes detailed change previews. This server streamlines Git workflows by automating commit message creation following the Conventional Commits specification, enhancing consistency and clarity in version control history.

Use This MCP server To

Automatically generate conventional commit messages for Git changes Summarize modified, added, and deleted files in a Git repo Preview detailed code changes before committing Auto-commit changes with AI-generated messages Integrate AI-powered commit message generation into CI/CD pipelines Ensure consistent commit message formatting across teams

README

MCP Server to Auto commit changes 🛠️

This implementation provides a Git changes analyzer that generates commit messages using OpenAI's GPT models.

Git Auto Commit Server MCP server

Demo

Features

  • Analyzes git changes in your repository (both staged and unstaged)
  • Generates conventional commit messages using GPT-4o-mini
  • Provides detailed summaries of:
    • 📝 Modified files
    • ✨ Newly added files
    • 🗑️ Deleted files
    • 📄 Detailed changes (up to 10 lines per file)
  • Built with @modelcontextprotocol/sdk
  • Adds an auto-commit signature to each commit

Project Structure

mcp-server-auto-commit/
├── index.ts        # Main server implementation with git analysis tool
├── package.json    # Project dependencies
├── tsconfig.json   # TypeScript configuration
└── build/         # Compiled JavaScript output

Prerequisites

  • Node.js installed
  • OpenAI API key
  • Git repository to analyze
  • pnpm package manager

Getting Started

  1. Clone this repository:
git clone https://github.com/jatinsandilya/mcp-server-auto-commit.git
cd mcp-server-auto-commit
  1. Install dependencies:
pnpm install
  1. Set up your OpenAI API key using one of these methods:

    • Set as an environment variable: OPENAI_API_KEY=your-api-key
    • Pass as a command line argument: --key your-api-key
    • Add to a .env file in the project root
  2. Build the project:

pnpm run build

This will generate the /build/index.js file - your compiled MCP server script.

Using with Cursor

  1. Go to Cursor Settings -> MCP -> Add new MCP server
  2. Configure your MCP:
    • Name: git-auto-commit
    • Type: command
    • Command: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js --key your-api-key (Replace your-api-key with your actual OpenAI API key if not set in environment)

Using with Claude Desktop

Add the following MCP config to your Claude Desktop configuration:

{
  "mcpServers": {
    "git-auto-commit": {
      "command": "node",
      "args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js", "--key", "your-api-key"]
    }
  }
}

Available Tools

git-changes-commit-message

This tool analyzes the current git changes in your repository and generates a commit message using OpenAI's GPT-4o-mini model. It provides:

  • List of modified files with status indicators
  • List of newly added files
  • List of deleted files
  • Detailed changes for each file (limited to 10 lines per file for readability)
  • A generated commit message following conventional commits format
  • An auto-commit signature

Usage parameters:

  • autoCommitPath: Optional path to analyze specific directory/file. If not provided, uses current working directory.

Development

The implementation in index.ts showcases:

  1. Setting up the MCP server with proper configuration
  2. Handling command line arguments and environment variables
  3. Integrating with OpenAI's API using GPT-4o-mini model
  4. Git operations using child processes
  5. Error handling and fallback mechanisms
  6. Detailed change analysis and formatting

To modify or extend the implementation:

  1. Update the server configuration in index.ts:
const server = new McpServer({
  name: "git-auto-commit",
  version: "0.0.1",
});
  1. The tool is defined using server.tool() with proper parameter validation using Zod schema.

  2. Build and test your changes:

pnpm run build

Contributing

Feel free to submit issues and enhancement requests!

License

MIT

mcp-server-auto-commit FAQ

How does mcp-server-auto-commit generate commit messages?
It uses GPT models like GPT-4o-mini to analyze Git changes and create conventional commit messages automatically.
Can it handle both staged and unstaged changes?
Yes, it analyzes both staged and unstaged changes in your Git repository.
Does it follow any commit message standards?
Yes, it generates commit messages following the Conventional Commits specification (https://www.conventionalcommits.org/en/v1.0.0/).
Is the commit message generation customizable?
While the default uses GPT-4o-mini, you can customize the prompt or model integration depending on your setup.
Can this server be integrated into existing Git workflows?
Yes, it can be integrated into local or CI/CD Git workflows to automate commit message creation.
Does it provide summaries of file changes?
Yes, it summarizes modified, added, and deleted files and shows detailed changes up to 10 lines per file.
Is there an auto-commit signature added to commits?
Yes, each commit includes an auto-commit signature to indicate it was generated by this server.
What LLM providers does it support?
It primarily uses OpenAI's GPT models but can be adapted to work with other providers like Anthropic's Claude and Google Gemini.