MCP GitHub Server
MCP GitHub Server
GitHub API向けの拡張可能なMCP HTTPサーバー。モジュール式アーキテクチャとツールの自動検出を備えています。
機能
サーバーはGitHub操作用の19のツールを提供します:
📁 ファイル操作 (4)
ツール | 説明 |
| リポジトリからファイルの内容を読み取ります |
| テキストファイルの作成・更新 |
| バイナリファイルの作成・更新(base64) |
| ファイルの削除(SHAを自動取得) |
📝 コミット (2)
ツール | 説明 |
| 最近のコミットの一覧 |
| コミットのチェックステータス |
⚙️ ワークフロー (7)
ツール | 説明 |
| 最新ビルドのエラー |
| 特定のワークフロー実行のログ |
| 実行内の全ジョブの完全なログ |
| YAMLファイル名によるワークフロー実行 |
| run_idとステータス付きの実行一覧 |
| 最新実行のrun_id |
| 実行内の全ステップとそのステータスの一覧 |
🏗️ ビルドとデバッグ (6)
ツール | 説明 |
| ビルドの監視 |
| ビルドエラーの自動修正(Android/iOS) |
| Androidビルドの詳細エラー |
| iOSビルドの詳細エラー |
| ステップ名による特定ステップのログ |
| SHA自動取得による作成/更新 |
Related MCP server: git-mcp
インストール
git clone https://github.com/LeonidYasin/mcp-server.git
cd mcp-server
pip install flask httpx python-dotenv flask-cors起動
python -m mcp_server.serverサーバーは http://0.0.0.0:3001 で起動し、MCPエンドポイントは POST /mcp です。
GitHubトークンは Authorization: Bearer <token> ヘッダーで渡されます。
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-клиент
├── 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 # вспомогательные функции для сборки新しいツールの追加方法
ステップ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"],
)
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}'"
}]
}ステップ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が付いた関数を探します見つかったツールを登録します
ツール作成のルール
関数は同期関数である必要があります。最初の引数として
client: GitHubClientを受け取りますデコレータ
@mcp_toolは以下を指定します:name— ツール名(呼び出し時に使われる名前)description— AIアシスタント向けの説明parameters— JSON Schema形式のパラメータ辞書required— 必須パラメータのリスト
返り値は
dictで、キーcontentは{"type": "text", "text": "..."}オブジェクトのリストですGitHub APIへのリクエストには
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"],
)
def имя_инструмента(client: GitHubClient, owner: str, repo: str) -> dict:
# Ваш код здесь
return {
"content": [{"type": "text", "text": "Результат работы"}]
}GitHubトークンの要件
トークンには以下の権限(スコープ)が必要です:
repo(またはContents: Read and write)— ファイル操作用Actions: Read— ワークフロー閲覧用Metadata: 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ツール、自動検出、開発者向けガイド
v0.3.0 — 新しいツールを9つ追加: 合計19、ワークフロー・ビルド・デバッグ関連を含む
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