Back to MCP directory
publicPublicdnsLocal runtime

local-git-mcp-server

一个基于Python和MCP协议的本地Git仓库管理服务器

article

README

🚀 本地 Git MCP 服务器

这是一个基于 Python 的 Git 仓库管理服务器,借助消息通信协议 (Message-based Communication Protocol) 服务器框架搭建,可高效管理本地 Git 仓库。

🚀 快速开始

运行服务器,可使用以下命令:

python git_server.py [--repositories-dir ./ repositories]

✨ 主要特性

  • 创建、管理和与本地 Git 仓库进行交互。
  • 对仓库名称进行验证。
  • 执行各类 Git 操作,具体如下:
    • 仓库创建
    • 添加文件
    • 提交更改
    • 拉取和推送
    • 差异生成

📦 安装指南

本项目依赖以下库:

  • GitPython
  • Pydantic
  • MCP Server
  • Black(代码格式化)
  • isort(导入排序)

请确保在运行项目前安装好这些依赖项。

💻 使用示例

基础用法

# 运行服务器
python git_server.py [--repositories-dir ./ repositories]

🔧 技术细节

  • 代码会自动使用 Black 和 isort 进行格式化。
  • 利用 GitHub Actions 工作流实现代码格式化。

📄 许可证

[如适用,请添加许可信息]

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