Back to MCP directory
publicPublicdnsLocal runtime

Git Repo Browser

一个基于Node.js的Git仓库浏览器,通过MCP协议提供服务

article

README

🚀 MCP Git 仓库浏览器(Node.js)

MCP Git 仓库浏览器是一个基于 Node.js 实现的工具,借助 Model Context Protocol (MCP),可帮助用户轻松浏览 Git 仓库。

🚀 快速开始

若要使用 MCP Git 仓库浏览器,你需要先完成配置和安装,再启动服务器。以下是具体步骤:

配置

将以下内容添加到您的 MCP 设置配置文件中:

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

安装

git clone <repository-url>
cd mcp-git-repo-browser
npm install

启动服务器

node src/index.js

该服务器通过标准输入输出运行,使其与 MCP 客户端兼容。

✨ 主要特性

该服务器提供两个主要工具:

  1. git_directory_structure:返回仓库目录结构的树状表示
    • 输入:仓库 URL
    • 输出:ASCII 树状表示,显示仓库目录结构
  2. git_read_important_files:读取并返回指定文件的内容
    • 输入:仓库 URL 和文件路径列表
    • 输出:文件路径到内容的字典映射

🔧 技术细节

  • 使用 Node.js 原生模块(crypto、path、os)实现核心功能
  • 利用 fs-extra 进行增强型文件操作
  • 采用 simple-git 进行 Git 仓库操作
  • 实现了干净的错误处理和资源清理
  • 根据仓库 URL 的哈希创建确定性临时目录
  • 在可能的情况下重用已克隆的仓库以提高效率

📄 许可证

本项目采用 MIT License,详见 LICENSE 文件获取详细信息。

📦 安装要求

  • Node.js 14.x 或更高版本
  • 系统上安装 Git
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client