Back to MCP directory
publicPublicdnsLocal runtime

Git Repository Browser

一个基于Node.js和MCP协议的Git仓库浏览器工具,提供仓库结构查看、文件读取、代码搜索、分支对比、提交历史查询等功能

article

README

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

MCP Git 仓库浏览器是一个基于 Node.js 的工具,借助模型上下文协议 (MCP),可实现对 Git 仓库的便捷浏览与操作。

GitHub 仓库 npm 包

🚀 快速开始

安装完成后,在终端中运行:

git-commands-mcp --help

即可查看所有可用命令和选项。

✨ 主要特性

该服务器提供以下工具:

基本仓库操作

  1. git_directory_structure:返回仓库目录结构的树状表示

    • 输入:仓库 URL
    • 输出:ASCII 树状表示的仓库结构
  2. git_read_files:读取并返回指定文件的内容

    • 输入:仓库 URL 和文件路径列表
    • 输出:文件路径到内容的字典映射
  3. git_search_code:在仓库代码中搜索

    • 输入:仓库 URL、搜索词和可选参数(如大小限制)
    • 输出:匹配文件的内容列表

项目结构

- src/
  - index.js:入口点
  - utils/
    - gitOperations.js:Git 操作工具
  - config/
    - settings.json:默认配置

📦 安装指南

通过 npm(推荐)

npm install -g git-commands-mcp

手动安装

git clone https://github.com/bsreeram08/git-commands-mcp.git
cd git-commands-mcp
npm install

📚 详细文档

配置

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

{
  "mcpServers": {
    "git-commands-mcp": {
      "command": "git-commands-mcp"
    }
  }
}

对于手动安装,请使用:

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

🔧 技术细节

  • 使用 Node.js 构建,提供高效的仓库操作
  • 支持多平台兼容性
  • 提供详细的错误处理和日志记录

需求

  • Node.js v14 或更高版本
  • Git 2.0 或更高版本
  • npm v6 或更高版本

📄 许可证

MIT License - 请参阅 LICENSE 文件了解详细信息。

🔗 链接

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