GitHub MCP Server について
GitHub MCP Serverは、MCPクライアントからGitHubのアカウント、リポジトリ、ファイル、コミットを操作するサーバーです。ディレクトリ同期やリポジトリ比較にも対応しています。
主な機能
- 01アカウントの選択と認証
- 02リポジトリの作成と管理
- 03ファイルの読み取り、書き込み、プッシュ、プル
- 04ローカルとリモートのディレクトリ同期
- 05コミットの作成と一覧表示
- 06リポジトリの比較と差分確認
活用シーン
- 01GitHubリポジトリの作成や名前変更
- 02ローカルとGitHub間のファイル転送
- 03ローカルディレクトリとリポジトリの同期
- 04リポジトリのコミットや差分の確認
MCP 対応
MCPクライアント向けに、GitHubのアカウント、リポジトリ、ファイル、同期、コミット操作をツールとして提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
GitHub MCP Server
GitHub との統合機能を提供する Model Context Protocol(MCP)サーバーです。このサーバーを使用すると、MCP ツールを通じて GitHub リポジトリを操作でき、リポジトリ管理、ファイル操作、コミット処理などに対応します。
機能
- アカウント管理と認証
- リポジトリの作成と管理
- ファイル操作(読み取り、書き込み、プッシュ、プル)
- コミット操作
- ディレクトリの同期
- リポジトリの比較と差分表示
インストール
ash npm install @modelcontextprotocol/server-github
設定
MCP 設定ファイル(cline_mcp_settings.json)にサーバーを追加します。
json { "mcpServers": { "github": { "command": "node", "args": ["/path/to/github-mcp-server/dist/index.js"], "env": { "GITHUB_TOKEN_1": "your-github-token", "GITHUB_OWNER_1": "your-github-username" }, "disabled": false, "alwaysAllow": [] } } }
利用可能なツール
アカウント管理
list_accounts
サーバーに設定されている利用可能な GitHub アカウントを一覧表示します。
select_account
以降の操作に使用する GitHub アカウントを選択します。
リポジトリ管理
create_repository
新しい GitHub リポジトリを作成します。
ypescript { owner?: string; // Repository owner (optional if account selected) name: string; // Repository name description: string; // Repository description private?: boolean; // Whether repository is private }
clone_repository
GitHub リポジトリをローカルディレクトリにクローンします。
ypescript { owner?: string; // Repository owner repo: string; // Repository name branch?: string; // Branch name (default: main) outputDir: string; // Local directory to clone into }
rename_repository
既存の GitHub リポジトリの名前を変更します。
ypescript { owner?: string; // Repository owner repo: string; // Current repository name new_name: string; // New repository name }
ファイル操作
push_file
ファイルを GitHub リポジトリにプッシュします。
ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // Target path in repository message: string; // Commit message sourcePath: string; // Local file to push }
pull_file
GitHub リポジトリからファイルをプルします。
ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // File path in repository outputPath: string; // Local path to save file }
sync_directory
ローカルディレクトリとリモートディレクトリを双方向に同期します。
ypescript { owner?: string; // Repository owner repo: string; // Repository name path: string; // Directory path in repository localPath: string; // Local directory path }
コミット操作
create_commit
複数のファイル変更を含むコミットを作成します。
ypescript { owner?: string; // Repository owner repo: string; // Repository name branch: string; // Branch name message: string; // Commit message changes: Array<{ path: string; // File path in repository sourcePath: string; // Local file path (for add/modify) operation: 'add' | 'modify' | 'delete'; }>; }
list_commits
リポジトリのコミットを一覧表示します。
ypescript { owner?: string; // Repository owner repo: string; // Repository name branch?: string; // Branch name author?: string; // Filter by author since?: string; // ISO 8601 date - commits after until?: string; // ISO 8601 date - commits before }
開発
サーバーをビルドするには、次のコマンドを実行します。
ash npm install npm run build
環境変数
- GITHUB_TOKEN_: GitHub の個人用アクセストークン
- GITHUB_OWNER_: トークンに対応する GitHub ユーザー名
- DEFAULT_OWNER: 使用するデフォルトの GitHub アカウント
N を増やすことで、複数のアカウントを設定できます(1、2 など)。
ライセンス
MIT
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。