返回 MCP 目录
public公开dns本地运行

Git File Forensics

Git文件取证分析工具,专注于单个文件的历史追踪、差异分析和语义模式检测

article

README

🚀 Git 文件取证 MCP 工具

Git 文件取证 MCP 工具是一款专注于单个文件分析的取证工具,可深入分析 git 文件层级。它能帮助用户获取文件历史、变更和模式的详细洞察,而非针对整个仓库进行分析。

🚀 快速开始

本工具可帮助您深入分析 git 文件层级,获取文件历史、变更和模式的详细信息。下面为您介绍使用前的安装步骤。

📦 安装指南

克隆代码库并构建

git clone [repository-url]
cd git-file-forensics
npm install
npm run build

配置 MCP 设置

将以下配置添加到 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 License 2.0 协议,源代码和详细信息可通过以下链接获取:

[版权声明信息]

此工具旨在为开发者提供强大的文件历史分析能力,帮助识别和理解代码变更模式。

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端