Skip to main content
Glama

Git Auto Commit MCP Server

MCP 服务器自动提交变更🛠️

此实现提供了一个 Git 更改分析器,它使用 OpenAI 的 GPT 模型生成提交消息。

演示

特征

  • 分析存储库中的 git 更改(暂存和未暂存)
  • 使用 GPT-4o-mini 生成常规提交消息
  • 提供以下详细摘要:
    • 📝 修改的文件
    • ✨ 新添加的文件
    • 🗑️ 已删除的文件
    • 📄 详细更改(每个文件最多 10 行)
  • 使用@modelcontextprotocol/sdk构建
  • 为每个提交添加自动提交签名

项目结构

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

先决条件

  • Node.js 已安装
  • OpenAI API 密钥
  • 要分析的 Git 存储库
  • pnpm 包管理器

入门

  1. 克隆此存储库:
git clone https://github.com/jatinsandilya/mcp-server-auto-commit.git cd mcp-server-auto-commit
  1. 安装依赖项:
pnpm install
  1. 使用以下方法之一设置您的 OpenAI API 密钥:
    • 设置为环境变量: OPENAI_API_KEY=your-api-key
    • 作为命令行参数传递: --key your-api-key
    • 添加到项目根目录中的.env文件
  2. 构建项目:
pnpm run build

这将生成/build/index.js文件 - 已编译的 MCP 服务器脚本。

与游标一起使用

  1. 前往“光标设置”->“MCP”->“添加新的 MCP 服务器”
  2. 配置您的 MCP:
    • 名称:git-auto-commit
    • 类型:命令
    • 命令: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js --key your-api-key (如果环境中未设置,请将your-api-key替换为您的实际 OpenAI API 密钥)

与 Claude Desktop 一起使用

将以下 MCP 配置添加到您的 Claude Desktop 配置中:

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

可用工具

git 更改提交消息

此工具会分析存储库中当前的 git 更改,并使用 OpenAI 的 GPT-4o-mini 模型生成提交消息。它提供以下功能:

  • 带有状态指示器的已修改文件列表
  • 新添加的文件列表
  • 已删除文件列表
  • 每个文件的详细更改(为便于阅读,每个文件限制为 10 行)
  • 生成的提交消息遵循常规提交格式
  • 自动提交签名

使用参数:

  • autoCommitPath :用于分析特定目录/文件的可选路径。如果未提供,则使用当前工作目录。

发展

index.ts中的实现展示:

  1. 使用正确的配置设置 MCP 服务器
  2. 处理命令行参数和环境变量
  3. 使用 GPT-4o-mini 模型与 OpenAI 的 API 集成
  4. 使用子进程的 Git 操作
  5. 错误处理和回退机制
  6. 详细的变更分析和格式

要修改或扩展实施:

  1. 更新index.ts中的服务器配置:
const server = new McpServer({ name: "git-auto-commit", version: "0.0.1", });
  1. 该工具使用server.tool()定义,并使用 Zod 模式进行适当的参数验证。
  2. 构建并测试您的更改:
pnpm run build

贡献

请随时提交问题和增强请求!

执照

麻省理工学院

Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

分析存储库中的 git 更改并使用 OpenAI 的 GPT 模型生成常规提交消息,支持暂存和非暂存更改以及详细摘要。

  1. 演示
    1. 特征
      1. 项目结构
        1. 先决条件
          1. 入门
            1. 与游标一起使用
              1. 与 Claude Desktop 一起使用
                1. 可用工具
                  1. git 更改提交消息
                2. 发展
                  1. 贡献
                    1. 执照

                      Related MCP Servers

                      • A
                        security
                        F
                        license
                        A
                        quality
                        Generates comprehensive and formatted release notes from GitHub repositories, efficiently organizing commits by type and including detailed statistics using smart API usage.
                        Last updated -
                        2
                      • A
                        security
                        A
                        license
                        A
                        quality
                        A specialized MCP server for in-depth analysis of git repositories, offering tools for branch overview, time period analysis, file changes, and merge recommendations.
                        Last updated -
                        4
                        2
                        Apache 2.0
                      • A
                        security
                        A
                        license
                        A
                        quality
                        Provides comprehensive Git operations as tools for AI assistants and applications. This server enables AI systems to interact with Git repositories, allowing to initialize, fetch, commit, log, status, etc..
                        Last updated -
                        10
                        2
                        1
                        MIT License
                      • A
                        security
                        A
                        license
                        A
                        quality
                        Automatically 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.
                        Last updated -
                        2
                        8
                        MIT License
                        • Apple
                        • Linux

                      View all related MCP servers

                      MCP directory API

                      We provide all the information about MCP servers via our MCP API.

                      curl -X GET 'https://glama.ai/api/mcp/v1/servers/hypermodel-labs/mcp-server-auto-commit'

                      If you have feedback or need assistance with the MCP directory API, please join our Discord server