MCP GitHub Server
MCP GitHub Server
Erweiterbarer MCP HTTP-Server für die GitHub API mit modularer Architektur und automatischer Erkennung von Tools.
Funktionen
Der Server bietet 19 Tools für die Arbeit mit GitHub:
📁 Dateiverwaltung (4)
Tool | Beschreibung |
| Lesen des Dateiinhalts aus dem Repository |
| Erstellen und Aktualisieren von Textdateien |
| Erstellen und Aktualisieren von Binärdateien (base64) |
| Löschen von Dateien (SHA wird automatisch abgerufen) |
📝 Commits (2)
Tool | Beschreibung |
| Liste der letzten Commits |
| Status der Checks für einen Commit |
⚙️ Workflow (7)
Tool | Beschreibung |
| Fehler des letzten Builds |
| Logs eines bestimmten Workflow-Laufs |
| Vollständige Logs aller Jobs eines Laufs |
| Workflow-Läufe nach YAML-Dateinamen |
| Liste der Läufe mit run_id und Status |
| run_id des letzten Laufs |
| Liste aller Schritte in einem Lauf mit deren Status |
🏗️ Build und Debugging (6)
Tool | Beschreibung |
| Überwachung des Builds |
| Automatische Korrektur von Build-Fehlern (Android/iOS) |
| Detaillierter Fehler des Android-Builds |
| Detaillierter Fehler des iOS-Builds |
| Logs eines bestimmten Schritts nach Name |
| Erstellen/Aktualisieren mit automatischem Abruf der SHA |
Related MCP server: git-mcp
Installation
git clone https://github.com/LeonidYasin/mcp-server.git
cd mcp-server
pip install flask httpx python-dotenv flask-corsStart
python -m mcp_server.serverDer Server läuft auf http://0.0.0.0:3001, der MCP-Endpunkt ist POST /mcp.
Das GitHub-Token wird über den Header Authorization: Bearer <token> übergeben.
Verbindung zu DeepSeek++
In den Einstellungen des DeepSeek++-Plugins:
URL:
http://127.0.0.1:3001/mcpTyp: HTTP
Header:
Authorization: Bearer <ваш_github_token>
Projektstruktur
mcp-server/
├── pyproject.toml
├── README.md
└── mcp_server/
├── __init__.py
├── server.py # Flask HTTP-сервер
├── core/
│ ├── __init__.py
│ ├── tool.py # Tool dataclass
│ └── registry.py # ToolRegistry с авто-обнаружением
└── tools/
├── __init__.py
└── github/
├── __init__.py # Экспорт инструментов
├── client.py # GitHub API HTTP-клиент
├── file_ops.py # get_file_contents, create_or_update_file, delete_file
├── file_sha_ops.py # create_or_update_file_with_sha
├── create_update_binary.py # create_or_update_binary_file
├── commits.py # list_commits, get_commit_status
├── workflows.py # workflow-инструменты (4 шт)
├── workflow_runs.py # list_workflow_runs, get_latest_run_id, get_workflow_run_steps, get_run_logs_by_step
├── build_logs.py # watch_build
├── build_logs_loader.py # auto_fix_build, get_android_build_error, get_ios_build_error
└── build_logs_tools.py # вспомогательные функции для сборкиSo fügen Sie ein neues Tool hinzu
Schritt 1: Erstellen Sie eine Datei in mcp_server/tools/github/
Beispiel: mcp_server/tools/github/create_branch.py
"""MCP tool: create_branch - создаёт новую ветку."""
from mcp_server.core.registry import mcp_tool
from mcp_server.tools.github.client import GitHubClient
@mcp_tool(
name="create_branch",
description="Создаёт новую ветку в репозитории",
parameters={
"owner": {"type": "string", "description": "Владелец репозитория"},
"repo": {"type": "string", "description": "Имя репозитория"},
"branch": {"type": "string", "description": "Имя новой ветки"},
"from_branch": {"type": "string", "description": "Источник (по умолчанию main)"},
},
required=["owner", "repo", "branch"],
)
def create_branch(client: GitHubClient, owner: str, repo: str, branch: str, from_branch: str = "main") -> dict:
"""Создать новую ветку."""
# 1. Получаем SHA родительской ветки
ref_resp = client._request(
"GET", f"/repos/{owner}/{repo}/git/ref/heads/{from_branch}"
)
sha = ref_resp.json()["object"]["sha"]
# 2. Создаём ветку
client._request(
"POST",
f"/repos/{owner}/{repo}/git/refs",
json={"ref": f"refs/heads/{branch}", "sha": sha},
)
return {
"content": [{
"type": "text",
"text": f"✅ Ветка '{branch}' создана из '{from_branch}'"
}]
}Schritt 2: Exportieren Sie das Tool
Fügen Sie in mcp_server/tools/github/__init__.py eine Zeile hinzu:
from mcp_server.tools.github.create_branch import create_branchSchritt 3: Starten Sie den Server neu
# Остановите Ctrl+C и снова запустите
python -m mcp_server.serverDas Tool erscheint automatisch in der Liste. Keine weitere Konfiguration ist erforderlich.
So funktioniert die automatische Erkennung
ToolRegistry (in mcp_server/core/registry.py) führt beim Start Folgendes aus:
Scannt
mcp_server/tools/Findet alle Unterpakete (Verzeichnisse mit
__init__.py)Importiert sie und sucht nach Funktionen mit dem Dekorator
@mcp_toolRegistriert die gefundenen Tools
Regeln für die Erstellung von Tools
Die Funktion muss synchron sein und
client: GitHubClientals erstes Argument akzeptierenDer Dekorator
@mcp_tooldefiniert:name— Name des Tools (wie es aufgerufen wird)description— Beschreibung für den KI-Assistentenparameters— Wörterbuch der Parameter im JSON-Schema-Formatrequired— Liste der erforderlichen Parameter
Es muss ein
dictzurückgegeben werden mit dem Schlüsselcontent— einer Liste von Objekten{"type": "text", "text": "..."}Für Anfragen an die GitHub API verwenden Sie
client._request(method, path, ...)
Vorlage zum Kopieren
"""MCP tool: имя_инструмента - краткое описание."""
from mcp_server.core.registry import mcp_tool
from mcp_server.tools.github.client import GitHubClient
@mcp_tool(
name="имя_инструмента",
description="Что делает инструмент",
parameters={
"owner": {"type": "string", "description": "Владелец репозитория"},
"repo": {"type": "string", "description": "Имя репозитория"},
},
required=["owner", "repo"],
)
def имя_инструмента(client: GitHubClient, owner: str, repo: str) -> dict:
# Ваш код здесь
return {
"content": [{"type": "text", "text": "Результат работы"}]
}Anforderungen an das GitHub-Token
Das Token muss die folgenden Berechtigungen (Scopes) haben:
repo(oderContents: Read and write) — für die Arbeit mit DateienActions: Read— zum Anzeigen von WorkflowsMetadata: Read— für Basisinformationen (normalerweise standardmäßig)
Testen des Servers mit curl
# Проверка списка инструментов
curl -X POST http://127.0.0.1:3001/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <токен>" \
-d '{"jsonrpc":"2.0","id":"1","method":"tools/list","params":{}}'
# Чтение файла
curl -X POST http://127.0.0.1:3001/mcp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <токен>" \
-d '{"jsonrpc":"2.0","id":"2","method":"tools/call","params":{"name":"get_file_contents","arguments":{"owner":"LeonidYasin","repo":"mcp-server","path":"README.md"}}}'Versionierung
v0.1.0 — stdio-Transport, grundlegende modulare Architektur
v0.2.0 — Flask-HTTP-Transport, 10 Tools, automatische Erkennung, Anleitung für Entwickler
v0.3.0 — 9 neue Tools hinzugefügt: insgesamt 19, einschließlich Arbeit mit Workflows, Build und Debugging
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Create, deploy, and operate MCP servers directly from your GitHub repositories.
A MCP server built for developers enabling Git based project management with project and personal…
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for siGit (sigit.si): browse repos, search code, manage PRs/issues, web search.
Related MCP Servers
- -licenseNot gradedqualityAmaintenanceMCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.117,29690,042MIT
- FlicenseNot gradedqualityDmaintenanceStandalone MCP server for GitHub that enables repository management, branch operations, pull request handling, and commit retrieval via tools listed in the README.1
- AlicenseBqualityDmaintenanceMCP (Model Context Protocol) server for GitHub API integration. This server provides comprehensive tools for interacting with GitHub repositories, issues, pull requests, branches, and code search through a unified interface.1514MIT
- FlicenseNot gradedqualityBmaintenanceA lightweight MCP server that exposes GitHub operations as tools over HTTP, enabling any MCP-compatible client to interact with GitHub repositories without a built-in connector.1
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LeonidYasin/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server