Git Auto Commit MCP Server

Git Auto Commit MCP Server

Analyzes git changes in repositories and generates conventional commit messages using OpenAI's GPT models, supporting both staged and unstaged changes with detailed summaries.

jatinsandilya

Version Control
Developer Tools
Visit Server

Tools

git-changes-commit-message

Analyzes current git changes and provides a commit message

README

MCP Server to Auto commit changes 🛠️

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

<a href="https://glama.ai/mcp/servers/xm2dqoc1s6"> <img width="380" height="200" src="https://glama.ai/mcp/servers/xm2dqoc1s6/badge" alt="Git Auto Commit Server MCP server" /> </a>

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Gitingest-MCP

Gitingest-MCP

An MCP server for gitingest. It allows MCP clients like Claude Desktop, Cursor, Cline etc to quickly extract information about Github repositories including repository summaries, project directory structure, file contents, etc

Featured
Local
Python
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript