Git操作服务器

一个提供Git操作API的简易HTTP服务器,支持克隆、拉取、提交、推送、分支管理及PR创建等功能。

  • by toanil01
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 toanil01/mcp-git-server-python

使用说明

MCP-like Git Server (Python)

This project provides a minimal HTTP server exposing endpoints to perform common Git operations using GitPython and GitHub API for PR creation.

Install dependencies:

powershell -Command "python -m pip install -r requirements.txt"

Run server:

powershell -Command "env:PYTHONPATH='.'; uvicorn mcp_server:app --reload --host 127.0.0.1 --port 8000"

Endpoints:

  • POST /clone {repo_url, directory_name}
  • POST /pull (repo_path as form or query)
  • POST /fetch (repo_path)
  • POST /commit {repo_path, message, add_all}
  • POST /push (repo_path, remote_name='origin', branch=None)
  • POST /branch {repo_path, branch_name}
  • POST /pr {repo_owner, repo_name, head, base, title, body}
  • POST /diff {repo_path, base, head}
  • POST /merge {repo_path, source, target}

Notes:

  • This is a simple utility server, not production-ready. Use with care.