Back to MCP directory
publicPublicdnsLocal runtime

git-commit-aider

一个基于TypeScript的MCP服务器,用于在Git提交中自动标记AI贡献,通过添加'(aider)'后缀来区分AI生成的提交。

article

README

🚀 Git 提交助手 MCP 服务器

Git 提交助手 MCP 服务器能让 AI 代表您进行 Git 提交,方便跟踪代码库中的 AI 贡献。它基于 TypeScript 构建,提供了一个实用工具,可在 Git 仓库中提交已阶段化的更改,并自动在提交者姓名后追加“(aider)”。

🚀 快速开始

本服务器可让 AI 代表您进行 Git 提交,便于清晰跟踪代码库中的 AI 贡献。使用时,将其配置添加到您的 MCP 设置文件中即可开启使用。

✨ 主要特性

此 MCP 服务器仅提供一个工具:

  • commit_staged:使用特定消息提交已阶段化的更改。
    • 接受 message(字符串,必需)作为提交信息。
    • 接受 cwd(字符串,可选)来指定 Git 命令的当前工作目录。
    • 自动在提交者姓名后追加“(aider)”。
    • 从环境变量(GIT_COMMITTER_NAMEGIT_COMMITTER_EMAIL)读取提交者姓名和电子邮件,如果未设置,则回退到 git config user.namegit config user.email 的输出。

将此工具安装在您的代码编辑器中后,您可以提示 AI 做如下操作:

为我提交这些更改

这通常发生在 AI 已对您的代码库进行了一些修改之后,因此很多时候 AI 可以为您提供一个良好的提交消息。

带有“(aider)”的提交可以被 aider --stats 命令检测到,该命令将显示 AI 对您的代码库的贡献。

📦 安装指南

要使用此服务器,请将其配置添加到您的 MCP 设置文件中。

{
  "mcpServers": {
    "git-commit-aider": {
      "command": "npx",
      "args": ["mcp-git-commit-aider"]
    }
  }
}

提交者信息从以下位置获取:

  1. 遵循 Git 的约定 的环境变量 GIT_COMMITTER_NAMEGIT_COMMITTER_EMAIL
  2. git config user.namegit config user.email 命令的输出。

💻 使用示例

基础用法

在代码编辑器中安装该工具后,可提示 AI 进行提交操作,例如:

为我提交这些更改

高级用法

当 AI 对代码库进行修改后,它可能会提供合适的提交消息,此时使用 commit_staged 工具结合提交消息进行提交。

📚 详细文档

开发

安装依赖项

npm install

构建服务器

npm run build

带有自动重建功能的开发

npm run watch

示例 MCP 配置

{
  "mcpServers": {
    "git-commit-aider": {
      "command": "node",
      "args": [
        "/path/to/git-commit-aider/build/index.js"
      ]
    }
  }
}

(请将 /path/to/git-commit-aider 替换为此服务器的实际路径。)

调试

由于 MCP 服务器通过 stdio 进行通信,调试可能具有挑战性。我们推荐使用 MCP Inspector,它作为包脚本可用:

npm run inspector

Inspector 将提供一个访问调试工具的浏览器 URL。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client