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 "Install 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
Расширяемый MCP HTTP-сервер для GitHub API с модульной архитектурой и автоматическим обнаружением инструментов.
## Возможности
| Инструмент | Описание |
|-----------|----------|
| `get_file_contents` | Чтение содержимого файлов из репозитория |
| `create_or_update_file` | Создание и обновление текстовых файлов |
| `create_or_update_binary_file` | Создание и обновление бинарных файлов (base64) |
| `delete_file` | Удаление файлов (автоматически получает SHA) |
| `list_commits` | Список последних коммитов |
| `get_latest_workflow_error` | Ошибка последней сборки |
| `get_workflow_run_logs` | Логи конкретного запуска workflow |
| `get_full_workflow_logs` | Полные логи всех jobs запуска |
| `get_workflow_by_file` | Запуски workflow по имени YAML-файла |
| `get_commit_status` | Статус проверок для коммита |
## Установка
```bash
git clone https://github.com/LeonidYasin/mcp-server.git
cd mcp-server
pip install flask httpx python-dotenvЗапуск
python -m mcp_server.serverСервер запускается на http://0.0.0.0:3001, эндпоинт MCP: POST /mcp.
Токен GitHub передаётся через заголовок Authorization: Bearer <token>.
Related MCP server: GitHub MCP Server Plus
Подключение к DeepSeek++
В настройках плагина DeepSeek++:
URL:
http://127.0.0.1:3001/mcpТип: HTTP
Заголовок:
Authorization: Bearer <ваш_github_token>
Структура проекта
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-клиент
├── files.py # get_file_contents
├── create_update.py # create_or_update_file / _binary_file
├── delete_file.py # delete_file
└── workflows.py # workflow-инструментыКак добавить новый инструмент
Шаг 1: Создайте файл в mcp_server/tools/github/
Пример: 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"],
)
async def create_branch(
client: GitHubClient,
owner: str,
repo: str,
branch: str,
from_branch: str = "main",
) -> dict:
"""Создать новую ветку."""
# 1. Получаем SHA родительской ветки
ref_resp = await client._request(
"GET", f"/repos/{owner}/{repo}/git/ref/heads/{from_branch}"
)
sha = ref_resp["object"]["sha"]
# 2. Создаём ветку
await 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}'"
}]
}Шаг 2: Экспортируйте инструмент
В mcp_server/tools/github/__init__.py добавьте строку:
from mcp_server.tools.github.create_branch import create_branchШаг 3: Перезапустите сервер
# Остановите Ctrl+C и снова запустите
python -m mcp_server.serverИнструмент автоматически появится в списке. Никакой другой настройки не требуется.
Как работает авто-обнаружение
ToolRegistry (в mcp_server/core/registry.py) при запуске:
Сканирует
mcp_server/tools/Находит все подпакеты (директории с
__init__.py)Импортирует их и ищет функции с декоратором
@mcp_toolРегистрирует найденные инструменты
Правила написания инструментов
Функция должна быть
asyncи приниматьclient: GitHubClientпервым аргументомДекоратор
@mcp_toolзадаёт:name— имя инструмента (как будет вызываться)description— описание для AI-ассистентаparameters— словарь параметров в формате JSON Schemarequired— список обязательных параметров
Возвращать нужно
dictс ключомcontent— списком объектов{"type": "text", "text": "..."}Для запросов к GitHub API используйте
await client._request(method, path, ...)
Шаблон для копирования
"""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"],
)
async def имя_инструмента(client: GitHubClient, owner: str, repo: str) -> dict:
# Ваш код здесь
return {
"content": [{"type": "text", "text": "Результат работы"}]
}Требования к GitHub токену
Токен должен иметь следующие разрешения (scopes):
repo(илиContents: Read and write) — для работы с файламиActions: Read— для просмотра workflowMetadata: Read— для базовой информации (обычно по умолчанию)
Тестирование сервера через 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"}}}'Версионирование
v0.1.0 — stdio-транспорт, базовая модульная архитектура
v0.2.0 — Flask HTTP-транспорт, 10 инструментов, авто-обнаружение, инструкция для разработчиков
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.
Latest Blog Posts
- 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