Skip to main content
Glama
MCP Git Enhanced

MCP Git Enhanced

🦞 MCP Git Enhanced

Tests Coverage License

一个增强型 Git MCP(模型上下文协议)服务器,为 AI 助手提供强大的代码审查、提交分析和分支管理功能。

功能特性

  • 🔍 代码差异分析 - 比较提交、分支或工作目录的变更

  • 📊 提交历史分析 - 深入洞察提交模式和贡献者

  • 🌿 分支管理 - 列出、比较分支并提供清理建议

  • 📈 仓库状态 - 全面的工作目录概览

  • 🔎 提交分析 - 详细的单次提交检查

Related MCP server: pr-mcp-server

安装

从 npm 安装(发布后)

npm install -g @bountyclaw/mcp-git-enhanced

从源码安装

git clone https://github.com/bountyclaw/mcp-git-enhanced.git
cd mcp-git-enhanced
npm install
npm run build

与 Claude Code 配合使用

添加到您的 Claude Code 配置文件 (~/.claude/settings.json) 中:

{
  "mcpServers": {
    "git-enhanced": {
      "command": "npx",
      "args": ["@bountyclaw/mcp-git-enhanced"]
    }
  }
}

或者用于本地开发:

{
  "mcpServers": {
    "git-enhanced": {
      "command": "node",
      "args": ["/path/to/mcp-git-enhanced/dist/index.js"]
    }
  }
}

可用工具

git_diff

分析提交、分支或工作目录之间的代码变更。

{
  "repoPath": "/absolute/path/to/repo",
  "target": "HEAD~5",
  "source": "HEAD~10",
  "filePath": "src/",
  "staged": false
}

git_log

通过过滤和统计信息分析提交历史。

{
  "repoPath": "/absolute/path/to/repo",
  "maxCount": 20,
  "author": "John Doe",
  "since": "1 week ago",
  "stat": true
}

git_branch

管理和分析 git 分支。

{
  "repoPath": "/absolute/path/to/repo",
  "action": "list|compare|suggest_cleanup",
  "includeRemote": true
}

git_status

获取全面的仓库状态。

{
  "repoPath": "/absolute/path/to/repo",
  "short": false
}

git_commit_analyze

详细分析特定的提交。

{
  "repoPath": "/absolute/path/to/repo",
  "commitHash": "abc123"
}

使用案例示例

代码审查

"Show me the diff between main and the feature branch"
"What files changed in the last 5 commits?"
"Analyze the impact of commit abc123"

仓库健康状况

"List all branches that can be safely deleted"
"Show me commits from the last week"
"Who are the top contributors to this project?"

工作目录

"What's the current status of my repo?"
"Show me the staged changes"
"What files have uncommitted changes?"

开发

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Test locally
node dist/index.js

测试

本项目使用 Jest 进行测试,涵盖了所有 Git 工具处理程序的全面覆盖。

# Run all tests
npm test

# Run tests with coverage report
npm run test:coverage

# Run tests in watch mode
npm run test:watch

覆盖率报告

文件

语句

分支

函数

行

tools.ts

98%+

95%+

100%

98%+

测试结构

  • src/__tests__/tools.test.ts - 所有 5 个 Git 工具处理程序的单元测试

    • git_diff - 7 个测试用例

    • git_log - 13 个测试用例

    • git_branch - 10 个测试用例(列出、比较、建议清理)

    • git_status - 5 个测试用例

    • git_commit_analyze - 4 个测试用例

代码质量

# Run ESLint
npm run lint

# Fix ESLint issues
npm run lint:fix

# Format with Prettier
npm run format

# Check formatting
npm run format:check

要求

  • Node.js >= 18.0.0

  • 已安装 Git 并可在 PATH 中访问

许可证

MIT

贡献

欢迎贡献!请阅读 CONTRIBUTING.md 了解详情。


由 BountyClaw 倾力打造 🦞

Available Tools

5 tools
git_branchB

Manage and analyze git branches. Provides branch listing, comparison, and management suggestions.

Inputs: repoPath (required), action (required), branchName, baseBranch, +1 more.

git_commit_analyzeB

Analyze a specific commit in detail including changed files, statistics, and impact.

Inputs: repoPath (required), commitHash.

git_diffB

Analyze code changes between commits, branches, or working directory. Provides detailed diff analysis with statistics and file categorization.

Inputs: repoPath (required), target, source, filePath, +1 more.

git_logC

Analyze commit history with filtering and statistics. Provides insights into commit patterns, contributors, and code evolution.

Inputs: repoPath (required), maxCount, author, since, +5 more.

git_statusC

Get comprehensive repository status including staged, unstaged, and untracked files.

Inputs: repoPath (required), short.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct aspect of git: branches, commits, diffs, log history, and repository status. No functional overlap exists.

    Naming Consistency4/5

    All tools follow 'git_' prefix with descriptive nouns, but 'git_commit_analyze' deviates slightly from the single-noun pattern of the others.

    Tool Count5/5

    Five tools cover essential analysis operations without being excessive or insufficient for the server's stated analytical focus.

    Completeness3/5

    Tools provide broad analysis coverage but lack creation or modification operations (e.g., no commit creation, branch creation beyond suggestions), leaving notable gaps for full git workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      The Git MCP Server allows AI assistants to perform enhanced Git operations via the Model Context Protocol, supporting core Git functions, branch and tag management, GitHub integration, and more.
      21
      6
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.
      1
      Apache 2.0
    • A
      license
      D
      quality
      D
      maintenance
      MCP server for managing Git reference repositories, enabling AI assistants to add, load, and sync reference code from any Git repository.
      12
      8 npm
      MIT