G

Git文件分析工具

@davidorex/git-file-forensics
1 Stars 1.0k 次浏览 davidorex 更新于 2026-08-23

提供了深入的Git文件级法医工具,用于分析Git仓库中详细的文件历史、变更和模式,重点是个别文件分析而非整个仓库的操作。

该服务暂未提供标准配置,请参考 README 手动接入

可用工具 (4 个)

该服务在 MCP 协议中暴露的工具,AI 可按需调用

track_file_versions 3 个参数 需填 3 项

Track complete version history of a specific file, including renames and moves

必填参数:repoPath、file、outputPath

analyze_file_diff 4 个参数 需填 4 项

Analyze specific changes between any two versions of a file

必填参数:repoPath、file、versions、outputPath

analyze_file_context 4 个参数 需填 4 项

Analyze broader context of file changes in a specific commit

必填参数:repoPath、file、commit、outputPath

analyze_file_semantics 3 个参数 需填 3 项

Analyze semantic changes and patterns in file history

必填参数:repoPath、file、outputPath

服务介绍

Git 文件取证 MCP

一个用于深入 Git 文件级别取证的MCP工具,帮助获取文件历史、变更和模式的详细见解,专注于单个文件分析而不是整个仓库的操作。

安装

  1. 克隆并构建服务器:
git clone [repository-url]
cd git-file-forensics
npm install
npm run build
  1. 添加到您的MCP设置中(~/Library/Application Support/Code/User/globalStorage/david-dafu-dev.dafu/settings/cline_mcp_settings.json):
{
  "mcpServers": {
    "git-file-forensics": {
      "command": "/opt/homebrew/bin/node",
      "args": ["/path/to/git-file-forensics/build/index.js"],
      "alwaysAllow": []
    }
  }
}

可用工具

1. track_file_versions

跟踪特定文件的完整版本历史记录,包括重命名和移动。

{
  "method": "tools/call",
  "params": {
    "name": "track_file_versions",
    "arguments": {
      "repoPath": "/path/to/repo",
      "file": "path/to/file",
      "outputPath": "output.json"
    }
  }
}

2. analyze_file_diff

分析文件任意两个版本之间的具体变更。

{
  "method": "tools/call",
  "params": {
    "name": "analyze_file_diff",
    "arguments": {
      "repoPath": "/path/to/repo",
      "file": "path/to/file",
      "versions": {
        "from": "commit-hash-1",
        "to": "commit-hash-2"
      },
      "outputPath": "output.json"
    }
  }
}

3. analyze_file_context

分析特定提交中文件变更的更广泛上下文。

{
  "method": "tools/call",
  "params": {
    "name": "analyze_file_context",
    "arguments": {
      "repoPath": "/path/to/repo",
      "file": "path/to/file",
      "commit": "commit-hash",
      "outputPath": "output.json"
    }
  }
}

4. analyze_file_semantics

分析文件历史中的语义变更和模式。

{
  "method": "tools/call",
  "params": {
    "name": "analyze_file_semantics",
    "arguments": {
      "repoPath": "/path/to/repo",
      "file": "path/to/file",
      "outputPath": "output.json"
    }
  }
}

输出格式

所有工具输出包含以下内容的JSON文件:

  • 详细的分析结果
  • 摘要统计
  • 变更模式和关系
  • 风险评估(如适用)

要求

  • Node.js
  • Git(必须安装且可访问)
  • MCP SDK

许可证

本项目根据Apache许可证2.0版许可 - 有关详细信息,请参阅LICENSE.txt文件。

版权所有 davidorex.ai。根据Apache许可证2.0版许可;除非遵守该许可证,否则不得使用此项目。您可以在http://www.apache.org/licenses/LICENSE-2.0获得许可证副本。

相关 MCP 服务