Git MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides core Git operations such as init, clone, status, add, commit, push, pull, as well as branch management, tag operations, remote management, and stash operations

  • Offers GitHub integration via Personal Access Token to perform Git operations specifically with GitHub repositories

Git MCP 服务器

模型上下文协议 (MCP) 服务器,通过标准化接口提供增强的 Git 操作。该服务器与 MCP 生态系统集成,为 AI 助手提供 Git 功能。

特征

  • 核心 Git 操作:初始化、克隆、状态、添加、提交、推送、拉取
  • 分支管理:列出、创建、删除、结帐
  • 标签操作:列出、创建、删除
  • 远程管理:列出、添加、删除
  • 存储操作:列出、保存、弹出
  • 批量操作:按顺序执行多个 Git 操作
  • GitHub 集成:通过个人访问令牌内置 GitHub 支持
  • 路径解析:具有可选默认路径配置的智能路径处理
  • 错误处理:使用自定义错误类型进行全面的错误处理
  • 存储库缓存:高效的存储库状态管理
  • 性能监控:内置性能跟踪

安装

  1. 克隆存储库:
git clone https://github.com/yourusername/git-mcp-v2.git cd git-mcp-v2
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build

配置

添加到您的 MCP 设置文件:

{ "mcpServers": { "git-v2": { "command": "node", "args": ["path/to/git-mcp-v2/build/index.js"], "env": { "GIT_DEFAULT_PATH": "/path/to/default/git/directory", "GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-pat" } } } }

环境变量

  • GIT_DEFAULT_PATH :(可选)Git 操作的默认路径
  • GITHUB_PERSONAL_ACCESS_TOKEN :(可选)用于 GitHub 操作的 GitHub 个人访问令牌

可用工具

基本操作

  • init :初始化一个新的 Git 存储库
  • clone :克隆存储库
  • status :获取存储库状态
  • add :阶段文件
  • commit :创建提交
  • push :将提交推送到远程
  • pull :从远程拉取更改

分支机构运营

  • branch_list :列出所有分支
  • branch_create :创建一个新分支
  • branch_delete :删除分支
  • checkout :切换分支或恢复工作树文件

标签操作

  • tag_list :列出标签
  • tag_create :创建标签
  • tag_delete :删除标签

远程操作

  • remote_list :列出遥控器
  • remote_add :添加远程
  • remote_remove :删除远程

存储操作

  • stash_list :列出存储
  • stash_save :将更改保存到存储区
  • stash_pop :应用和删除存储

批量操作

  • bulk_action :按顺序执行多个 Git 操作

发展

# Run tests npm test # Run tests with coverage npm run test:coverage # Run linter npm run lint # Format code npm run format

执照

麻省理工学院

贡献

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Git MCP 服务器允许 AI 助手通过模型上下文协议执行增强的 Git 操作,支持核心 Git 功能、分支和标签管理、GitHub 集成等。

  1. Features
    1. Installation
      1. Configuration
        1. Environment Variables
          1. Available Tools
            1. Basic Operations
            2. Branch Operations
            3. Tag Operations
            4. Remote Operations
            5. Stash Operations
            6. Bulk Operations
          2. Development
            1. License
              1. Contributing
                ID: 46aozzlyhx