MCP Git Ingest

MCP Git Ingest

MCP Git 仓库导入工具是一个基于模型上下文协议(MCP)的服务器,旨在帮助开发者读取 GitHub 仓库的结构和重要文件,提供目录结构和文件内容的获取功能。

105 浏览
2026-01-04 发布

详细介绍

MCP Git 仓库导入工具是一个基于模型上下文协议(MCP)的服务器,旨在帮助开发者读取 GitHub 仓库的结构和重要文件。该工具受 gitingest 启发,提供两个主要功能:获取仓库的目录结构和读取指定的重要文件内容。

核心功能

  • github_directory_structure:返回仓库的目录结构树状表示。
  • github_read_important_files:读取并返回指定文件的内容。
  • 支持并行处理多个仓库,提高处理效率。
  • 提供详细日志记录,增强调试能力。

安装方法

安装该工具需要 Python 3.8+ 环境,并依赖 gitpythonfastmcp

# 安装依赖
pip install gitpython fastmcp

# 克隆仓库并运行

git clone https://github.com/adhikarp/mcp-git-ingest.git
cd mcp-git-ingest
python3 src/main.py

配置信息

{
    "mcpServers": {
        "mcp-git-ingest": {
            "command": "uvx",
            "args": ["--from", "git+https://github.com/adhikasp/mcp-git-ingest", "mcp-git-ingest"]
        }
    }
}

使用方法

你可以使用 mcp-client-cli 来调用本工具。以下是使用示例:

$ llm read https://github.com/adhikasp/mcp-git-ingest 并确定代码如何工作

我将帮助你了解mcp-git-ingest仓库的技术细节。首先获取目录结构,然后读取重要文件以分析代码实现。

工具调用:
  github_directory_structure
  参数:
    repo_url: https://github.com/adhikasp/mcp-git-ingest

现在,我将读取重要文件以理解技术实现:

工具调用:
  github_read_important_files
  参数:
    repo_url: https://github.com/adhikarp/mcp-git-ingest
    file_paths: ["README.md", "pyproject.toml"]

技术实现

  • 使用 fastmcp 创建 MCP 服务器。
  • 使用 gitpython 进行 Git 仓库操作。
  • 关键函数包括 clone_repoget_directory_treegithub_directory_structuregithub_read_important_files
  • 支持错误处理和性能优化,如轻量级提交和垃圾回收。
MCP Git GitHub 仓库管理 Python

相关服务推荐

查看更多