MCP GitHub Server
Provides tools for interacting with the GitHub API, enabling file operations (create, update, delete, read), commit listing, workflow management, and status checks.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP GitHub Servershow me the error from the latest workflow run"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP GitHub Server
Extensible MCP HTTP server for the GitHub API with a modular architecture and automatic tool discovery.
Features
The server provides 19 tools for working with GitHub:
📁 File operations (4)
Tool | Description |
| Reading file contents from a repository |
| Creating and updating text files |
| Creating and updating binary files (base64) |
| Deleting files (automatically obtains SHA) |
📝 Commits (2)
Tool | Description |
| List of recent commits |
| Check status for a commit |
⚙️ Workflow (7)
Tool | Description |
| Error from the latest build |
| Logs of a specific workflow run |
| Full logs of all jobs in a run |
| Workflow runs by YAML file name |
| List of runs with run_id and statuses |
| run_id of the latest run |
| List of all steps in a run with their statuses |
🏗️ Build and debugging (6)
Tool | Description |
| Build monitoring |
| Auto-fix build errors (Android/iOS) |
| Detailed Android build error |
| Detailed iOS build error |
| Logs of a specific step by name |
| Create/update with auto-obtaining 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-corsRunning
python -m mcp_server.serverThe server starts on http://0.0.0.0:3001, MCP endpoint: POST /mcp.
The GitHub token is passed via the Authorization: Bearer <token> header.
Connecting to DeepSeek++
In the DeepSeek++ plugin settings:
URL:
http://127.0.0.1:3001/mcpType: HTTP
Header:
Authorization: Bearer <your_github_token>
Project structure
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 # вспомогательные функции для сборкиHow to add a new tool
Step 1: Create a file in mcp_server/tools/github/
Example: 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}'"
}]
}Step 2: Export the tool
In mcp_server/tools/github/__init__.py, add the line:
from mcp_server.tools.github.create_branch import create_branchStep 3: Restart the server
# Остановите Ctrl+C и снова запустите
python -m mcp_server.serverThe tool will automatically appear in the list. No other configuration is required.
How auto-discovery works
ToolRegistry (in mcp_server/core/registry.py) on startup:
Scans
mcp_server/tools/Finds all subpackages (directories with
__init__.py)Imports them and looks for functions decorated with
@mcp_toolRegisters the found tools
Rules for writing tools
The function must be synchronous and take
client: GitHubClientas the first argumentThe
@mcp_tooldecorator defines:name— the tool name (how it will be called)description— a description for the AI assistantparameters— a dictionary of parameters in JSON Schema formatrequired— a list of required parameters
Return a
dictwith thecontentkey — a list of{"type": "text", "text": "..."}objectsFor GitHub API requests, use
client._request(method, path, ...)
Template for copying
"""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": "Результат работы"}]
}GitHub token requirements
The token must have the following permissions (scopes):
repo(orContents: Read and write) — for working with filesActions: Read— for viewing workflowsMetadata: Read— for basic information (usually enabled by default)
Testing the server via 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"}}}'Version history
v0.1.0 — stdio transport, basic modular architecture
v0.2.0 — Flask HTTP transport, 10 tools, auto-discovery, developer instructions
v0.3.0 — Added 9 new tools: 19 total, including workflow, build, and debugging support
This server cannot be deployed
Maintenance
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.89,959 npm90,196MIT
- 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.155 npmMIT
- 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-