Token导航 LogoToken导航TokenDH.com
Git Time Machine logo
AI代理stdio官方级别未说明来源级核验

Git Time Machine

MCP Server

一个基于Rust的MCP服务器,为AI助手如GitHub Copilot提供Git历史分析功能,包括代码溯源、提交时间线探索和差异上下文提供。

工具数

5

提示词数

0

GitHub Stars

4

资源数

0
RustAI代理工作流自动化

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

hrirkslab

提供方

hrirkslab

最后核验

2026/5/17 20:20

运行时

Docker

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

docker run -p 3000:3000 -v $(pwd):/workspace git-time-machine

详细介绍

🕰️ Git时间机器

一个基于Rust的MCP(模型上下文协议)服务器,为GitHub Copilot等AI助手提供git历史见解。此服务器公开了允许LLM推理代码库演变的工具和上下文提供程序。

特性

  • 有责任意识的代码分析:暴露 git blame 对于任何文件
  • 提交时间线探索:查询提交了一个文件
  • Diff上下文提供程序:暴露任何提交的上下文差异
  • 交互式Git元数据:访问作者信息、时间戳、提交消息
  • 由Rust+MCP提供技术支持:使用 axum, tokio,以及 serde

API终点

端点描述
POST /tools/get_git_blame逐行返回非责任元数据
POST /tools/get_commit_diff显示与元数据的完全差异
POST /tools/summarize_diff描述提交之间的更改
POST /tools/get_commits_affecting列出修改文件的提交
POST /tools/get_file_at_commit返回过去提交时的文件内容
GET /metadata返回MCP元数据
GET /.well-known/ai-plugin.json返回AI集成的插件清单
GET /openapi.json返回OpenAPI架构

安装

选项1:从Crates.io安装(推荐)

cargo install git-time-machine
git-time-machine

选项2:从源代码安装

先决条件

  • Rust(最新稳定版本)
  • Git

设置

# Clone the repository
git clone https://github.com/hrirkslab/git-time-machine.git
cd git-time-machine

# Build the project
cargo build --release

# Run the server
cargo run --release

选项3:使用Docker

# Build Docker image
docker build -t git-time-machine .

# Run container
docker run -p 3000:3000 -v $(pwd):/workspace git-time-machine

服务器将于启动 http://localhost:3000.

用法

使用GitHub Copilot

Git Time Machine通过MCP协议与GitHub Copilot兼容。使用Copilot时,您可以:

  1. 询问有关代码历史的问题
  2. 深入了解何时引入了bug
  3. 了解代码随时间的演变

示例提示:

  • “上次修改此功能的是谁?”
  • “上周这个文件有什么变化?”
  • “显示此文件的历史记录。”

API直接访问

您还可以直接访问API端点:

# Example: Get blame for a file
curl -X POST -H "Content-Type: application/json" \
  -d '{"file": "src/main.rs"}' \
  http://localhost:3000/tools/get_git_blame

GitHub复制集成

Git Time Machine通过 .copilot 配置目录。这允许Copilot使用Git Time Machine作为工具提供者来回答有关代码历史的问题。

设置

  1. 确保Git Time Machine服务器正在运行:
   cargo run --release
  1. .copilot/settings.json file将服务器注册为GitHub Copilot的工具提供者:
   {
     "tool_providers": [
       {
         "name": "git-time-machine",
         "url": "http://localhost:3000",
         "enabled": true
       }
     ]
   }
  1. 如果您使用的是GitHub Copilot CLI或Copilot Workspace,它将自动检测工具提供程序配置。

使用Copilot

配置后,您可以向Copilot询问有关代码历史的问题,例如:

  • “上次修改身份验证功能的是谁?”
  • “这个bug是什么时候引入的?”
  • “这个文件在过去一个月里是如何演变的?”
  • “提交abc123的主要变化是什么?”
  • “显示重构前此文件的外观”

Copilot将使用Git Time Machine工具根据您的存储库历史提供有见地的答案。

发展

项目结构

src/
  main.rs              # Server setup and routing
  handlers/            # HTTP endpoint handlers
    mod.rs
    blame.rs           # Git blame handlers
    commits.rs         # Commit history handlers
    diff.rs            # Diff generation handlers
    metadata.rs        # MCP metadata handlers
  models/              # Data models
    mod.rs
    tool_schema.rs     # API request/response schemas
    git.rs             # Git-related models
  utils/               # Utility functions
    mod.rs
    git_helpers.rs     # Git interaction utilities

贡献

  1. 分叉存储库
  2. 创建要素分支: git checkout -b feature-name
  3. 提交您的更改: git commit -am 'Add some feature'
  4. 推到分支: git push origin feature-name
  5. 提交拉取请求

许可证

麻省理工学院

目录标签

目录标签

RustAI代理工作流自动化Git分析本地部署代码历史AI辅助开发Rust服务器MCP协议

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Docker

工具数量(toolCount,工具数)

5

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP